Circuit Check Please (LED driver)

So im Building a project these leds will be arranged in a circle there will also be about 15 more of these. with inputs to activate them the 3.3 volts will be from a raspberry pi gpio pin. The 12v sorce is a power supply to light all the leds that ill be using. Just want someone to look over this before i buy everything. to double check me and also help me find the value of the Resistor on the 3.3v for the transistor. Each Led in this will be blue.

Led forward voltage is 3.8v and they are all 20ma

Transistor is a TIP120

Thanks for you help

• How tight is your power budget? Do you want to drive the LEDs as bright as possible? 20mA is the max current, but you can see them at only a few mA. – bitsmack Sep 3 '15 at 21:13
• Trying to keep them as bright as possible ill have plenty of power to power them all the whole project will be roughly 1500 leds most will be just a basic flip switch but these circles will be pi controlled – Womper Sep 3 '15 at 21:15
• A few questions/comments: -Is your 12V supply regulated? If you're just using a wall-wart your voltage may be significantly higher. -Is the 20mA rating on the LEDs the minimum or maximum drive current? -Your 3-LED series strings will draw 18mA and the 2-LED series strings will draw 20mA. This will result in your 2-LED series string being brighter than the 3-string. -I don't know the TIP-120 specs off the top of my head, but make sure it can sink the 56mA you're going to put through it. – Adam Sep 3 '15 at 21:16
• Base current is 120ma for the tip120 I got the power supply offline ive metered it and adjusted to be right at 12v. The 20ma is max. And What would you – Womper Sep 3 '15 at 21:20
• I was meaning to refer to the collector current. It's rated to 5A, so you'll be fine there. – Adam Sep 3 '15 at 21:22

2 Answers

There is a big problem with this circuit - the $V_{CE(sat)}$ of the TIP120 is 0.7V at ~100mA (near our operating point).

That means that there will only be $12-0.7 = 11.3V$ across each LED string. Since $3\times3.8=11.4V$, this means you won't quite have enough voltage available to power the 3-LED strings. Bummer.

Never mind, we can fix this. Since the total current through the three strings is only around 60mA, we don't need a Darlington transistor like the TIP120 - we can do it with a standard NPN BJT. Let's choose the BC547 (because it's readily available and has a maximum collector current of 100mA - enough for us). It's $V_{CE(sat)}$ at 60mA collector current is 0.1V - much better.

So now we have 11.9V across each LED-string + resistor combo. Therefore, the current through each 3-LED string is $(11.9-(3\times3.8)) \div 33 = 15mA$. Current through each 2-LED string is $(11.9-(2\times3.8)) \div 220 = 20mA$. This means that the two sets of LEDs will have different brightnesses. If you want to match them better, make 3x 3-LED strings and just don't use one of the LEDs. You can reduce the resistors to get your forward current back up towards 20mA per LED if you want.

Now, let's calculate the base resistor. We want the BJT in saturation mode, which means we want $I_C << I_B \times H_{FE}$ - that is, we want to overdrive the base current a bit. if we set them to equal, that gives $(2 \times 15mA) + 20mA = I_B \times H_{FE}$. We look up $H_{FE}$ from the datasheet:

We see it given as minimum 110 (worst case). So $(2 \times 15mA) + 20mA = I_B \times 110 \to I_B = \frac{(2 \times 15mA) + 20mA}{110} = 0.45mA$. But actually, as said, we want to overdrive it to ensure saturation - let's overdrive by a factor of 5 (still well within the maximum base current specified in the datasheet). So $I_B = 2.3mA$, and we know that $V_{BE} \approx 0.7V$ (one silicon diode drop). So $I_B = 2.3mA = \frac{3.3-0.7}{R} \to R=\frac{3.3-0.7}{2.3mA} = 1130 \Omega$. The nearest E24 value is $1.1k\Omega$ - so use that. And we're done!

The big takeaway point from this is not to neglect the voltage across your "switch" device - it's always going to be there, and if you're running close-to-the-wire in terms of voltage overhead for diode-type devices, you need to be sure you're not throwing away voltage you can't afford. The minor takeaway is that Darlington transistors come with drawbacks - higher $V_{CE(SAT)}$ and also a higher $V_{BE}$ - but we didn't get on to that in this answer. The Darlington transistor Wikipedia page covers the basic difference - worth a read.

• Thanks for all this information. I do have one question it got a little confusing at the end so it appears the the base current will be 2.3 mA. Just want to double check im reading that correctly. I really appreciate the time. – Womper Sep 5 '15 at 14:15
• Yes - the base current will be 2.3mA. – stefandz Sep 5 '15 at 14:19

I'm not sure this will work as designed - it'll be very LED dependent.

I'd recommend a couple of things:

1. Use a MOSFET instead of a BJT.

Edit: tweaked this section due to the TIP-120's higher Vce(sat).

Switch your BJT out for an N-channel MOSFET. BJTs have a saturation voltage across the collector and emitter, and it varies with current. The TIP-120's Vce(sat) is too high for your design.

Even with a regular NPN transistor with a lower Vce(sat), you'll lose something like 0.4V in the BJT, which will translate into waste heat and might kill your voltage margin.

If this is what you want:

(12 - (3.8 * 3)) / 33 = 18mA


Consider what happens when you factor in a BJT's Vce(sat):

(12 - 0.4 - (3.8 * 3)) / 33 = 6mA


The transistor's Vce just killed your brightness!

Here's a MOSFET that would work the same way as your BJT (except that you won't need that series resistor on the gate):

http://www.digikey.com/product-detail/en/IRLML2060TRPBF/IRLML2060TRPBFCT-ND

You can also get MOSFET arrays that might be a good choice if you want to run a lot on one board.

2. Run at a higher voltage or use 2 LEDs/string.

Can you run from a higher voltage than 12V, or maybe put more LEDs in parallel?

Most LEDs have some variance in the forward voltage. Each LED might be nominally 3.8V, but the forward voltage might be more like 3.6V on some and 4V on others. If you're operating close to the rail, you won't have very consistent brightness from string to string.

On your 3-LED strings:

(12 - (3.6 * 3)) / 33 = 36mA
(12 - (3.8 * 3)) / 33 = 18mA
(12 - (4.0 * 3)) / 33 = 0mA (too much forward voltage).


If you make them all 2-LED strings instead, you'd get:

(12 - (3.6 * 3)) / 220 = 22mA
(12 - (3.8 * 3)) / 220 = 20mA
(12 - (4.0 * 3)) / 220 = 18mA


3. If you can afford it, use an LED driver instead.

You can buy off-the-shelf chips that will take care of limiting the current for you, which means you don't need a ton of resistors and MOSFETs everywhere (plus, you get more consistent brightness).

Check this part out:

http://www.digikey.com/product-detail/en/A6263KLJTR-T/620-1492-1-ND/

• You're missing that the TIP120 is a Darlington device, and hence has much worse Vce(sat) than you are specifying - see my answer. Also, I wouldn't recommend a MOSFET here as 3.3V drive means you need a relatively low Vgs(th) MOSFET - not so easily available in through-hole packages and more costly than a simple BJT like the BC547. I like BJTs for 3.3V operation for exactly this reason - unless I'm free to choose SMD parts. The point about preferring 2-LED strings is well made, however. – stefandz Sep 3 '15 at 22:51
• @stefandz - The TIP120's datasheet actually has a plot of Vce(sat) as a function of collector current. You're totally right that Darlingtons have higher Vce(sat) in general - my number was approximated from the datasheet's graph. – Nicholas Clark Sep 3 '15 at 22:54
• Take a close look of the Vce(sat) vs Ic graph (it is in my answer). Note that the bottom of the y-axis is not zero - it is 0.5V. Hence Vce(sat) at the operating point is around 0.7V. – stefandz Sep 3 '15 at 22:55
• @stefandz - On the subject of the MOSFET, you're probably right that a through-hole component is a better choice here. There are lots of through-hole logic-level MOSFETs though! – Nicholas Clark Sep 3 '15 at 22:56
• @stefandz - D'oh! you're right about the Vce(sat) being more like 0.7V (and also that I got 0.4V by ignoring the bottom label on the Y axis). I should have read your answer more closely. :) – Nicholas Clark Sep 3 '15 at 22:57