Arduino Based Distance Measurement using Ultrasonic Sensor

Ultrasonic sensors are great toolsΒ to measure distance without actual contact and used at several places likeΒ water level measurement, distance measurement etc. 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.Β Basic principal of ultrasonic distance measurement is based on ECHO. 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.

Β Arduino-Distance-Sensor

Components Used

  1. Arduino Pro Mini
  2. Ultrasonic sensor Module
  3. 16×2 LCD
  4. Scale
  5. Bread board
  6. 9 volt battery
  7. Connecting wires

Ultrasonic Sensor Module

Ultrasonic sensor HC-SR04 is used hereΒ to measure distance in range of 2cm-400cm with accuracy of 3mm. The sensor module consists of ultrasonic transmitter, receiver and the control circuit. The working principleΒ of ultrasonic sensor is as follows:

  1. High level signal is sent for 10us using Trigger.
  2. The module sends eight 40 KHz signals automatically, and then detects whether pulse is received or not.
  3. If the signal is received, then it is through high level. The time of high duration is the time gap between sending and receiving the signal.

Distance= (Time x Speed of Sound in Air (340Β m/s))/2

Ultrasonic-Sensor-HC-SR04

Timing Diagram

The module works on the natural phenomenon of ECHO of sound. A pulse is sent for about 10us to trigger the module. After which the module automatically sends 8 cycles of 40 KHz ultrasound signal and checks its echo. The signal after striking with an obstacle returns back and is captured by the receiver. Thus the distance of the obstacle from the sensor is simply calculated by the formula given as

Β Β Β Β Β Β Β Β Β Β Β  Distance= (time x speed)/2.

Here we have divided the product of speed and time by 2 because the time is the total time it took to reach the obstacle and return back. Thus the time to reach obstacle is just half the total time taken.

Read MoreUltrasonic-sensor-timing-diRead More:Β Β  Arduino Based Distance Measurement using Ultrasonic Sensor

About The Author

Scroll to Top