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.
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.
Project Source Code
###
// Program to interface Sharps distance sensor. Set vref =3v for ADC0804 #include<reg51.h> #define port P3 #define adc_input P1 #define dataport P0 #define sec 100 sbit rs = port^0; sbit rw = port^1; sbit e = port^2; sbit wr= port^3; sbit rd= port^4; sbit intr= port^5; int test_final=0 ,shift=0; void delay(unsigned int msec ) { int i ,j ; for(i=0;i<msec;i++) for(j=0; j<1275; j++); } void lcd_cmd(unsigned char item) // Function to send command to LCD { dataport = item; rs= 0; rw=0; e=1; delay(1); e=0; return; } void lcd_data(unsigned char item) // Function to send data to LCD { dataport = item; rs= 1; rw=0; e=1; delay(1); e=0; return; } void lcd_data_string(unsigned char *str) // Function to send string to LCD { int i=0; while(str[i]!='