Range finder using Ultrasonic Sensor
Components required
- Arduino UNO + USB cable
- HC-SR04 Ultrasonic sensor
- Male/Female Jumper wires
About the project
Ultrasonic Sensor
We then convert the microseconds read into centimetres and print it in the serial monitor.
Formula
The speed of sound is approximately 340 m/s. So the distance travelled in t microseconds is :
v = 340 m/s
v = 340 x 100 cm/ 1000000 us
v = 0.034 cm/us
v = D / t
D = v x t
Since D = 2 x d (Actual distance of the object, because the wave travels to and fro from the object)
d = v x t / 2
d = (0.034 / 2) x t
Here the distance is in centimeters.
Uploading the sketch and testing the sensor
Find the code to this project here.
Upload the sketch on to the Arduino and then connect the ultrasonic sensor according to the schematics below:
Now, all you need to do is open the serial monitor and view the distances printed and play with it.
What next ?
Ultrasonic sensors are low cost and can be used for various purposes, like a proximity sensor for an autonomous robot, or for a quadcopter, to detect if there is an object close by.
P.S: Link to my Arduino project hub page for this project: Range finder using Ultrasonic Sensor
Comments
Post a Comment