After the successful distance measuring test last week, our next goals were:
- Set up a breadboard prototype with 3 sensors and 2 speakers.
- Program the device to work with 3 sensors simultaneously.
- Program the speakers to output a beeping noise with various speeds depending on the object proximity and direction to each of the sensors.
Table 1. Truth table of which
speaker would work depending on the direction of the detected object.
Left Sensor |
Middle Sensor |
Right Sensor |
|
Left Speaker |
Right Speaker |
On |
Off |
Off |
|
On |
Off |
Off |
Off |
On |
|
Off |
On |
On |
Off |
On |
|
On |
On |
Off |
On |
Off |
|
On |
On |
This week's accomplishments:
The circuit was set up correctly with the 3 sensors, 2 speakers, and the Arduino Nano.
The 3 sensors were tested and were correctly measuring distance simultaneously.
The speakers did work with the sensors but an issue was found.
The warning system did not work as planned. It did
output a beeping sound when a sensor was triggered, but the 2 speakers were not
working at the same time. Only one speaker could operate at any given time.
This was found to be due to the Arduino Nano only being able to output one
command at a time, which is because the microprocessor only has one core. To
output two or more commands at once, a multicore processor must be used but
this would exceed the budget of the project.
How the issue was solved:
During the weekend after the lab day, a solution to
the problem was researched and found. The solution was to use the timer feature
included within the Arduino Nano. The Arduino has three timers, two of which
could be used for our needs. When triggered, the timer periodically outputs a
signal to the speaker independently of the microprocessor. To do this, an
Arduino library called “Tone.h” was used (https://code.google.com/archive/p/rogue-code/wikis/ToneLibraryDocumentation.wiki).
With this, we were able to program the speakers to be able to work at the same
time or separately.
Comments
Post a Comment