Arduino Projects    |   Raspberry Pi  |     Electronic Circuits   |   AVR    |    PIC    |    8051    |    Electronic Projects

How to interface Sharp's distance sensor with 8051 microcontroller (AT89C51)


Developed By: 
Himanshu Choudhary

This project uses Sharp’s distance measuring sensors for exact distance measurement. Advanced measurement techniques make these sensors more reliable. They have higher precision since they are less influenced by the color and reflectivity of the reflected object. They use a focused beam to indicate the presence and location of an object in a particular range depending on the variant of the sensor. Typical ranges for different sharp sensors vary from 4 cm to 150 cm.

The project works on the same principle as that of simple IR sensor based distance measurement. The analog output of the sensor is directly converted to digital by employing an ADC0804 interfaced with AT89C51.  The measured distance is also displayed on an LCD screen. This project is used for detecting humans and objects in several devices, security systems and robotics applications. It can be employed for sanitary purposes in electronic faucets, flush levers, soap dispensers etc.

Interfacing Sharp Distance Sensor with 8051 Microcontroller (AT89C51)



This project mainly consists of three units: a sensor unit, an ADC component and the LCD module.

The sensor, Sharp 2Y0A02 infrared ranger, gives an output voltage proportionate to the distance of an object from it. It has a detection range of 20cm - 150cm and the output characteristic can be obtained from the datasheet. The analog output of the sensor is connected to the input of the ADC0804.  

The input received at ADC is processed and its equivalent binary is sent to the microcontroller. The Vref/2 pin of the ADC is connected to a preset which can be adjusted to set the step size for relevant measurement.
The microcontroller AT89C51 is programmed to read the digital output from ADC and convert it into a decimal representation. This value corresponds to the distance of the object and is sent to be displayed on a 16x2 LCD.
Note: This value does not correctly represent the distance. For actual measurement, it has to be calibrated in accordance with the characteristic curve given in the datasheet, through microcontroller programming.

Circuit Diagram



This Code is only visible to Registered users. Please Login/Register



Presets | Variable Resistors
A preset is a three legged electronic component which can be made to offer varying resistance in a circuit. The resistance is varied by adjusting the rotary control over it. The adjustment can be done by using a small screw driver or...
AT89C51 Microcontroller, Atmel 89C51 Controller Image
AT89C51 Microcontroller

AT89C51 is an 8-bit microcontroller and belongs to Atmel's 8051 family. ATMEL 89C51 has 4KB of Flash programmable and erasable read only memory (...

16 x 2 LCD | 16x2 Character LCD Module


LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of applications. A 16x2 LCD display is very basic module and is very commonly used in various devices and circuits. These modules are preferred over seven segments...

ADC0804 | ADC 0804

Analog to digital converters find huge application as an intermediate device to convert the signals from analog to digital form. These digital signals are used for further processing by the digital processors. Various sensors like temperature, pressure, force etc. convert the physical characteristics into electrical signals that are analog in nature....

Browse 4m+ Electronic Products

Pick the right product for your next design project with "Mouser Store". Mouser Electronics brings broadest range of semiconductors and electronic components from over 500 industry leading suppliers. 
Mouser specializes in the rapid introduction of new products and technologies for design engineers and buyers that includes semiconductors, interconnects, passives, and electro-mechanical components. Providing the best possible service with the flexibility of not requiring a minimum order and same-day shipping, Mouser has it all.
When you need the right part right now, think of Mouser
Thank you
Team EG


You are here