# Driving 6 IR LEDs using a transistor

I'm trying to drive 6 IR LEDs off of a UNO using a P2N2222A. I'd like to push about 100-200mA through them.

In order to reduce the current draw, I was thinking that I should put them in parallel banks, however, I'm not sure how to calculate the resistor value to get the current I want. Could someone help me out with the calculation? Is what I am attempting to do a good idea?

Here is the schematic of what I am attempting:

``````                     RB
+--./\/'-- pin 12
|
B|       D00  D01   R0
+--C/ \E---+-|>|--|>|--'\/\,--+
|          | D10  D11   R1    |
E=5v      _|_         +-|>|--|>|--'\/\,--+
I=100mA   _-_         | D20  D21   R2    |
-200mA   -          +-|>|--|>|--'\/\,--+
|                             |
+-----------------------------+

RB = 330 ohms
Transistor = P2N2222A
``````

All diodes are approx 0.63V at about 15mA. I've driven them to go to about 1.5V each at about 150mA for a short period. I figure that this wouldn't be too bad if I pulse them and allow them to dissipate heat. I don't have datasheets on these.

BTW, what is the Vin for? Is it just raw power without a current limit? At least not limited to the board, but the power supply that supplies the board?

Thanks for the help.

BTW, what is the Vin for? Is it just raw power without a current limit? At least not limited to the board, but the power supply that supplies the board?

Yes, "Vin" is the input voltage as delivered from your external supply / battery.

The LEDs should be between +V and the collector, not in the emitter (which ought to go straight to Gnd.)

(Vin - V_LEDs) / ? = Amps

Ok, thanks.

Oh, ok, didn't realize that would make a difference. Still reading up on all of this stuff.

Yeah, that I know, but when I start drawing more current, the values I am getting from my multimeter don't seem to be correct.

Also, seems that the transistor will also take a voltage drop too and all these voltages are dependent on current draw (or is it the other way around?).

Oops, forgot to put in what I calculated.

`````` VR0 = 5 - 1.25 = 3.75V
IR0 = 100mA / 3 = 33.33mA
RR0 = 112
``````

So, this appears to be what I want (I am starting at a lower current for now, but may go higher later), but as I said, testing shows that these voltages on the LEDs and transistors are changing causing the current to change too. Not sure how to compensate.

a) The transistor emitter should be connected to ground (or it won't work).

b) Putting unknown amounts of current through a LED isn't a good idea. Where did you buy them? Somebody must know their power rating.

Oh, one other thing, can I just plug in an external battery to the DC in plug even if I'm running off of USB?

fungus:
a) The transistor emitter should be connected to ground (or it won't work).

Well, it did seem to 'work'. (the LEDs turned on)

fungus:
b) Putting unknown amounts of current through a LED isn't a good idea. Where did you buy them? Somebody must know their power rating.

Bought them from a surplus store (Active Surplus). I think I asked them before and they didn't know. I'll ask again.

Let's go with 80 mA, IREDs can do with much more current than LEDs.
[Bold, daring, and unafraid - that's us, already]

Let's say you have a 9V Vin, 6 LEDs IREDs w/ nominal 1V each, that's 9V - 6V = 3V
3V / 80 mA = 37?
Two 100? in parallel are 50?, 3V / 50? = 60mA
3 100? in parallel are 33?, 3V / 33? = 90mA

Just for peace of mind, disconnect the battery (external) before connecting USB and vice versa.

So basically trial and error?

So, you're saying not to use the.battery when plugged into the USB? Will power leak into the battery?

Ok, I rewired my board but didn't see any change:

``````                        D00  D01   R0
+-(A)------+-|>|--|>|--'\/\,--+
|          | D10  D11   R1    |
E=5v      _|_         +-|>|--|>|--'\/\,--+
I=100mA   _-_         | D20  D21   R2    |
-200mA   -          +-|>|--|>|--'\/\,--+
|                             |
+--E\ /C----------------------+
|B
|    RB
+---'\/,-- pin 12

RB = 330 ohms
Transistor = P2N2222A
``````

Here are my calculations:

``````E = 4.5V - 2.5V = 2.0V (each IR LED is about 1.25V)
I = 100mA
R = 2.0V/0.1A = 20
1/R = 3/RR0
20 = RR0/3
RR0 = 20*3
= 60
``````

So I happen to have 330 Ohm resistors on hand so, I could put 5 in parallel to get 66 Ohms or 6 in parallel to get 55 Ohms. I used 5 in parallel.
Going backwards through the equations I just used, I can calculate current (I).

``````RR0 = 66
R = 66/3
= 22
I = E/R
= 2.0V / 22
= 90.9mA
``````

Ok, so those are my calculations. Here is what I actually measured:

``````V=4.46V
I=48.9mA
VD0 = VD00 + VD01 = 2.55V
VD1 = 2.55V
VD2 = 2.54V
R0 = 66.0
R1 = 66.0
R2 = 65.5
``````

To measure current and voltage, I moved base wire from pin 12 to +5V.
Current was measured at (A) in diagram, diode voltages were measured along lit diodes and resistances were measured while circuit was broken.

Could someone tell me what I'm missing in my calculations? This is driving me nuts.

Thanks

What is Rb? Your transistor might not be fully on . . .

Sorry. I put the value of RB in my first diagram. It's 330. I added it to the current diagram.

I looked up a spec sheet on the P2N2222A, and if I'm reading it right, it has the capability to carry 500mA.

Vce Saturation (Max) @ Ib, Ic: 1V @ 50mA, 500mA

Is that right?

What's the voltage measured between the base&emitter of the transistor?

822mV when on, 0V when off

What I think you are missing is the saturation voltage - Vce(sat) - of the PN2222A. The PN2222A (like the 2N2222A) is a rather poor transistor for medium-current switching because of its high Vce(sat). This is the voltage drop between collector and emitter when the transistor is turned on. More modern transistors such as BC327 or (even better) ZTX851 have lower Vce(sat).

You need to subtract the Vce(sat) from the supply voltage (along with the IR diode voltage drop) when calculating the current through the series resistor.

Also bear in mind that Vce(sat) is usually measured with the base current being 10% of the collector current, and with a 330 ohm base resistor, you are not driving it that hard.

822mV when on, 0V when off

So...you didn't connect the emitter to ground like I said?

Transistors work on the difference between base and emitter, not the difference between base and ground.

It's connected just as it shows in the diagram.

It's connected just as it shows in the diagram.

The transistor needs to go between the LEDs and ground.

822mV is within the expected range under these conditions. What matters more is the voltage between collector and emitter when the LEDs are on.

dc42:
822mV is within the expected range under these conditions.

According to my datasheet Vbe(sat) is 2V (or more). 822mV isn't enough to turn the transistor fully on.

fungus: