An Arduino Ultrasound range alerting project, that alerts the user of the proximity of obstacles using Ultrasound HC-SR04 Ultrasonic Module. The distance is measured using the code and based on the proximity appropriate LEDs are lit up.
Step 1: Get the Items
There are not many things you require.
1) Arduino Microprocessor (I used an Uno )
2)Ultrasonic Module (I used a HC-SR04 module)
4) 3 Different Colored LEDs
4) Breadboard (recommended)
The complete list costs less than $15. Pretty cheap for a decent school project.
Step 2: Understanding How It Works
The most important part of any project is to understand how it works. This makes, manipulating the project and using it in your own creative projects much more easier.
The HC-SR04 Module emits ultrasonic waves when it receives a trigger from the Arduino (a 10 microsecond long high pulse). The Module then sends a HIGH pulse to the arduino board,until it receives the reflected echo of the waves. The Arduino measures the length of time for which, it receives this HIGH pulse, in microseconds. A calculation is performed on this value:
Distance =(Speed * Time)/2 (because twice the distance is covered in an echo )
It must be noted, however, that speed is in cm/s to give accurate values of distance in cm.
This means value speed becomes 340*100 = 34000cm/s
Also, time in seconds becomes 10^-6 of value recorded. Therefore overall the calculation becomes :
Recorded value *0.017.
Based on the code, different LEDs light, depending on the range of the obstacle
Step 3: Circuit and Code
The circuit is very simple. Mount the HC-SR04 Sensor onto the breadboard. Use jumpers to make appropriate connections between Arduino and HC-SR04. Make independent connections to LEDs as well.
The code is designed to satisfy needs of project. Feedback loop becomes faster as obstacle comes closer to object (as part of application). Calculated values are printed onto the serial monitor
You can find both code and circuit in the .pdf document.
This is intellectual property of Mohit Vakil. No content may be reproduced without citing credit to original author - Mohit Vakil.
Step 4: Power Up!!
Connect the adapter to your laptop, or, simply power the arduino with a 9V battery, and the project is functional. When you launch the serial monitor you can see the calculated distance values. The LEDs light up based on range of obstacle.
Be sure to check out the video
Participated in the
Arduino All The Things! Contest