Infrared Sensor (Sharp GP2Y0A02YK0F)-Long Range Infrared Pro
B.ASHISH
Posts: 28
Sir,
The Infrared Sensor produces an output analog voltage.
I want to interface it with the Propeller Microcontroller(Propeller Board used has a Product Number 555-32100.
Propeller IC is P8x32A-044 0739
The Infrared Sensor produces an output analog voltage.
I want to interface it with the Propeller Microcontroller(Propeller Board used has a Product Number 555-32100.
Propeller IC is P8x32A-044 0739
Comments
I want the code in Spin
Generally as a rule of thumb if the signals are analog then it needs to be converted to digital, I say this lightly because there is always another way to skin a cat.
So if the signal is analog use a ADC to convert it to digital.
No code for you...
Cause you need to select a ADC.
There are other objects in the Object Exchange for some other analog to digital converters, but the MCP3202 is very easy to use. It's possible to do analog to digital conversion with the Propeller with only a few passive components, much like the Stamps do it. You'll have to do your own coding though. Look at the discussion on the "app-notes" page here under battery voltage monitoring for some ideas. There is some useful code in the BS2_Functions object to provide the same functionality as the Stamps' RCTIME statement.
http://www.parallax.com/dl/docs/books/edu/wamv2_1.pdf
You can do this on the propeller chip as well using the basic stamp functions.
In one instance I used the sensor output as the control voltage input for the VCO section of a 4046 (CD4046, 74HC4046, etc.) and COUNTed its output. In another, I had the sensor output going to the inputs of a couple of comparators where crossing the threshold of one indicated "near" and the other indicated "closer still".