A tutorial on How to make an InfraRed (IR) proximity sensor circuit along with detailed explanation on how the circuit works. The sensitivity or Range of detection can also be controlled by adjusting the potentiometer. Watch the video above for detailed step by step instructions on how to build this circuit. Explanation of how the circuit works is also included in the video.
[Schematic for this IR proximity sensor circuit is at the end of this article]
- LM 358 IC
- 1 InfraRed LED PhotoDiode pair
- Resistors: 2 x 270R, 10K
- Potentiometer: 10K
- Power Supply: (3-12)V
- Few Breadboard connectors
Explanation of Circuit’s Working:
[Watch the video at the beginning of this post for better visual understanding]
The sensing component in this circuit is IR photo-diode. More the amount of InfraRed light falling on the IR photodiode, more is the current flowing through it. (Energy from IR waves is absorbed by electrons at p-n junction of IR photodiode, which causes current to flow)
This current when flows through the 10k resistor, causes potential difference (voltage) to develop. The magnitude of this voltage is given by Ohm’s law, V=IR. As the value of resistor is constant, the voltage across the resistor is directly proportional to the magnitude of current flowing, which in turn is directly proportional to the amount of Infra-Red waves incident on the IR photodiode.
So, when any object is brought nearer to the IR LED, Photo-Diode pair, the amount of IR rays from IR LED which reflects and falls on the IR photodiode increases and therefore voltage at the resistor increases (from the deduction in previous para).
We compare this voltage change (nearer the object, more is the voltage at 10K resistor / IR photodiode) with a fixed reference voltage (Created using a potentiometer).
Here, LM358 IC (A comparator/OpAmp) is used for comparing the sensor and reference voltages. The positive terminal of photodiode (This is the point where the voltage changes proportion to object distance) is connected to non-inverting input of OpAmp and the reference voltage is connected to inverting input of OpAmp.
The OpAmp functions in a way that whenever the voltage at non-inverting input is more than the voltage at inverting input, the output turns ON.
When no object is near the IR proximity sensor, we need LED to be turned off. So we adjust the potentiometer so as to make the voltage at inverting input more than non-inverting.
When any object approaches the IR proximity sensor, the voltage at photodiode increases and at some point the voltage at non-inverting input becomes more than inverting input, which causes OpAmp to turn on the LED.
In the same manner, when the object moves farther from the IR proximity sensor, the voltage at non-inverting input reduces and at some point becomes less than inverting input, which causes OpAmp to turn off the LED.
[Note: For supply voltage of 9V or more, use 1K resistor for LED and 470R for InfraRed(IR) LED.]
- Double-check all connections by referring to the circuit diagram.
- Check if the LED’s are working properly. (Digital cameras can detect InfraRed light, so you can check if the InfraRed LED is working by using any digital camera)
- The IR photo-diode used in this video is white and the IR LED is black. But it can also be the other way in your case. You can determine which one is LED/Photo-diode by connecting both the diode, photo-diode pair seperately to the power supply (via a 220 resistor) and see which one glows using a digital camera.
- At one extreme position of the potentiometer’s knob, the LED should be off and at the other extreme position, the LED should be on. Now you can start turning the potentiometer’s knob form the extreme position where the LED is on, until the LED just turns off. Now the IR proximity sensor should work properly.
- If the above steps doesn’t help, feel free to post the problem in this project’s youtube page: https://www.youtube.com/watch?v=qEMtCKfZOHw
If you have any queries/suggestions, feel free to post them in the comments section of this video: IR (InfraRed) proximity sensor / Obstacle detector circuit using LM358 opamp