The project makes use of an ultrasonic sensor, LEDs (visual aid) and a piezo buzzer (audio aid) to help assist in determining how far away from a wall a driver might be.
The closer to the wall the driver gets, the louder the buzzer gets and the greater number of various colored LEDs light up.
ConnectionsHC-SR04 ultrasonic sensor:
*Trigger pin to digital pin 7
*Echo pin to digital pin 6
*VCC to 5v
*GND to 0v(ground)
LEDS: (+ve legs to digital pins & -ve legs to GND)
*green led1 to digital pin 4
*green led2 to digital pin 5
*yellow led1 to digital pin 13
*yellow led2 to digital pin 12
*red led1 to digital pin 11
*red led2 to digital pin 10
*white led1 to digital pin 9
*white led2 to digital pin 8
Piezo Buzzer:
+ve leg to digital pin 3
-ve leg to GND
Layout & Operation*nb. the transistor is not required for an ordinary piezo buzzer but it is recommended that you use a resistor with the buzzer, if the buzzer volume is too low, you can lower the value of the resistor. (so maybe replace the 1k Ohm with a 220 Ohm resistor). Or you could just change the values of the variable "sound" in the code to suit your project.
I hope I didn't forget to cite additional sources of inspiration. If I clearly used some verbatim pieces of your code to build the functions on this page and forgot to cite you, contact me and I may add a link to your work.
Comments