Go Down

### Topic: Driving 6 IR LEDs using a transistor (Read 16076 times)previous topic - next topic

##### Mar 27, 2013, 12:16 am
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:

Code: [Select]
`                     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.

#### runaway_pancake

#1
##### Mar 27, 2013, 12:28 am

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
"Who is like unto the beast? who is able to make war with him?"
When all else fails, check your wiring!

#2
##### Mar 27, 2013, 12:50 amLast Edit: Mar 27, 2013, 12:53 am by adrian_h Reason: 1

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

Ok, thanks.

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

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

(Vin - V_LEDs) / ? = Amps

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.

Code: [Select]
` 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.

#### fungus

#3
##### Mar 27, 2013, 12:54 am
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.

#4
##### Mar 27, 2013, 12:57 am
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?

#5
##### Mar 27, 2013, 01:00 am

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

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

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.

#### runaway_pancake

#6
##### Mar 27, 2013, 01:05 amLast Edit: Mar 27, 2013, 01:08 am by Runaway Pancake Reason: 1
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.
"Who is like unto the beast? who is able to make war with him?"
When all else fails, check your wiring!

#7
##### Mar 27, 2013, 03:55 am

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

So basically trial and error?

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

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

#8
##### Mar 27, 2013, 10:08 amLast Edit: Mar 27, 2013, 05:02 pm by adrian_h Reason: 1
Ok, I rewired my board but didn't see any change:

Code: [Select]
`                        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:
Code: [Select]
`E = 4.5V - 2.5V = 2.0V (each IR LED is about 1.25V)I = 100mAR = 2.0V/0.1A = 201/R = 3/RR020 = RR0/3RR0 = 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).
Code: [Select]
`RR0 = 66R = 66/3  = 22I = E/R  = 2.0V / 22  = 90.9mA`Ok, so those are my calculations.  Here is what I actually measured:
Code: [Select]
`V=4.46VI=48.9mAVD0 = VD00 + VD01 = 2.55VVD1 = 2.55VVD2 = 2.54VR0 = 66.0R1 = 66.0R2 = 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

#### mjkzz

#9
##### Mar 27, 2013, 10:23 am
What is Rb? Your transistor might not be fully on . . .
www.mjkzz.com
www.pylin.com

#10
##### Mar 27, 2013, 04:52 pmLast Edit: Mar 27, 2013, 05:07 pm by adrian_h Reason: 1
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?

#### fungus

#11
##### Mar 27, 2013, 05:56 pm
What's the voltage measured between the base&emitter of the transistor?

#12
##### Mar 27, 2013, 06:30 pm
822mV when on, 0V when off

#### dc42

#13
##### Mar 27, 2013, 07:48 pm
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.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

#### fungus

#14
##### Mar 27, 2013, 07:52 pm

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.