This is a simple distance detection circuit with the use of an ultrasonic sensor, a buzzer, a row of LEDs, and 2 relays (optional).
The ultrasonic distance sensor will light a row of LEDs depending on distance. Then if a change in distance is detected, that exceeds your threshold, a buzzer will sound and the optional relays can toggle a device (a light).
All options are configurable such as the threshold, number of LEDs, maximum perceived distance, etc...
You can download the Fritzing application to assist in the build/codeing process here: http://fritzing.org/download/
- Garage parking sensor
- Electronic measuring device
- Security alarm
- Motion detection
- Add complexity to your everyday shenanigans.
This is my first project on the Arduino and using C++ so please be gentle ;)
*** Now with Mario sounds!!! ***
Step 1: Build It
Build the circuit using the listed parts:
- 1 Ultrasonic sensor (I use the 4 prong model)
- 1 Buzzer
- 2 Relays (optional)
- 8 LEDs (4 red, 2 yellow, 2 green)
- 8 220 ohm resistors
- A plethora of jumpers
Step 2: Code It
Using the supplied code, write your program. I have included comments in the code to explain what each section is doing. You can then modify the code to fit your needs.
Step 3: Resources
- Arduino Code Reference: https://www.arduino.cc/en/Reference/HomePage
- Arduino Ping: https://www.arduino.cc/en/Tutorial/Ping
- Mario Sounds: http://bikeshedeffect.weebly.com/arduino-piezo-sou...
- Melody Info: https://www.arduino.cc/en/Tutorial/PlayMelody
- Fritzing: http://fritzing.org/home