June 1, 2012 at 2:32 pm #1829
I have successfully used ADC0804 to convert the analogue input of an IR obstacle sensor in to digital form and display the same on an LCD display.
My problem is that, the IR sensor that I have also gives me digital output. I want to use this output using Atmel AT89S52 microcontroller and display the same on the LCD display. The sensor gives me analogue output from one pin as well as digital output from another pin. The other two pins the sensor has are 5V Vcc and GND.
Please help regarding this as I’m a newbie to the microcontroller world. Thanks in advance.June 1, 2012 at 5:38 pm #7949
I understood that you’ve displayed a value on the lcd screen which is the voltage you are getting from the analog pin of your IR sensor. The same can’t be done with your digital pin, as the digital pin basically have only two voltages, one for logic0 and other for logic1.
I’ve little idea about the sensor you are using, please share the part number or a link to the datasheet.June 1, 2012 at 6:44 pm #7951
Hi, thank you for your interest. The sensor is an Infrared Obstacle detection sensor with four pins, namely: Vcc(5V), GND, Digital out & Analog out. It can detect obstacles up to 30 cm.June 1, 2012 at 8:12 pm #7952
Sorry for my mistake people. I just went through the datasheet got to know that the digital output is of just 1 bit ( a logic 1 or 0) and NOT 1 byte as in the case of analog output.
My project involves measuring the distance of the obstacle, which I was able to do, but not exactly the result that I wanted.
The thing is that reading becomes high as the obstacle gets nearer to the sensor. But I want the opposite to be happening. That is the reading should become 0(zero) when the obstacle is closest to the sensor and almost 255 (since the analog output is 8-bit) when the obstacle out-of-range for the sensor.
Any help in solving this is much appreciated in advance.
The datasheet is at this link:- http://probots.co.in/index.php?main_page=product_info&cPath=9&products_id=9June 2, 2012 at 1:43 pm #7953
Use NOT Gate(74LS04/74HC04) to get your desired result or else simply you can use a transistor(npn).June 2, 2012 at 5:05 pm #7955
You can use a transistor,
Select a npn transistor, BC548
|emitter base collector|
> 10k resistor
|_____ output to mcu’s adc
resistor >= 10k
your Input from
Also you can simulate it in your code, before displaying on the lcd just do it like
255 – value from adc !June 4, 2012 at 2:49 pm #7967June 21, 2012 at 1:44 pm #8102
Thank you guys for your suggestion. Its working fine now, all because of your suggestions.June 21, 2012 at 1:56 pm #8103
You are welcome. Post your qureies & experience further.June 22, 2012 at 1:50 am #8110
You are welcome Mach. If you’ve any further doubts, we are here to help you !
- You must be logged in to reply to this topic.