Arduino Distance Measure Using Ultrasonic Sensor
by IoTFever in Circuits > Arduino
754 Views, 6 Favorites, 0 Comments
Arduino Distance Measure Using Ultrasonic Sensor

Arduino distance measurement using ultrasonic sensor HC-SR04
Ultrasonic sensors are great tools to measure distance without actual contact and used at several places like water level measurement, distance measurement, obstable avoiding robot and many more. This is an efficient way to measure small distances precisely.
In this project we have used an Ultrasonic Sensor to determine the distance of an obstacle from the sensor. When sound waves are transmitted in environment then waves are return back to origin as ECHO after striking on the obstacle. So we only need to calculate the travelling time of both sounds means outgoing time and returning time to origin after striking on the obstacle.
As speed of the sound is known to us, after some calculation we can calculate the distance.
Let's start,
Required Hardware


- Arduino uno/nano
- Ultrasonic sensor (HC-SR04)
- Jumper Wires
- Breadboard (optional)
Required Software
Arduino Sofrware : Arduino IDE
Connecting the Hardware
- Arduino pins need wired are below:
- pin 10 on Arduino ---> on ultrasonic -- trig Pin
- pin 9 on Arduino ---> on ultrasonic-- echoPin
- Vcc on Arduino ---> on ultrasonic pin Vcc / +5v
- Gnd on Arduino ---> on ultrasonic pin Gnd
Circuit Diagram

Make the connections.
Setting Up Arduino IDE

For selecting board follow the steps, Go to Tools ==> Board ==> search for Arduino Uno and select this , then select com port .
Download the skecth below the link , and open code,
Now upload the source code.
Code
Code for Project Code Link
Final Step


After the successful upload of code you will message Done , then open serial monitor here you will distance from obstacle.
and here you are finish with project , Enjoy your project.
That’s it for this tutorial. Thanks for reading.
If you have any question about today’s tutorial, please feel free to share via the comment section
I hope it will helpful to you...........................Thanks.
My Another Project


