Recently, we have been asked several times about driver circuits for IR LEDs, particularly with good range and coverage. Most of us start off driving infrared leds directly from an Arduino or other MCU using a basic resistor in series with the LED connected to a digital output pin of the MCU.
The next step is to progress to a circuit being driven by an NPN transistor, which is more than adequate for >90% of hobbyists. But what if you need that extra bit of range and quality from your Infrared signal?
Here we show a constant current circuit for driving one or two IR LEDS from a circuit supplied with 5V.
We have presented two almost identical circuits above with the only difference being that the one on the left is driving 2 x IR LEDs and the one on the right is driving just one. It is important to note that because the current is constant [ I(R1) ~= I(R4) ] you get (almost) twice the IR radiance from the circuit on the left for the equivalent amount of power – nice. Of course you must use a second IR LED. Before reading on please see the Caveat at the bottom of this post.
So let us try to explain the magic. The key to the constant current through R1/R4 is to keep the voltage Ve constant. This is achieved with the help of the diode pairs (D1/D2 or D3/D4). When a modulated IR signal is applied to the circuit the voltage at Vb is either 0V or the sum of the forward voltage for the diode pair (provided sufficient current is flowing through R3).
So let’s say the forward voltage of the diode is 0.6V then Vb will be 1.2V. It follows then that once the NPN transistor is activated that Ve will be determined by the formula Ve=Vb-Vbe. So if Vbe is 0.7V then in our ideal case Ve will be 0.5V. In fact it will be oscillating between 0V and 0.5V because of the modulation. Next we look at R1/R4, which at 2.5ohms means that the current going through the resistor will be 0.5/2.5 = 0.2A or 200 mA. This is of course at the peak of the square wave and the average current @ 50% duty cycle will be 100mA.
Great that it is so simple in theory, but in an actual circuit you will see some variations with different components, temperature etc. So here are the real world results we obtained this week on a solder-less breadboard:
- R1,R4 – 2.5 ohm (actually 4 x 10 ohms in parallel)
- D1-4 – IN4148 ‘fast switching diode’
- IR LED 1-3, we used TSAL6100 from Vishay
- R3 3.3 kOhms (actually 3×10 kOhms in parallel)
- TR1-2 C33716 NPN transistor
- We also used an Arduino to generate a simulated modulated IR signal. This was a simple sketch to toggle the output pin every 13 microseconds to give a modulation frequency of circa 37 kHz. Having a consistent modulated signal of exactly 50% duty cycle made it easier to test and measure with.
- We measured Vb to be 1.2V
- We measured Ve to be 0.32V (0.311V in the Oscilloscope image at the top of this post)
- Thus the resulting current passing through R4 is 128mA or an average of 64mA.
- We also tried with just one IR LED as in the circuit above on the right and found that we got slightly higher current through R1. Ve was 0.34V thus resulting in a current through R1 of 136mA. (This is also the current going through the single IR LED vs the 128mA going through 2 LEDs above)
So there it is – a simple way to implement a constant current circuit for infrared LEDs.
I hear you say, but what if I don’t have the same components as in your circuit. Don’t worry – here are some tips for selecting alternatives:
- Diodes – as long as you get Vb to be around 1.2-1.5V it should be fine. Try to get a diode with a fast switching time for a better quality IR signal. We also tried with IN4001 rectifiers and although they worked the quality of the square wave signal was not as good. The switching time for the IN4148 is 4 nano-seconds which is why it is called a ‘fast switching diode’.
- Zener diodes – You could also use a single zener diode instead of the 2 diodes above. However, make sure you go through the process of checking the voltage achieved at Vb and Ve and size all the resistors accordingly. Also, make sure you are using the zener in the correct orientation (which is opposite) and that the voltage is not too large. (Some zeners are 12V, 30V or more and will not work. I would suggest up to 1.5V, if possible.
- R1,R4 – start off with 10 or 20 ohms and measure the voltage at Ve. This will give you an idea of how your circuit is performing. Remember that if you are measuring with a multi-meter you are measuring the average current, not the peak. Also, if you are using libraries such as IRremote or IRLib the default duty cycle is 33% not 50%. Once you know Ve you can adjust the resistors to match the current you want.
- IR LEDs – Any IR LED with a wavelength of 940nm will do. Remember, to size the resistors R1/R4 to limit the current flowing to within the specification of whatever LED you choose.
- TR1,TR2 – we just chose one out of the box and it worked so most common NPN transistors should work. But remember to check that it can take the current you are putting through R1,R4.
- Power supply – We ran this off the USB power from the PC with an Arduino also connected. The actual supply voltage was below 5V. To run this circuit on 3.3V you will only get one IR LED working and may have to adjust R3 to get the transistor to activate.
The second part of the questions we get are as much to do with coverage within an area as range. Sometimes people want a circuit to point in 4 or more directions to flood the room with IR so that every device receives the signal. There are several devices available commercially targeted at solving this and they are not cheap. One simple solution using the 2 LED circuit above would be to use LEDs with different ‘beam’ angles. For example the Vishay LED above has an ‘angle of half intensity’ of 10 degrees, thus resulting in 20 degrees of coverage at 50% power or more. The TSAL6200 has an equivalent coverage of 34 degrees and the TSAL6400 has an equivalent coverage of 50 degrees. So combining two of these three LEDs will give a different coverage area for your devices and all for the same power usage as just a single LED.
If you want to study constant current IR LED circuits in more detail, please review the following publication from 1999 (copyright Sharp)
Sharp IR LED Circuits (Size: 361k)
If you have general comments about the circuit, would like to suggest improvements or would like some advice on troubleshooting your own circuit then reply to the post we have opened in the IRforum. Code for the sample sketch used for the circuit above is provided in the IRforum.
See also: AnalysIR integrated support for USB IR Toy
Caveat: Do not use any of the information above in situations where injury or damage to property could occur. Please ensure you have independently verified the correctness of any project you undertake and do not rely on the accuracy of any information provided herein. All of the information above is provided as-is and without warranty or liability of any kind.
9 thoughts on “Constant current infrared LED emitter circuit”
Thanks for this awesome write-up! It made building the circuit and hooking it up to my raspberry pi a breeze.
Glad to be of help 🙂
Anyone know how those commericial ir blasters work
? The ones with a 3.5mm jack on one side that goes to a pc/smartphone, and then on the other side a small plastic enclosure containing the led(s)*.
Because from what I’ve seen, the only way to generate the carrier frequency of 38khz found on most remotes, using a standard audio jack, is to have 2 leds back to back as the emitter. . yet I don’t see those tiny enclosures having 2 leds. Do they perhaps generate the higher frequencies using a microprocessor that runs off the microcurrent from the audio jack?
To generate a remote control IR signal, you usually need something like a microcontroller to generate what is called the modulation signal.
The tiny IR blaster you refer to is just an enclosed IR LED emitter on a long wire with a jack on the end. Inside the box they plug into is a micrcontroller that generates the modulated IR signal.
I have also come across solutions where people connnect 2 IR LEDs in opposite directions to an audio port of a PC or smartphone and send tones to the audio port to effectively emulate the 36/38/40 kHz modulation frequency. To achieve the same effect with the sensor you linked to, you would just have to have use two of these sensors and cut the wiring, join them up to a new ‘stereo’ jack – to get the same result. Remember you will may need to use a stereo jack (ve the mono in sensor in your link). Knowing which wire to connect to which & how to generate the tone is key knowledge for a project like that.
My suggestion would be to stick to standard approaches to avoid causing damage to your phone/pc (unless you have good electronics expertise). Otherwise just buy an off the shelf solution. If you know a thing or two about electronics then google for “IR via audio port” – there are loads of tutorials via Google & Youtube.
I’m very interested in the Sharp document from 1999, but the link above just leads back to this same blog posting. Is there something wrong with the link?
Thanks for the ‘heads up’….Should be fixed now.
You must log in to post a comment.