Please help with IR Source and Sensor Interfacing
djh82uk
Posts: 193
Hi Guys
I need to sense when something passes over the soure + sensor, But I cannot figure out how to interface them, I presume I need Pull-up Resisitors, but don't know which ones.
Here are the datasheets
Source
http://www.rapidonline.com/netalogue/specs/58-0100.pdf
Sensor
http://www.rapidonline.com/netalogue/specs/58-0100.pdf
Also isn't the 3.3volts coming out of the prop going to be too much? Do I also need a resistor fromt he prop leg to the source for instance?
I have tried reading up on it, but have found very little of use.
Please can someone advise.
I need to sense when something passes over the soure + sensor, But I cannot figure out how to interface them, I presume I need Pull-up Resisitors, but don't know which ones.
Here are the datasheets
Source
http://www.rapidonline.com/netalogue/specs/58-0100.pdf
Sensor
http://www.rapidonline.com/netalogue/specs/58-0100.pdf
Also isn't the 3.3volts coming out of the prop going to be too much? Do I also need a resistor fromt he prop leg to the source for instance?
I have tried reading up on it, but have found very little of use.
Please can someone advise.
Comments
If you look at the datasheet you posted, the forward voltage is about 1.3V at 10ma. This is a typical current for an LED and is within the capabilities of most microcontroller I/O pins (like the Propeller and the Stamps). The resistor has to "drop" 3.0V - 1.3V = 1.7V since the Propeller's I/O pins will produce about 3.0V with a 3.3V supply voltage. Ohm's law gives R = E / I = 1.7V / 10ma = 170 ohms. The closest standard value is 180 ohms. Typically, you connect one end of the resistor to +3.3V and the other end to the anode of the LED. The cathode of the LED you connect to the I/O pin. You set the I/O pin to a logic low (zero) to turn the LED on. You set the I/O pin to logic high (one) or to a high impedance (input mode) to turn the LED off. It's done this way usually because I/O pins are often asymmetric ... they have a little higher current capacity on the low side than the high side. The Propeller I/O pins are pretty symmetric as these things go.
You didn't give a link for the sensor, but it's probably a phototransistor. You usually connect the emitter to ground and a pullup resistor from the collector to +3.3V. The I/O pin is connected to the collector and becomes a logic high when there's no IR detected and a logic low when IR is present. A typical resistor value is 3.3K to 10K. The datasheet will give some idea of the optimal range of current and you use Ohm's law to figure out the necessary resistor value.
By my understanding the sensor is looking for around 1.5V? Would that not just be the same value resistor again?
Could someone just check the datasheet for me so I don't blow this thing?
Thanks again mike
DJH
The sensor (probably a phototransistor) conducts a certain amount of current depending on the amount of light it "sees". You want to choose the resistor value to: 1) Not waste too much current that you don't need. 2) Limit the current to something that the phototransistor will conduct with the expected light level. Something between 300ua and 1ma should work. When the phototransistor is fully "on", the voltage across it should be around 0.3V (saturation voltage). Ohm's law again gives R = E / I = 3.0V / 300ua-1ma = roughly 3.3K to 10K.
Im stupid
Heres the link.
http://www.rapidonline.com/netalogue/specs/58-0105.pdf
does that shed any extra light?
Thanks
DJH
More importantly, what are you trying to do with this thing? If you're trying to do short range (a few cm to maybe 1/2m) on-off sensing without a lot of ambient light, these will work fine. If you want to do longer distances or there's a lot of varying ambient light, you probably want to use modulated IR and you'd want to use a different sensor that detects this. Parallax and others sell these detectors for IR distance sensing and there's a lot of existing code examples for the Propeller and the Stamps. See Robotics with the Boe-Bot (www.parallax.com/dl/docs/books/edu/Roboticsv2_2.pdf) chapters 7 and 8.
Distance will be about 2-3CM max, it's for my train speed detector. Would it maybe better to have the sensor read as analogue? and then just trigger it at a preset level? Would that help cut out false positives if the preset level was quite high?
DJh
It sounds like you want to use the sensors in reflective mode sensing the the light reflected back from the train, as Mike said ambient light may be a problem as it will come straight down and hit the photo transistor.
Why not try one of these:
http://www.rapidonline.com/netalogue/specs/58-0938.pdf
it combines the emitter and photo transistor and the plastic cuts out visible light.
Take a look at the graphs for current vs card distance and then look at the tests themselves.
Graham
I actually have a few of those lying around, I have both the darlington and non darlington versions
Which would be best?
Same interface circuit as mike described?
I read the datasheet this morning, read that they were for cassete tape readers etc and instantly disregarded it, ignorance on my part I think
Regards
DJH
i need to sets of source/sensor so would like to try the darlington version I think for now.
just need to know if it would be the same type of interfacing circuit (assume it would)
DJH
Same circuit. If I was you I'd read the basics on transistors, its not complicated and you will then understand what you are doing better.
Cheers,
Graham
I used my digi camera to make sure the transmitters were working, then played with the sensors, and they can sense my hand at a range of about an inch or so, plus that was in direct sunlight too [noparse]:)[/noparse]
i have it just outputting o's and ones on screen very fast at the moment, but if I run my hand over it, looks like something out of the matrix, still im very happy and very gratefull for your help.
I now just need to play around with the resistor values as i did not have many here, so had to make do with 220R and 3.3k
Thanks [noparse]:)[/noparse]
DJH