Introduction: Infra-Red Proximity Sensor Using LM358
This is an instructable about making of an IR Proximity sensor
Step 1: Watch the Video
Before we proceed, I Recommend you to watch the full video first. There you will find full process about making of this simple circuit on a breadboard. Visit my channel 'ElectroMaker' For more details.
Step 2: Have a Look at the Schematic
Step 3: Order the Needed Parts
IC1- Any OP-Amp IC Will work like LM324, LM358, CA3130 etc. (We are using it as a comparator)
R1- 100KΩ Potentiometer/ Variable Resistor
R2- 100Ω - 1KΩ
L1- Infra-Red LED (IR LED)(IR Transmitter)
L2- Infra-Red Receiver(IR Photo-Diode)(IR Sensor)
L3- Normal LED (Any color, Color doesn't really matter)
B1- 6 To 12 Volts DC
Step 4: How This Circuit Works?
Well, Our aim in this circuit is to light up an LED or Buzzer whenever any obstacle comes near to the sensor, so first we have an Infra-Red Photodiode of whose negative terminal is connected to positive rail and it's positive terminal to the negative rail Via a 10KΩ resistor. Whenever infrared light falls on the photodiode, a small amount of current is produced which is very less in magnitude somewhere in Micro-Amps range. Then we need some infrared light, right? So we used a infrared with a current limiting resistor to provide us some infrared light, so what happens is when any obstacle or any object comes near to the infrared light, the infrared light strikes the object or obstacle which is in front of the infrared LED and reflects back to infrared photodiode which then converts it into certain amount of current (in micro-amps range) and as we have an 10KΩ resistor from positive terminal of the photodiode to GND, the small current gets converted into voltage and which is calculated by the ohms law (V= IR) where R Is constant 10KΩ and I which current changes with amount of infared light falling on it. Let's say when the distance b/w IR LED and the obstacle is 2 cm, the current produced by the photodiode is 200 micro-amps (not the exact value, it maybe different) so the voltage will be 0.0002 Amps (200 micro-amps) * 10000Ω (10KΩ) = 2 Volts. The more infrared light will fall higher the current produced by the photodiode and that means higher the voltage at the positive terminal of the photodiode and Vice-Versa. Then we have a Potentiometer/ Variable resistor which acts as a Voltage divider. The formula to calculate Vout= (Rbottom/ Rbottom + Rtop * Vin) so when the potentiometer is more towards the GND (Negative rail) which also means the resistance towards Vcc (Positive rail) is more then that of towards GND, then the voltage at the middle pin of the potentiometer (Vout) will be high and Vice-Versa. That means we can vary our output voltage from 0 to 9 Volts (The maximum is our input voltage itself). Now we have two voltages, one from photodiode and another one from variable resistor (potentiometer) so how can we use this two voltages to trigger an LED? The best way is to compare those two different voltages. And we will do it by using an component called 'Comparator' which is just an op-amp without any feedback attach b/w it's output and non- inverting input (one marked with + sign), it works as a comparator. In simple terms, If the voltage at the non-inverting input (one marked with the +) is higher than the voltage at the inverting input (one marked with -), the output will go high (output positive voltage) and Vice- Versa. So we connect the middle pin of the potentiometer (adjustable output voltage) Inverting input (Pin 2 of the LM358 that we are using) and the positive terminal of the photodiode (voltage depends on infrared light) to non-inverting input (Pin 3) So whenever the voltage at Pin 3 gets higher than the Pin 2, the Pin 1 (output of the comparator) goes high (The output voltage will be your input voltage itself + little voltage loss which is tiny and barely noticeable, and when Pin 2 is higher that Pin3, the output goes Low (0V) Now you know why we call that potentiometer as a sensitivity control. If you have doubt in something, Feel free to ask us in the comment section of our videos.
Step 5: Troubleshooting Guide
If your circuit doesn't work, Follow the steps below. If it doesn't help, Feel free to ask us in comment section of our videos.
1. Check the IC (OP-AMP)(COMPARATOR)
2. Make sure you have connected the pins of comparator the right way
3. Make sure other connections are okay
4. Make sure your Photodiode is okay, Try using another one
5. Make sure your IR LED Is okay by connecting it to any battery along with a 1K OHM Series resistor and seeing it through a digital camera (It looks pinkish in color and is not visible by naked eye)
6. Make sure that your potentiometer is connected the right way
7. If your LED OR BUZZER Blinks or sounds continuously than turn your potentiometer more towards Positive power supply
8. Make sure your power supply is connected the right way, Your circuit may be damaged by exposing it to high voltages or reverse polarities.