- 1 Output Video
- 2 Principle of Ultrasonic Rangefinder
- 3 Circuit Diagram of Ultrasonic Rangefinder using 8051
- 4 Components Required for Ultrasonic Rangefinder
- 5 Circuit Design of Ultrasonic Rangefinder
- 6 How Ultrasonic Rangefinder using 8051 Circuit works?
- 7 Algorithm for Program
- 8 How to Operate?
- 9 Ultrasonic Rangefinder Project Applications
- 10 Related Articles
In this project, we have built an Ultrasonic Rangefinder using 8051 Microcontroller and Ultrasonic Sensor. We have different ways to measure the distance. One way is to use Ultra Sonic Sensor or Module for distance measurement. This article explains you how to measure the distance using 8051 microcontroller. This Ultrasonic Range Finder system measures the distance up to 4 meters with an accuracy of 3 mm.
Principle of Ultrasonic Rangefinder
Generally, the distance can be measured using pulse echo and phase measurement method. Here, the distance can be measured using pulse echo method. The ultrasonic module transmits a signal to the object, then receives echo signal from the object and produces output signal whose time period is proportional to the distance of the object. The mechanism of the ultra sonic sensor is similar to the RADAR (Radio Detection and Ranging).
This circuit calculates the distance of the object based on the speed of the sound wave at normal temperature and displays the distance on LCD.
Also Get an Idea about How to Interface 16×2 LCD with 8051 Microcontroller
Circuit Diagram of Ultrasonic Rangefinder using 8051
Components Required for Ultrasonic Rangefinder
- AT89C51 Microcontroller
- 8051 Programming board
- Programming cable
- HC – SR04 Ultrasonic Module
- 16 x 2 LCD
- 10KΩ Potentiometer
- 10µF / 16V Electrolytic Capacitor
- 2 x 10KΩ Resistor (1/4 Watt)
- 0592 MHz Crystal
- 2 x 33pF Capacitors
- Push Button
- Connecting wires
- Power Supply
- Keil µVision Software
- Willar Software
Circuit Design of Ultrasonic Rangefinder
The major components in this project are AT89C51 Microcontroller, Ultrasonic Sensor and LCD Display. The TRIGGER and ECHO pins of the Ultrasonic Sensor are connected to the P3.1 and P3.2 pins respectively. LCD data pins are connected to the PORT1 of the microcontroller and controller pins RS, RW and EN are connected to the P3.6, GND and P3.7 respectively. Here, the LCD (Liquid Crystal Display) is used to display distance of the object. 10KΩ POT is used to vary the contrast of the LCD. Power supply pins of the microcontroller, LCD and Ultrasonic Sensor are connected to the 5V DC.
Ultrasonic Module (Ultrasonic Sensor)
HC – SR04 Ultrasonic Module works on the principle of SONAR and is designed to measure the range of the object in small embedded projects. It offers excellent range detection with high accuracy and stable readings. The operation of the module is not affected by the sunlight or black material.
- Resolution of this module is 3mm
- Ranging distance is 2cm to 400cm (4 meters)
- Angle measurement is 30 degrees
- Trigger input pulse width is 10µs
- Required current 15mA
- Frequency 40 KHz
- Vcc: This pin is connected to the positive 5V DC.
- Trigg: The trigger signal is applied to this pin for starting the transmission. This signal must be HIGH for 10µs. When a valid trigger signal is applied, it generates 8 pulses of 40 KHz.
- Echo: At this pin, module generates the signal whose time period is proportional to distance.
- GND: This pin is connected to the ground.
How Ultrasonic Rangefinder using 8051 Circuit works?
When HIGH pulse of 10µs is applied to the TRIG pin, the ultrasonic module transmits 8 consecutive pulses of 40 KHz. after transmitting 8th pulse the ECHO pin of the sensor becomes HIGH. When the module receives reflected signal from the object, the ECHO pin becomes LOW. The time taken by the signal to leave and return to the sensor is used to find out the range of the object.
Distance in centimeters = (Time/58)
Object distance in inches = (Time/148)
Distance can also be calculated using speed of the ultrasonic wave 340m/s
Algorithm for Program
- Send HIGH pulse for 10 micro seconds on TRIG pin
Initially P3.1 = 0;
P3.1 = 1;
P3.1 = 0;
- Wait until the module transmits 40 KHz pulses. When 8thpulse is transmitted echo pin becomes HIGH, TIMER0 starts counting, when input INT0 goes LOW and timer counts the time
while (INT0 == 0);
while (INT0 == 1);
- TIMER0 value is equal to the time taken by the signal to go forward and comeback so we need to take only half time.
Time required = TIMER0 VALUE/2
- The speed of the ultrasonic pulse is nothing but the speed of sound which is 340.29 m/s or 34029 cm/s
- Distance = speed * time = 34029 * (TIMER0) / 2
- At 11.0592 MHz, TIMER0 gets incremented for 1µs.
Range = 17015 * TIMER0 X 10-6
- Target range = TIMER0/58 cm.
How to Operate?
- Initially burn the program to the microcontroller
- Now give the connections as per the circuit diagram
- While giving the connections make sure that Vcc of ultrasonic module is connected to 5V DC
- Switch on the board supply
- Place the obstacle in front the ultrasonic module, now you can observe the distance on LCD.
- Switch off the board supply.
Ultrasonic Rangefinder Project Applications
- Used to measure the obstacle distance.
- This system used in automotive parking sensors and obstacle warning systems.
- Used in terrain monitoring robots.
Limitations of the Circuit
- This system is not able to measure longer distances.