Infrared proximity detection: Am I doing something wrong? - Page 1
Forum section: electronics / beginners

author: kicken
author_rank: Contributor
timestamp: January 31, 2017, 12:47:35 am
content: I recently ordered some IR LEDs and Phototransistors to start messing around with some proximity detection. I feel like I must be doing something wrong though as I can't seem to get a range of more than a few inches.I did some searching online for circuits and the simplest ones I found seemed to be something like this:I wired the above up on a breadboard and gave it a try. It seems to work ok, the LED is on normally and dims/turns off if I put my hand over the board. I just have to have my hand within a few inches to see any noticeable change in the LED. I tried putting more power to the IR LED but it seems to make little difference and I'm already over-driving it as is (for continuous current). I've seen in some various datasheets that one can drive the IR LEDs at up to an amp so long as it's for only a very short pulse. I haven't tried this yet.I did some rough measurements and it seems the LED can be seen to start dimming at about 4.75 to 5 inches above and turns off completely at about 2.75-3 inches above. Is this kind of range normal or am I doing something wrong that's limiting the range?These are the parts I bought to experiment with:ASDL-4262-C22 IR Emitter,WP3DP3BT Phototransistor. Basically just the cheapest thing I could find on mouser.

author: artag
author_rank: Super Contributor
timestamp: January 31, 2017, 01:03:24 am
content: Without lenses, the IR radiation quickly spreads out and is lost. And you will find that the phototransistor is not just sensitive to IR but to visible light, and that there are sources of IR other than your LED. As a result, it's not long before your circuit can't distinguish between 'your' IR and all the other sources.4-5 inches is probably quite good without taking any measures to counteract these.You can get a reasonable range (feet) with an IR beambreak sensor, if it has a set of lenses to focus the light. Reflectance sensors will be much more difficult, and the distance measured will vary according to the reflecting object. Practical sensors for measuring distance use different methods.

author: CatalinaWOW
author_rank: Super Contributor
timestamp: January 31, 2017, 03:32:00 am
content: Quote from: artag on January 31, 2017, 01:03:24 amI will second everything above. You can conduct some experiments to give yourself more insight into this. Try your experiment in a fully darkened room. Try it in that darkened room with your LED pointed straight at the sensor. You might also get some interesting results by increasing the value of the load resistor on the light sensing transistor (both in the lighted room and the darkened room).And then a little simple math for some insight. Find the beam angle for your LED. It will likely be a value between 12 and 45 degrees. Use that to calculate the area of the spot at 5 inches or whatever distance you find appropriate. The energy from the LED is spread over that circle, but the transistor only responds to the fraction of the circle it fills (at best, there are some other subtleties here that make it worse), usually less than 1000th. When you reflect the energy off your hand or any other diffuse surface the reflect beam angle is effectively 180 degrees. Even bigger losses on the way back.

author: Benta
author_rank: Super Contributor
timestamp: January 31, 2017, 08:55:21 am
content: Try checking out what Vishay has, they've been through all this thinking already:http://www.vishay.com/optical-sensors/You'll find some good application notes and videos if you sniff around a bit.Cheers.

author: Buriedcode
author_rank: Super Contributor
timestamp: January 31, 2017, 04:16:57 pm
content: To add to further response, 'beam breakers' and proximity detectors often modulate the LED current at a reasonable frequency (36-40kHz for IR remote controls) that is far enough away from other sources such as 50/60/120/140Hz from mains lighting.The detector then has a filter so it attenuates frequencies outside of this - include 'DC' such as sunlight. This means that the detector effectively 'ignores' light sources that aren't within that range of frequencies, and so it can be greatly amplified, making it more sensitive. Strong ambient light can saturate the detector greatly limiting its range - if the ambient light causes the amplifier output to hit its maximum, it 'drowns out' the source from the LED - so one would reduce the amplifier gain, but then that means in low light it has reduced sensitivity.Optical filters are also used to block visible light to help reduce the effect of ambient light, even though incandescent and natural light sources can still contain substantial IR.Whilst it may be a much more complicated circuit, using modulated light greatly improves sensitivity, or in your case, range of proximity detection, allowing the LED current/emitter output to be reduced. It also means the emitter is not constantly on - using low duty, say 20% (LED is on 20% of the time, off 80%) - the average power is reduced to 20%, but one can increase the peak power without harming the LED. This is why IR remotes can produce IR LED peak currents in hundreds of mA greatly increasing range without drawing significant current or requiring higher power emitters with heatsinks.So, there are many techniques that can be used together to improve range, selectivity (immunity to changing ambient light) and reduce power.

author: Messtechniker
author_rank: Frequent Contributor
timestamp: January 31, 2017, 10:16:04 pm
content: Yep. Modulation/demodulation is the way to go here.Done such to detect the spinning wheel of a water meter.Without mod./demod any ambient light changes wouldf***up - sorry - disturb the detection process.Just to give you an idea - see enclosed circuit diagram.Sorry for the mixed English/German content.Yours - Messtechniker

author: Ian.M
author_rank: Super Contributor
timestamp: January 31, 2017, 10:41:41 pm
content: An unfiltered (clear window or package) silicon photodetector will have approximately 80% sensitivity to visible Red light (compared to its peak IR response taken as 100%). Therefore if you are experimenting with the physical layout of optical sensors, you may do a lot better to use a high intensity Red LED as the source so you can actually see its radiation pattern and how the lenses, reflectors etc. are affecting it.Things to remember - the focus of most lenses will vary with frequency so some adjustment may be needed when changing from visible light to IR. Some visibly transparent materials are not transparent to IR, and visa versa. e.g. several types of black plastic are sufficiently IR transparent to be unusable in thin sections as screens to block stray light - if in doubt, use matte black painted metal. A further caution: not all black paints are 'black' to IR.

author: kicken
author_rank: Contributor
timestamp: February 01, 2017, 03:57:43 am
content: Thanks everyone, that is all some great info. That helps explain why some of what I was seeing on mouser seemed so costly/fancy.What got me started on this was seeing someinfrared coffee tableprojects and thinking that might be a neat second project for me to tackle. From the various plans I'd read it seemed like these projects would just pulse some IR leds and sense the reflection. Some used Photodiodes and some used Phototransistors so I got a few of each to experiment with as I'm not sure which would be best. The diodes I got don't seem to work at all but I think that might be due to them not having the right sensitivity range, ordered the wrong stuff I think.If I have time I'll play with modulation / pulsing the IR LEDs, as that is something I'll be needed to do eventually when I attempt the table.

author: CatalinaWOW
author_rank: Super Contributor
timestamp: February 01, 2017, 05:06:03 pm
content: When you play with modulation, note that phototransistors in general have a fairly limited bandwidth. A few hundred kilohertz, with roll off occurring far earlier for many versions.

author: Habropoda
author_rank: Regular Contributor
timestamp: February 01, 2017, 09:31:42 pm
content: The Vishay TSSP58038 can come in handy as a receiver for 38kHZ pulsed infrared. It is a variant of the ubiquitous remote control receiver module but it has a fixed gain that is optimized for proximity/light barrier use. The common remote control receiver has problems in these applications due to a variable gain.https://www.pololu.com/product/2462(3 pack)It's very easy to use and connects directly to a microcontroller/Arduino/Raspberry. Very sensitive and fun to experiment with.