![](/uploads/1/2/7/2/127247491/649122733.jpg)
Assembly 8051
About
A simple ultrasonic range finder using
8051
microcontroller to measure distances up to 2.5 meters at an accuracy of 1centimetre. AT89c51
microcontroller and the ultrasonic transducer module HC-SR04
forms the basis of this circuit.A sensor is mounted at the back of the car. It detects the distance by sending electromagneticpulses through a transmitter, reflected by an obstacle. The sensor is connected to the
HC-SR04
module. This module works on a 5V DC supply and the standby current is less than 2mA. It transmits an ultrasonic signal, picks up its echo, measures the time elapsed between the two events and outputs a waveform whose high time is modulated by the measured time which is proportional to the distance.The microcontroller accepts this signal, performs necessary processing and displays the corresponding distance on the
16x2 LCD
.If this distance is less than 20 centimetre, a buzzer
is sound.Design
1) Ultrasonic sensor 2) Microcontroller 3) Bluetooth transmitter 4) LCD Display 5) Buzzer. Applications and Advantages: Applications of Android based Ultrasonic Distance Meter with Buzzer indication: 1) This project can be used in Industries, companies. This project also has application in Robotics. Ultrasonic Sensor based Water Level Controller using 8051 Microcontroller. Similar to 9-level overhead water tank indicator, the ultrasonic sensor based water level controller using 8051 microcontroller project is an advanced and innovative electronics project designed for displaying water level in a tank and also control pump motor accordingly.
- Make
Trigger
pin of the sensor high for 10 microseconds. This initiates a sensor cycle. - 8 x 40 kHz pulses will be sent from the transmitting transducer of the sensor.
- The
Echo
pin on the sensor goes from low to high. - The 40 kHz sound wave bounces off the nearest object and returns to the sensor.
- When the sensor detects a reflected sound wave, the
Echo
pin goes to low again. - The distance between the sensor and the detected object can be calculated based on the length of time, the
Echo
pin is high. - If no object is detected, the
Echo
pin will stay high for 38ms and then go low.
Components Used
- AT89c51 chip
- Jumper wires
- Rainbow wires
- 16x2 LCD
- Buzzer
- HC-SR04 module (transducer)
- Wireless Remote Controlled car
- 9V DC Battery
- Development Board
Block Diagram
Circuit Configuration
To interface the sensor to
AT89c51
microcontroller, we need two I/O pins. One is connected to P3.2
and other to P3.5
.- Connect the
Trigger
pin of sensor toP3.5
ofAT89c51
. - Connect the
Echo
pin of the sensor toP3.2
ofAT89c51
. - Configure the
TIMER
of 8051 in mode 1. - When
P3.2
is high, theTIMER
starts counting. - When
P3.2
goes low,TIMER0
holds it's count. - Declare
P3.2
as input.
Circuit Diagram
Algorithm
- Send a 10 micro second high pulse at
Trigger
: - Wait until the sensor transmits the eight 40KHz pulses and signal reflection. Initially the
Echo
pin is low. When the transmitter completes a pulse and the pin goes high, theTIMER
starts counting. When input atP3.2
goes low,TIMER
holds count. Logic used to implement this is: - Sometimes, due to errors in the sensor functioning, the
8051 microcontroller
may go into an infinite loop. To solve that issue we generate a delay of 40 milliseconds after triggering the ultrasonic sensor. TIMER
= Time taken by the signal to go forward + come back.- It measures the signal traces the whole distance twice. So, the time taken by the signal to travel the distance is:
Ultrasonic
pulses travels with the speed of sound at 340.29 m/s=34029 cm/s
- Range= Velocity * Time
- At 12MHz,
TIMER0
gets incremented for 1microsecond.
This formula is used to calculate the range of the target easily.
![](/uploads/1/2/7/2/127247491/649122733.jpg)