Ultrasonic Rangefinder using 8051
Contents
- 1 Circuit Principle:
- 2 Circuit Diagram:
- 3 Circuit Components:
- 4 Circuit Design:
- 5 Project Circuit Working:
- 6 Algorithm:
- 7 Project Output Video:
- 8 How to Operate?
- 9 Project Circuit Applications:
- 10 Limitations of the Circuit:
- 11 Download Project Code
- 12 Related Articles
- We have different ways to measure the distance. One way is to use ultra sonic 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 2.5 meters at accuracy of 1 cm.
Circuit Principle:
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 Components:
- At89c51 controller
- At89c51 programming board
- programming cable
- 12V adaptor or DC battery
- HC-SR04 ultrasonic module
- 16*2 LCD
- Pot – 10k
- Electrolytic capacitor – 10uF, 16V
- Resistor – 10k
- 12 MHz crystal
- 33pf capacitors -2
- connecting wires
Circuit Design:
The major components in this project are at89c51 microcontroller and ultrasonic module. The ultrasonic sensor TRIGGGER and ECHO pins are connected to the P3.5 and P3.2 respectively. LCD data pins are connected to the PORT2 of the controller and controller pins RS, RW, En are connected to the P1.0, P1.1 and P1.2 respectively. Here LCD (liquid crystal display) is used to display distance of the object. Pot RV1 is used to vary the contrast of the LCD. Power supply pins of controller and ultrasonic sensor are connected to the 5V DC.Ultrasonic Module:HC-SR04 ultrasonic module is designed to measure the range of the object in the 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.Features:- resolution of this module 3mm
- ranging distance is 2cm to 400cm
- angle measurement is 30 degrees
- trigger input pulse width is 10us
- required current 15mA
- Frequency 40 KHz
Pin Configuration:- 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 10us. 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.
Project Circuit Working:
When HIGH pulse of 10us 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/sAlgorithm:
1. send high pulse for 10 micro seconds on TRIG pinInitially P3.5 = 0;P3.5 = 1;delay_ms (10);P3.5 = 0;2. Wait until the module transmits 40 KHz pulses. When 8th pulse is transmitted echo pin becomes HIGH, TIMER0 starts counting, when input INT0 goes LOW and timer counts the timewhile (INT0 == 0);while (INT0 == 1);3. 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/24. the speed of the ultrasonic pulse is 340.29 m/s or 34029 cm/s5. distance = speed * time à34029 * TIMER0/26. At 12 MHz TIMER0 gets incremented for 1usRange = 17015 * TIMER0 * 10 pow (-6)7. Target range = TIMER0/58 cmsHow 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.
Project Circuit 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.
- source:http://www.electronicshub.org
No comments:
Post a Comment