In this post we learn how to make a simple yet useful proximity sensor circuit using a single opamp LM351 and a couple of infrared diodes.
By Navneet Sajwan
A sensor is a device that detects and measures any physical parameter of our environment and converts it into electric signals.
There is a long list of sensors that are available in market today. Some of them are humidity sensor, flex sensor, touch sensor, fingerprint sensor, pressure sensor and many more.
We come across a lot of sensors in our day-to-day life. One such sensor is proximity sensor.
In this post , we are about to unravel how a proximity sensor works and what provide the necessary knowledge to make a proximity sensor at home. As the name suggests , proximity sensor detects whether an object is near or far from it. They can be designed in different ways.
But, the most common method is the one based on INFRARED rays and OPAMP. Some common uses of proximity sensor can be seen in cell phones, automatic flush systems , automatic taps, hand dryers and never-falling robots.
1. IR led: Every led emits some form of electromagnetic radiation when powered up. From our household experience, we have known leds that emit visible light.
But, there are also some special leds that emit infra red rays. Just as there can be visible led of different colours , IR led also emit rays of different wavelengths. Infra Red rays can be of varying wavelengths and can take up any value belonging to their waveband.
So , it is very important that the IR photodiode used must be able to detect the particular wavelength of INFRA RED given out by the IR led.
2. IR PHOTODIODE: It is a special type of diode which is connected in reverse bias for IR rays detection. In the absence of IR radiation , it has a very high resistance and practically zero current passes through it.
But when the IR rays fall on to it ,its resistance decreases and a current proportional to the intensity of the radiation is allowed to pass through it.
This property of photodiode is used to generate an electric signal in proximity sensor on incidence of IR rays.
3. Op-amp (IC LM358): Op-amp or operational amplifier is a multi-purpose ic and is highly revered in the electronics world.
In this project op-amp is used as a comparator. LM358 IC has two op-amps which means we can make two proximity sensors using just one IC. The reason to use op-amp in the circuit is to convert analog signal into digital signal.
4. Preset: Preset is basically a resistor having three terminals.
The function of a preset is to divide the total voltage available in a way that the user can access a fraction of it. We just have to set the middle terminal to an appropriate position.
The preset sets the threshold voltage above which the output voltage should be generated. It can be manually set to resistance of any value by rotating its head using a suitable screwdriver.
5. Red led : I have used a red led for my project but in general led of any colour can be used. It acts as a visual signal to show that the obstacle has come close enough.
6. Resistors: Two 220 ohms and one 10k ohm.
7. Power supply: 5 v to 6v.
How does a proximity sensor work
The principle lying behind the working of a proximity sensor is fairly simple. A typical proximity sensor has two leds parallel to each other – IR emitting led and a photodiode.
They act as a transmitter-receiver pair. When an obstacle comes in front of emitter rays, they are reflected back and intercepted by the receiver.
As per the properties of the photodiode ,the intercepted IR rays decrease the resistance of the photodiode and the resultant electric signal is generated. This signal in practice is the voltage across the 10k resistor which is directly fed to non-inverting end of op-amp.
The function of the op-amp is to compare the two inputs given to it.
The signal from the photodiode is given to the non-inverting pin (pin 3) and the threshold voltage from potentiometer is given to the inverting pin (pin 2).If the voltage at the non-inverting pin is greater than the voltage at the inverting pin the op-amp output is high otherwise the output is low.
All in all, op-amp converts analog signal into digital signal in this circuit.
The sensor output can be used in two forms: ANALOG and DIGITAL.
Digital output is in the form of either high or low.Digital output signal of a proximity sensor can be used to stop the motion of an obstacle-avoiding robot. As soon as, the obstacle comes close enough, signal can be directly fed to the input pins of motor driver to stop the motors.
Analog output is a continuous range of values from zero to some finite value. Such signal cannot be directly given to motor drivers and other switching devices. First they need to be processed by the microcontrollers and converted into digital form through ADC and some coding. This output form requires an additional microcontroller but eliminates the use of op-amp.
Schematic Diagram for the Proximity Sensor