IR emitter circuit design
Moderators: adafruit_support_bill, adafruit

IR emitter circuit design

by cyborg5 on Thu Dec 13, 2012 4:42 pm

I'm not sure if this question belongs here or in your "Ask an Engineer" section but since it is somewhat related to this device I'm going to post it here.

I've built two or three Arduino-based gadgets that emit IR remote control signals but I've never really been confident that my driver circuit was giving me optimal results. I know nothing about circuit design except a rudimentary understanding of Ohm's law with almost no experience knowing how to apply the damn thing :-)

What I'm saying is I'm a total noob. My background is programming not electronics.

I've tried googling websites for transistor circuit design, LED driver circuit design, and a variety of other things and they are all over my head even though they seem to be pretty simple. One website directs me to the design page of the TV B-Gone gadget here
http://www.ladyada.net/make/tvbgone/design.html

I think I burned up the transistor the first time I tried that single transistor driver circuit. Even an idiot like me should have realized the TV b-gone runs off of 3 V and I'm using 5 V. Then again I could've hooked it up wrong on the breadboard. This schematic for the single transistor version says use a 120 ohm resistor. I picked a bigger value (400 or 500 or so I forget). The gadget works but the range and directional angle seems to be limited.

What I thought I would try to do was emulate the more advanced version of TV B-Gone that uses multiple LEDs and transistors. Ultimately here is what I would like… I want two IR LEDs. One of them to be the wide-angle, the other to be the narrow angle. I went essentially half of what the latest TV B-Gone has. I've got a pack of PN2222 NPN transistors that I bought from here. I think I bought my IR LED RadioShack number 276-143 or I might of purchase one from here. I have no idea if it's the narrow angle or wide-angle version. You guys say that the IR LEDs that you sell are the ones that you use in this kit and that they are the 20° angle versions. But you don't appear to sell the other version that the TV B-Gone kit uses. I don't know what they angle is on the RadioShack version.

So finally I get the point of my message here…
1) If I'm using the single transistor driver circuit on a 5 V system like Arduino, what value should the resistor be between the pin of the Arduino and the transistor?
2) If I decide to use two transistors to drive two IR LEDs, can a single output pin from an Arduino drive two transistors and what value should the resistors be?
3) if an Arduino cannot drive two transistors and I decide to add a PNP driver to the drivers (sort of a one half TV b-gone circuit) is the value for R1 which you show as 1.0 K still correct even though I'm only driving two NPN transistors instead of four? And more important keep in mind I'm working on 5 V instead of 3 V. And do I need the optional R2 10K resistor under this circumstance? If so what should its value be in a 5 V circuit?
4) Just a comment… Why don't you sell both types of IR LEDs the wide-angle and the narrow angle?

I know the questions I'm asking are somewhat above and beyond the call of duty for a support forum. It's not you guys job to design my secrets for me. But this seems to be the kind of thing someone around here would know off the top of their head or can spend 30 seconds doing some math and could answer for me.
cyborg5
 
Posts: 47
Joined: Tue Apr 24, 2012 3:13 pm

Re: IR emitter circuit design

by Sea Moss on Thu Dec 13, 2012 6:48 pm

Just copy the TV be-gone circuit, from pin 5 of the IC through the PNP transistor out to your two LED drivers Q1 and Q2. R2 is not needed. R1 stays at 1k. Q5 can be a 2907 as shown or a 3906. Q1 and Q2 can be 2222's or BC337's. Obviously you must take care to connect the transistors the right way around. Since you are a programmer you can look into that side of things for yourself. Note that to switch the LEDs on, you pull the output pin LOW. If you thought that Low was off it would result in overheating your output transistors and LEDs and could fry them. We can get away with running large currents through the output stage(s) for short times, or low duty cycles, but not continuously.
Sea Moss
 
Posts: 8
Joined: Thu Dec 13, 2012 6:33 pm

Re: IR emitter circuit design

by cyborg5 on Fri Dec 14, 2012 1:10 pm

Many thanks for the reply. Just to make sure I'm understanding correctly… The fact that I'm only driving two LEDs with two transistors rather than four doesn't change anything? And the fact that TV b-gone runs at 3 V instead of 5 V on the Arduino also does not change anything? Similarly if I use a single NPN and a single LED as in the earlier versions of TV b-gone then the 120 ohm resistor is still correct despite the 3 V versus 5 V differences in my application?
cyborg5
 
Posts: 47
Joined: Tue Apr 24, 2012 3:13 pm

Re: IR emitter circuit design

by john444 on Fri Dec 14, 2012 1:58 pm

Hi Cyborg,

cyborg5 wrote:1) If I'm using the single transistor driver circuit on a 5 V system like Arduino, what value should the resistor be between the pin of the Arduino and the transistor?

It depends. In order to fully turn-on the transistor, you need to know the gain and the current through it.
If you want to drive the IR-LED with 100-mA and you use a 2N2222 (gain about 100) then you need at least 1-mA.
At 5-V & 1-mA = 5-K. Since the Arduino can safely supply much more than 1-mA then use say 1-K for the base resistor.

cyborg5 wrote:2) If I decide to use two transistors to drive two IR LEDs, can a single output pin from an Arduino drive two transistors and what value should the resistors be?
Yes. Although, you probably want to limit the current from the Arduino to about 5-mA. In this case, use a 2-K resistor to each 2N2222's base.

cyborg5 wrote:3)
Sorry, I do not understand what you are asking.

cyborg5 wrote:Why don't you sell both types of IR LEDs the wide-angle and the narrow angle?
Pure speculation on my part - Wide-angle LEDs will have very little range.

You might check out the Adafruit "Circuit Playground" for calculating the series resistor for IR-LEDs.
The IR-remote tutorial may give you some insight into why you can drive 1-A through an IR-LED that can only handle 0.1-A continuously.

Good Luck, John
john444
 
Posts: 443
Joined: Sun Mar 04, 2012 1:42 pm
Location: Claremore, Ok

Re: IR emitter circuit design

by Sea Moss on Sat Dec 15, 2012 1:12 am

Dear Cyborg,
 
Using a two-stage driver (PNP then one or more NPNs, as in TVbG v1.2, OR NPN then one or more PNPs) ensures that the gain will be sufficient to fully turn on or saturate the transistor(s) that is (are) actually letting current flow through the LED. Therefore I recommend that approach, and that is why my original answer is valid under the full range of conditions you specified.
 
If you want to use a single transistor (or multiple transistors) connected directly to your output pin, either NPN or PNP will do. In that case, as John says, you need to make sure that you have enough current flowing into the base. I would say that a 2k base resistor is too big. Bear in mind that quoted current gains (hFE on a datasheet) are generally given at rather low currents. The gain drops off as the transistor approaches its rated collector current. Therefore if you want to do this I would suggest limiting yourself to one LED and using a base resistor of 470 ohms. This corresponds to a current out of (NPN) or into (PNP) the pin of ~5mA at Vcc=3V and ~8mA at Vcc=5V. It is no problem at all to draw this kind of current from an AVR output pin (in fact you might want to use a 330ohm resistor).
 
Remember that the required polarity of your output signal depends on whether the first transistor "seen" by the output pin is PNP or NPN. The last thing you want to do with no current limiting resistor in series with the LED and output transistor is to accidentally turn it on for more than a fraction of a second.
Sea Moss
 
Posts: 8
Joined: Thu Dec 13, 2012 6:33 pm

Re: IR emitter circuit design

by gee on Wed Dec 19, 2012 12:00 pm

To throw a different circuit out there, here's what I'm using in the "overengineered TV-B-Gone". Ignore the part #'s and values - the regulating transistor (lower left) is a MMBT4401LT1, the output transistor (upper right) is a FCX690B, and the "LED_EN" resistor is 2.2K.

Image

The 6.8 ohm resistor and Vbe of the regulating transistor set the output current - when the voltage across the 6.8 ohm resistor exceeds 0.7V, the lower transistor turns on and pulls current away from the base of the output transistor, regulating its output current. In this case, the output current is 0.7/6.8 = ~100mA. The 1K resistor has to be a low enough value so the current through it is greater than the base current of the output transistor, which is output current divided by output transistor Hfe.

In my case, output transistor HFe is 400, meaning a 250uA base current at 100mA output. The base of the output transistor is typically at 1.4V, and my minimum voltage is 2.7V - so (2.7V-1.4V)/250uA = 5.2K maximum. I'm using 2.2K.

I used this circuit because my supply voltage (LiPo cell) varies from 4.2 to 2.7V, and I wanted constant current over that whole range.
gee
 
Posts: 11
Joined: Fri May 22, 2009 9:21 am

Re: IR emitter circuit design

by Sea Moss on Fri Dec 28, 2012 3:59 pm

Nice circuit. Your LEDs are rated for 100mA continuous/1A peak, though, so I think you can get away with a much higher current limit.
Sea Moss
 
Posts: 8
Joined: Thu Dec 13, 2012 6:33 pm

Re: IR emitter circuit design

by cyborg5 on Tue Jan 15, 2013 2:07 pm

I'm just now getting back to this project after the holidays. I just want to confirm that it is okay to substitute NPN as the first stage and PNP as the multiple second stages so that a high signal on input turns the LEDs on. Can I make that substitution with no other hardware changes as long as the software sends the right signal?

While it might seem a trivial matter to change the software and use the original circuit, I need this software library to work on a variety of gadgets that I'm building some of which use a single NPN transistor with a single LED and some use the two-stage version. I don't want to accidentally upload the wrong software to the wrong gadget and burn out everything. So I need to make all the hardware compatible.
cyborg5
 
Posts: 47
Joined: Tue Apr 24, 2012 3:13 pm

Re: IR emitter circuit design

by Sea Moss on Fri Jan 18, 2013 10:37 pm

I assume we are again discussing variations on the original circuit and not the alternative current-limited output stage posted by @gee.

If that is the case then yes, you are correct: it doesn't matter what polarity you use provided the software is modified accordingly.

Have a good look at main.c to make sure you catch any possible issues. On that occurs to me is that after a pulse is sent, and possibly just before the device goes to sleep, there PWM output pin is manually set high (=OFF for the PNP trans it connects to). This is in case the PWM'ing left it in a low (ON) state. So just be careful to correct that. Also a few of the codes do not use PWM - they just toggle the output with PORT commands (you will see how that works when you look at the code). The direction of that toggling will need to be reversed.

Have fun and post a pic of your finished device!
Sea Moss
 
Posts: 8
Joined: Thu Dec 13, 2012 6:33 pm

Re: IR emitter circuit design

by cyborg5 on Fri Feb 22, 2013 2:43 pm

I want to thank everyone again who has helped me design this circuit which is basically just a ripoff of the output stage of the TV-B-Gone with the PNP and NPN transistors swapped. Attached is my Eagle CAD drawing of my circuit. I would appreciate someone looking at it briefly and just see if I haven't made some stupid mistake. By the way VCC is +5 V and this is a 5 V Arduino Uno or Leonardo.
Attachments
IRx4_output.gif
IRx4_output.gif (6.33 KiB) Viewed 3721 times
cyborg5
 
Posts: 47
Joined: Tue Apr 24, 2012 3:13 pm

Re: IR emitter circuit design

by gee on Fri Feb 22, 2013 8:30 pm

Keep T2-T5 and the infrared LEDs the same. Connect the emitter of T1 to ground, and the collector of T1 to the bases of T2-T5.
gee
 
Posts: 11
Joined: Fri May 22, 2009 9:21 am

Re: IR emitter circuit design

by cyborg5 on Sat Feb 23, 2013 1:21 pm

Like this?
Attachments
IRx4_output_R2.gif
IRx4_output_R2.gif (6.49 KiB) Viewed 3689 times
cyborg5
 
Posts: 47
Joined: Tue Apr 24, 2012 3:13 pm

Re: IR emitter circuit design

by cyborg5 on Sat Feb 23, 2013 6:53 pm

I put this circuit together on a breadboard using just 2 PNP and 2 IR LEDs with one NPN driving them. It appeared to work on the breadboard so I pulled all the parts and soldered it up on a perf-board. At first it appeared to work but then I noticed it started glitching. It was causing the Arduino to reset probably because the power drain was too much. It also had an LCD shield with a 16x2 character display. I rewrote the code to turn off the backlight on the display while sending the IR signal. That seemed to work for a while but it still occasionally crashed. Eventually I think it crashed with the circuit on which probably fried everything. Well it didn't Friday Arduino thank God but I'm not sure the board is working at all now. This was all powered off of a USB port on my PC.

I think all of this is just overkill for my application. I think I'm just going to go back to a single NPN transistor and a single IR LED probably the wide-angle.
cyborg5
 
Posts: 47
Joined: Tue Apr 24, 2012 3:13 pm

Re: IR emitter circuit design

by Sea Moss on Sun Feb 24, 2013 2:01 pm

Personally I hadn't realized that you were using the Arduino as the power supply for the whole thing as well as supplying the control signal. It's certainly not surprising that it bonks out when presented with a load like this. Current is really limited here by the ability of the source to deliver it. For a battery that depends on its internal resistance, for a voltage regulator IC its max current is a property of the device. If you were running it off a USB port then nothing should be permanently damaged ( they have current limiting built in). If the Arduino did somehow get damaged, just replace the ATmega chip on it.
Sea Moss
 
Posts: 8
Joined: Thu Dec 13, 2012 6:33 pm

Re: IR emitter circuit design

by gee on Sun Feb 24, 2013 2:58 pm

cyborg5 wrote:Like this?

Yes.

This is an "emitter follower" circuit - the NPN transistor pull the bases of the PNP down to 0.3-0.5V or so (depends on how far the NPN is driven into saturation). The PNPs add a 0.5-0.7V base-emitter drop, but multiply the current up. So the circuit has a drop of 0.8-1.2V when it's on. As long as this voltage drop (I'd assume 1.2V) plus the voltage drop of your IR LEDs is less than Vcc, it'll work.
gee
 
Posts: 11
Joined: Fri May 22, 2009 9:21 am