How does an Ultrasonic Distance Sensor work?
The Ultrasonic Sensor sends out a high-frequency sound pulse and then times how long it takes for the echo of the sound to reflect back. The sensor has 2 openings on its front. One opening transmits ultrasonic waves, (like a tiny speaker), the other receives them, (like a tiny microphone).
The speed of sound is approximately 341 meters (1100 feet) per second in air. The ultrasonic sensor uses this information along with the time difference between sending and receiving the sound pulse to determine the distance to an object. It uses the following mathematical equation:
Distance = Time x Speed of Sound divided by 2
Time = the time between when an ultrasonic wave is transmitted and when it is received
You divide this number by 2 because the sound wave has to travel to the object and back.
Before going to working of the project, it is important to understand how the ultrasonic sensor works. The basic principle behind the working of ultrasonic sensor is as follows:
Using an external trigger signal, the Trig pin on ultrasonic sensor is made logic high for at least 10µs. A sonic burst from the transmitter module is sent. This consists of 8 pulses of 40KHz.
The signals return back after hitting a surface and the receiver detects this signal. The Echo pin is high from the time of sending the signal and receiving it. This time can be converted to distance using appropriate calculations.
The aim of this project is to implement an obstacle avoiding robot using ultrasonic sensor and Arduino. All the connections are made as per the circuit diagram. The working of the project is explained below.
When the robot is powered on, both the motors of the robot will run normally and the robot moves forward. During this time, the ultrasonic sensor continuously calculate the distance between the robot and the reflective surface.
This information is processed by the Arduino. If the distance between the robot and the obstacle is less than 15cm, the left wheel motor is reversed in direction and the right wheel motor is operated normally.
This will rotate the robot towards right. This rotation continues until the distance between the robot and any obstacle is greater than 15cm. The process continues forever and the robot keeps on moving without hitting any obstacle.
- As the project is based on Arduino, the programming is very easy and can be easily modified.
- Doesn’t require the Arduino Motor Shield.
- When using a 9V battery, at least 2 such batteries are needed to power the robot. It is better to use 3 9V batteries (one for Arduino and ultrasonic sensor, one for L293D and other for motors).
- The ultrasonic sensor should not be connected directly to power supply as it might affect the normal performance.
- Additionally, a servo motor can be fixed to the ultrasonic sensor and only ultrasonic sensor rotates according to the servo. Based on the distance, the entire robot rotates.
- Instead of ultrasonic sensor, an IR transmitter – receiver pair can also be used.
- Obstacle avoiding robots can be used in almost all mobile robot navigation systems.
- They can be used for household work like automatic vacuum cleaning.
- They can also be used in dangerous environments, where human penetration could be fatal.