Very easy and cheap proximity sensor using IR LEDs
For the latest project I will need some way to control the device without touching it or pressing any buttons. Also, I will need to control the range of some parameters, not just on/off action. I have searched the ideas and schematics which use IR leds and IR receivers but eventually dropped all of them. Some of them are too expensive (I need 4 sensors and buing 4 IR receivers for 3-6$ is too much), some are too bulky, some just give 0/1 instead of a range. Eventually I have found what I want in LM358 op-amp datasheet (imaging that!).
The datasheet has a schematic for photovoltaic cell. I used that schematic w/o any changes, but substituted the cell with IR LED and made R around 4.5 Mohms. The op-amp is LM358.
As you see this is a very simple op-amp inverting amplifier where one resistor is substituted with the LED.
It looks like this on a breadboard:
For the IR emitter I used INF 5940 led with wavelength of 940nm and 35 angle beam which I bough on http://www.futurlec.com/LEDInfrared.shtml. The resistor for the emitter is 220 Ohms (for 9V) which gives me 35mA current (measured).
For the detector I used INFD5940, which is basically the same led, but covered with dark plastic to absorb light better.
Here is the whole thing at work::
As you see everything works like a charm. It reacts to my smallest movements. No noise, no independent voltage changes. Everything is controlled by my hand. It seems to be very stable. With the given sender current the reaction is obtain at about 10cm and I don't need any more. For the test I made the sender work constantly. In this mode I cannot give it more than 50 mA. In the real device it will be pulsed with current up to 250mA which will increase the distance and make the detection quality better.
For one complete detector you will need: 2 leds, 2 resistors, 1 op-amp. Op-amps can be dual and quad, so you can save there a lot of space and money and also decoupling caps.
I used IR leds because I don't want anyone to see how they blink when they work, but apparently the whole thing should work with visible light leds and ultraviolet too. Interesting that the detector reacts to a IR remote pointed at it very close. I doubt that the IR remote also has 940nm IR LED. The generated voltage in this case is LESS than when I have a hand above the device.
Then I made some measurement to determine how linear it performs. I used a piece of white paper and multimeter.
The obtained data:
The resulting graph:
I not willing to waste too much time on figuring out the formula for the data. I would be glad if someone could find it. However, I doubt that it will be useful, because most likely it will be too complicate to use in low power MCUs. So, I will increase current and use the steeper part of the graph with linear approximation (or even without it if it is very steep).
2011-03-04 17:24:02 elevator4 (Alba, Italy)
looks like a nice exponential, as it should.
According to excel, the equation to your data (y=voltage, x=distance) is y = 2.9174 * e^-0.6236x
To the IR LED, their sensitivity is very low, that's why you need such a high value in the feedback.
A cheap photodiode is BPW34 by osram, fairchild and others. It comes with optional daylight filter.
Have a good time,
2011-03-30 19:05:07 Dave (UK, UK)
Hi, great work! Do you have a full schematic for the project as I too need to use a few of these but don't want to pay lots of money for the receivers, this approach is perfect for what I'm doing.
2011-05-02 18:22:10 Artem Kuchin (Moscow, Russia)
The scematics is at the top and the photo shows it all.
2011-08-22 22:48:34 Rick ()
Hi, how about ambient light? Doesn't sunlight affect the circuit?
2011-11-10 17:54:55 Artem Kuchin (Moscow, Russia)
In direct sunlight it will have problems, but usual indoor level of light does not affect it much. It is IR after all, so, only IR sources can interfere. The most powerful IR source is the SUN, incandescent lamps do not do any harm to the sensor.
2012-03-16 06:56:17 Stoph (Adelaide, Australia)
This project is so close to being what I actually need. Allow me to explain my intentions - I hope I make sense and this is something you could assist me in.
I am looking at adding some added functionality to a Nerf blaster (the Stampede) that uses a motor to prime a spring in order to fire. I want the system to do two things:
1. Give an accurate readout of actual darts in the magazine via a 7-segment display
2. Once the magazine is empty, a killswitch is activated, stopping the firing cycle and preserving the internals from undue wear
I don't know much about electronic engineering, but I'm a keen learner, and hoping to wrap my head around it.
A single dart's height is approximately 12-14mm, depending on the foam used. If you had 1 dart's height equal to a voltage range (around 0.8-1.2), would it be possible to have those ranges represented by 1,2,3, etc, on a simple up/down counter?. Say for instance I have a 6-dart magazine; the hopper beneath the darts would be the point of reference for the sensor, as half of its area would not be obscured by shorter darts, thus creating a cavity that the sensor can take a reading from.
As I fire the darts, the voltage would approach it's maximum reading (2.73v). At this point, the up/down counter would read zero, and a switch would be tripped in order to break the circuit between the motor and the power source.
Does this make sense? If so, how possible would it be?
Thanks in advance!
2012-09-17 20:23:54 shubham (mumbai, india)
hey ,can you tell how did you made the the interface b/w the cicuit and the computer.??
2013-06-25 18:59:48 Fle,Fred,Ann (Nairobi, Kenya)
Hey...we have really liked your project. It has been of great help to us.
If you use any information from this site you MUST put a direct link to this site!
Author can deny free usage of any material to anyone without explanation.
All information on this site is protected by international and national copyright laws.