Introduction: Intro to IR Circuits
IR is a complex piece of technology yet very simple to work with. Unlike LEDs or LASERs, Infrared cannot be seen with the human eye. So in this Instructable, I will demonstrate the basic use of Infrared through 4 different circuits.
The circuits will not use IR receivers or microcontrollers, instead, they will use a photodiode to detect the IR signal because it is more simple.
Step 1: IR LED & Photodiode Basics
The three projects all depend on the IR LED and Photodiode. The IR LED emits infrared radiation in all directions, the photodiode is placed next to it so if an object gets close to it, it will reflect the infrared radiation into the photodiode, the photodiode turns the infrared it absorbed into a signal, the signal then can activate other things. Note the diagram above has a black IR LED and a transparent photodiode, this is not very common as it is usually the other way around, but the following 3 projects use the normal types of IR pairs (IR LED: transparent, Photodiode: Black/dark purple). The colours of the diodes do not matter but just make sure you remember which one is which.
Important things to note (Please read the following):
IR LED: The infrared LED emits IR radiation, we cannot see the radiation because it is a lower frequency than visible light, however, humans can detect infrared as heat (so the IR LED can get a bit hot, that's normal), the radiation is also not harmful.
Photodiode: The photodiode is like an LED but it does not give out light, instead, it is an infrared light sensor (like an LDR but not quite). The photodiode can come in many forms: it usually looks like a black LED but it can also be transparent (in which case don't get it mixed up with other LEDs). The photodiode is connected differently from normal LEDs, instead, Vcc is connected to the cathode rather than the anode of the photodiode.
When purchasing IR LEDs and photodiodes, try to buy them in pairs because sometimes the IR LED does not work with the photodiode.
Step 2: IR Circuit 1
The first IR circuit will just show how the pair (IR LED & Photodiode) works. By using a transistor, we can turn dirty analogue from the photodiode into clean analogue which the output LED likes better. The circuit is very simple, all it needs is:
Resistor: 2x 220ohm (or similar), 1x 10k
Diode: 1x IR LED, 1x Generic LED, 1x Photodiode
Transistor: 1x BC547 (or any equivalent NPN transistor e.g. 2n2222)
A 5v power source (USB is fine), jumper wires and a breadboard.
Step 3: IR Circuit 1 Test
Before you finish the circuit, make sure the IR LED and Photodiode are placed next to each other.
Once the circuit is complete, test the sensor by hovering an object or your finger about 5cm above the two diodes, then slowly move the object/finger towards the diodes till you touch them both. The generic LED should light up more the closer you get, this is because the object is reflecting more infrared into the photodiode.
If this does not happen, check you have put the photodiode in correctly, check your wire connections, check your power source, if none of this help, the problem might have occurred between the IR LED and the photodiode (you should buy new ones or try a different pair).
Make sure you do not run the circuit under the sun or very bright light because that will confuse the photodiode.
Step 4: IR Circuit 2
Now you understand how the IR LED and Photodiode works together as a sensor, we are going to transform the previous circuit into an alarm circuit. This circuit will use an OP Amp to Amplify the photodiodes signal, a buzzer is connected to the output of the OP Amp but that can be modified and replaced with another component/circuit.
This circuit will need:
Resistor: 1x 220 (or similar), 1x 10k
Potentiometer: 1x 10k
Diode: 1x IR LED, 1x Photodiode
IC: 1x LM358
Others: 1x Buzzer or replace it with your own circuit.
5v power supply (USB is fine), Breadboard, jumper wires.
Step 5: IR Circuit 2 Test
Remember the two diodes have to be next to each other as the last circuit. To test the circuit, move an object or your hand above the two diodes, this should trigger the alarm. You can also adjust the sensitivity of the photodiode by turning the potentiometer, there will be a point when the alarm will always be on, this is because the photodiode is so sensitive to IR it detects it from the atmosphere around it. It is not possible for me to show the circuit functioning in the picture above but just imagine you can hear the sound of the buzzer.
Do not operate the circuit under the sun or very bright light because that can confuse the photodiode.
To troubleshoot, repeat step 3.
Step 6: IR Circuit 3
In this circuit, we will activate an LED (or any output) without pressing a button. This time two pairs of IR LEDs and Photodiodes will be used. Instead of using an OP Amplifier, we will use a 555 timer for simplicity. We will also bring back the transistors for smoothing the analogue signal.
This circuit will require:
Resistor: 3x 220ohm, 2x 10k, 2x 1M, 2x 3M
Capacitor: 1x 10nf
Diode: 2x IR LED, 2x Photodiode, 1x generic LED
Transistor: BC547 (or equivalent)
IC Chip: 1x 555 timer
5v power supply (USB is fine), Breadboard, jumper wires
Make sure the two pairs of diodes have distance between them so they won't interfere with each other. Also, make sure you pair the right diodes up.
Step 7: IR Circuit 3 Test
The circuit consists of two pairs of diodes, one turns the output on, the other turns it off. You must first figure out which pair of diodes controls what. Once you do, you can turn the output on by hovering an object over one pair of diodes. The output will stay on even after you have taken your object away from the sensor, the output will only shut off if you hover an object over the other sensor, it will then stay off until you repeat this process.
Again, do not operate under sunlight.
Step 8: IR Circuit 4
For more flexibility in the circuit, a transistor can be used to drive a relay, which in turn can be used to switch much higher power appliances. This circuit works similar to the first circuit, however, uses a light gate instead.
The photodiode will be conducting when the light gate is completed, which means the transistor will be powered off. When the gate is disrupted, the photodiode will no longer be conducting, thus the transistor switches on and so does the relay.
This circuit can operate from 3.3v to 12v depending on what voltage your relay is rated for. However, from my testing, any voltage below 6v is unreliable as some transistors are unable to provide enough current to power the coil of the relay. R1 should be changed to 220 ohms for 5v to 3.3v. Q1 can be any standard NPN transistor such as 2n2222, 2n3904 or BC547. Variations of this circuit might use a diode in parallel with the coil for reverse current protection, but in my opinion, that is excessive as the circuit is not connected to sensitive microcontrollers.
Step 9: More IR Stuff
There is a much bigger world to IR circuits, it's not very complicated but is quite fascinating. Instead of IR LEDs and Photodiodes, better circuits would consist of IR remotes and IR receivers, these devices can cover much more range and can transfer more information as well.
Should there be any questions, please feel free to ask.
Participated in the
1 Person Made This Project!
- TeDv8 made it!
Tip 10 months ago
hi Nawielectron, for cirquit 1 you are using a NPN, you should try to use that on the low side instead of the high side. the diode blocks the current and only allows it through when it receives IR light. the version you posted seems to rely on the voltage and amperage generated when the light hits it, however putting it on the low side also does that, but it also benefits from a higher transistor efficiency and the effect where the diode allows more current to pass, which makes it much more sensitive, in my case it increased the range by more than 3 times.
note: I used a BC337, which is typically a lot less sensitive, so I did not test it with the used transistor.
btw. as a question: how far of a reach did you get with cirquit one?
knowing that would allow me to visualize how much better that one amplifies low power signals, I got around 30cm of range in the schematic how you posted it and around 150cm by placing the transistor on the low side(as in schematic below)
Question 1 year ago on Step 6
Can you explain how Q1 works, please? The circuit shows its collector at a lower potential than its emitter, which doesn't seem correct for an NPN device.
Answer 10 months ago
Hi john_m. this will work in general with a strong enough signal.
the reason is the following:
when IR light shines in the IR receiver diode, the receiver diode will start to generate a voltage in the opposite direction from the direction you would use to make it emit light, it will also generate some current and allow for some current to flow through. in this case you are only using the generated voltage and current which are both quite small, relatively seen. this will turn on the transistor however, at least partly.
it will work and it will make it so that only the voltage and current generated by the IR receiver diode is send to the transistor, and that any leaking current if the diode wasn't completely good wouldn't trigger it.
but you are right, I noticed the same problem, and with a decent IR receiver there shouldn't really be noticible leakage since it is a diode(this isn't 1874 anymore if I'm right, technically speaking according to a chronological structure).
So we can asume the diode to block the current and voltage if there is no light onit, meaning we can safely use the NPN transistor on the low(-) side where it typically belongs. and using it like that would make it much more efficient than the cirquit shown in the instructable.
when I made it I used it on the low side <-see schematic of how I build it.
I am rather positive this is how you wanted to build it, and it will work like this. In my case I had around 3 times as much reach on the low side(like the picture I added) then when I build and tested it on the high side such as it is in the instructable Q1.
However I used a BC337, which according to the datasheets is a lot less sensitive to low power signals then the BC547. I got 1,5Meter range with the NPN at the low (-) side and +-0,3Meter with it on the high side. the BC547 should typically give better results, however you have to test it yourself, because using the transistor on the - side makes it much more sensitive, eventually however it might become that sensitive that it triggers on the ambient IR in your room(unlikely but possible), if so you can first try to adjust the resistor to slightly alter sensitivity, or to add a small resistor behind the transistor as well. if it really is much to sensitive and won't go of you can build it like in the instructable.
but in simple words
The receiver generates voltage and some current, so the transistor gets 5V+ the generated voltage which makes it work.
using the npn transistor on the low side where it normally is makes it a lot more sensitive however, since it uses the same principles as the Q1, but it also uses the effect where it increases the capability of passing current which amplifies it, so it is normally better to use the NPN on the low side indeed, only when that gives problems for example when using leaking diodes like they used to around 1900 then it is better to put it on the high side to not get triggered by the leaking.
some transistors also have a voltage drop in them and when of a huge one typically, relying on that would also still somehow work, but it isn't as good.
1 year ago on Step 1
Step 1 would be less confusing if you redo the third and fourth photos so that the red lines indicate that the clear device is the transmitter and the "black" device is the receiver. Then you can remove the sentence about the components in the photos not conforming to the usual standard.
3 years ago
Perhaps correct the schematic is step 4
Further, I might be wrong, but I think that what you are using are phototransistors, not photodiodes.
Have a nice day :)
Reply 1 year ago
The hobbyist kits commonly available use IR LEDs (the devices in the clear package) and photodiodes (the devices in the "black" package). You might have phototransistors instead but the article is unaffected by that.
2 years ago
The connections for +V and -V are incorrect. +V is on pin 8 and -V is on pin 4. I wondered why the LM358 was getting hot.