Introduction: Ultrasonic Range Finder Using Arduino

Ultrasonic Range Finder is a simple method of calculating distance from an obstacle from a distance without any physical contact. It employs an ultrasonic distance sensor which uses sound pulses to measure distance. By emitting an ultrasonic pulse and timing how long does it takes to hear an echo, this project can easily estimate how far the object is. This project also employs a LCD to display the distance and a buzzer for cautioning if the obstacle is too close to the sensor.

To initiate a distance measurement, we need to send a 5V high signal to the Trig pin for at least 10 µs. When the module receives this signal, it will emit 8 pulses of ultrasonic sound at a frequency of 40 KHz from the transmitting transducer. Then it waits and listens at the receiving transducer for the reflected signal. If an object is within range, the 8 pulses will be reflected back to the sensor. When the pulse hits the receiving transducer, the Echo pin outputs a high voltage signal. The length of this high voltage signal is equal to the the total time the 8 pulses take to travel from the transmitting transducer, be reflected off the object, and travel back to the receiving transducer. However, since we only want to measure the distance to the object, we divide this time in half to get the time variable in the d = s x t equation above. Since the speed of sound is known, we also know the s variable, and now we can solve the equation for distance.

(Courtesy:

http://www.circuitbasics.com/how-to-set-up-an-ultrasonic-range-finder-on-an-arduino/)

Step 1: Components Required:

1. Arduino (I have used Uno)

2. Ultrasonic Range Sensor (HC-SR04)

The HC-SR04 ultrasonic range finder has four pins: Vcc, Trig, Echo, and GND. The Vcc pin supplies the power to generate the ultrasonic pulses. The GND pin is connected to ground. The Trig pin is where the Arduino sends the signal to start the ultrasonic pulse. The Echo pin is where the ultrasonic range finder sends the information about the duration of the trip taken by the ultrasonic pulse to the Arduino.

3. Piezo Buzzer

4. LCD

5. Trim Pot

6. USB cable

7. Jumper wires

Step 2: Connections

The connections for the circuit is quite easy. I have attached a Fritzing document for the connections.

Step 3: Code

The code for this project is very simple. I have attached the doc for the code. Make sure you connect the correct pin numbers of the LCD according to your code.

Step 4: Precautions

Your Ultrasonic Range Finder is ready!

However, in some case the sensor may fail to work as shown.

Make sure that the sensor is properly grounded.

Comments

author
IsaacPierce made it! (author)2016-06-08

Very cool I have an Arduino but I need to get an Ultrasonic Range Finder to play around with.

author
shubaangi_95 made it! (author)shubaangi_952016-07-06

Hi! The ultrasonic sensor is really cheap. You can buy one from amazon.
Or you could make one yourself!

author
M FakharZ made it! (author)2016-06-18

How can we use it with Unity3D?

author
shubaangi_95 made it! (author)shubaangi_952016-06-27

Hi! I have never used Unity 3D myself. But here some links which I found on Google. Hope they are useful

https://www.instructables.com/id/Play-Block-Breaker...

http://naruto7.com/search/Unity%20and%20Arduino.%20A%20test%20with%20an%20ultrasonic%20sensor.

author
Dave P made it! (author)2016-06-11

shubaangi_95

Your range finder is pretty cool, it caught my eye enough to raise a question. Could it be made to guide my Robot mower? My grandson suckered me in to building a robot mower. I need a way reference a perimeter boundary. And index the path 18 inches after each pass. My mechanical ability for this project is somewhat endless. My electronic common sense for the lack of a better term is "I Need a Helmet" Really would rather not see my grandson have the opportunity to witness my defeat in this challenge. Only because my daughter would have him hand me the "KITTY kitty" trophy. Can you offer a solution to help an old man out.

99dave.p@gmail.com

author
RobDeVoer made it! (author)RobDeVoer2016-06-17

Hi Dave, with the use of a couple of range finders you can help the mower not bump into things but making it smoothly run over an area of grass and mow it all needs a lot more intelligence. Look at the instructable from ArduMower or Google "how to build a robot that mows the grass" for more information.

author
RobDeVoer made it! (author)2016-06-16

Great instructable! Keep publishing them, I like what you are doing.

I also enjoy using the Fritzing tool to design my Arduino projects. May be useful to add a screen shot of the wiring design to the instructable so people who don't want to use Fritzing can still see how to wire the project up.

author
shubaangi_95 made it! (author)shubaangi_952016-06-17

Thank you! I'll keep that in mind.

author
IsaacPierce made it! (author)2016-06-08

Very cool I have an Arduino but I need to get an Ultrasonic Range Finder to play around with.