 # Selecting a Transistor

This is a really specific question.

I am attempting to dim some leds using the arduino's pwm output, however these are really high current leds and i want to make sure that I am doing all the math right on this.

I am using an NPN BJT type resistor

my leds are 15v, 1500mA

The way I understand the needed calculations are as follows: lc(max) = load current / load resistance

since my load current is 1500mA and its an led so no resistance (right?), thus: lc(max) = 1500mA

the way i understand calculating hFE(min) is as follows: hFE(min) > 5 * ( load current / max IC current)

the arduino's max current is 50mA so: hFE(min) > 5 * ( 1500 / 50 ) = 150

and finally to calculate the base resistor: RB = ( (Vc x hFE) / ( 5 * lc ) )

Vc = 5v (supply voltage to arduino), so RB = ( ( 5 x 150) / ( 5 * 1500) ) = 0.1K OHMs or 100 OHMs

All of this leads me to choose 2SC4115S from Digi-Key, as can be seen here: http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=2SC4115STPRCT-ND

So do I have all my math right on this? will this transistor do what I want it to?

-- Bishop

So do I have all my math right on this? will this transistor do what I want it to?

I don't know, but I do know you can't draw 50ma from an Arduino output pin. 20ma is a recommended max and 40ma is absolute max.

That's why I love logic level n-channel mosfet power transistors for high power applications. If the device is rated for the voltage and current you are good to go.

http://www.sparkfun.com/products/10213

Lefty

Howdy Bishop, I’m gonna answer your “really specific question” about how to use a BJT but retrolefty has a better answer in general using a FET.

my leds are 15v, 1500mA

The way I understand the needed calculations are as follows:

since my load current is 1500mA and its an led so no resistance (right?), thus:
lc(max) = 1500mA

The second is correct the first is simply lc(max) = load current.
Except LED has a non-linear characteristic similar to a voltage drop in series with a resistance.

the way i understand calculating hFE(min) is as follows:
hFE(min) > 5 * ( load current / max IC current)

the arduino’s max current is 50mA so:
hFE(min) > 5 * ( 1500 / 50 ) = 150

hFE is the current gain, also called “beta” and is current amplification
Its the ratio of base current to collector current. So an NPN with hFE =200, emitter grounded, a load from collector to some (reasonable) positive voltage, for every mA you put in to the base, about 200 mA of collector current will flow.

Thats the linear region. You want the saturated region, where the collector is wide open, like a switch straight to ground, which is the reason for the " 5 * " in the equation, if you are putting 5x the base current as it would take to amplify up to the collector current (load current) then you are pretty sure the transistor is turned ON as hard as it can be; ie its acting more like a switch not an amplifier.

the arduino’s max current is 50mA so:
hFE(min) > 5 * ( 1500 / 50 ) = 150

As retrolefty said, 40 mA so the gain has to be at least 188 (for 5x saturation)

and finally to calculate the base resistor:
RB = ( (Vc x hFE) / ( 5 * lc ) )

Vc = 5v (supply voltage to arduino), so
RB = ( ( 5 x 150) / ( 5 * 1500) ) = 0.1K OHMs or 100 OHMs

Thats pretty much correct.

One thing that does not account for is base-emitter will drop at least 0.6 V, or up to 1v at high current, so only about 4 V to 4.4 V of your 5V supply appears across the resistor.

Another thing is the Arduino has about 25 ohms of internal resistance on its IO pins, see http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1293405462 for details.

will this transistor do what I want it to?

YES.

A good choice, if you have your heart set on BJT. Many folks use FETs which gets rid of all concerns about drive current. FETs have completely different design issues which are a whole 'nother topic.

If you prefer to stick with a BJT then we need to sharpen our pencils on that base resistor.

This whole thing is running close to the limits, so lets start by getting the maximum base current an Arduino can grunt out, it will not be overkill, then lets work back from there.

To get the 40 mA absolute max pin current, we need ( 5v - Vbe) / 40 mA ohms total (including the ohms inside the ATmega). Look at Fig 1 of the 2SC4115 and see Vbe will drop to 0.75 V when it heats up. And it WILL heat up. So the resistance needed is ( 5v - 0.75 v) / 40 mA ohms comes out near 106 ohms.

Thats about what you said, right ? Congratulations !

But wait, remeber theres about 25 ohms inside the ATmega so you oughta use about 80 ohms, and 82 ohms is a standard value which would be fine.

God members may cringe at such a low resistance but its valid and works.

So now we have 40 mA into the base, will the collector be happy?

The HFE for “Q” grade is 120 to 270 and Fig 4 shows a bit of droop when its hot, so lets go with absolute worst case HFE of 100. So 100 * 40 mA is 4000 mA which is plenty less than your planned Ic load.

The saturation factor is 4000 / 1500 or about 2.7x overdrive. Not the 5x overdrive we wanted but its enough. And thats worst case, it will probably be 5x or 10x overdrive typical.

All of the preceding is CONTINUOUS ratings, and the transistors may get hot enough to want a heat sink. A sheet metal clip will do. If you are doin POV or something that has a lower duty cycle even better. If your duty cycle is 10% or less they may not warm up noticeably even with no heat sink.

All that said, Bishop, FETs are hard to beat. The one retrolefty recommended is highly suitable for what you re doing, although it costs 2x more and is 3x bigger it has plenty of grunt and will not get warm even with no heat sink.

On the sparkfun page please disregard the raving of PeterG

using a N-Channel MOSFETs as a a high-side power switch

You use a P-channel for a high side switch and an N-channel for a low side switch, which is what youve got and it will be fine.

Awesome, I hadn't considered using a MOSFET instead, and that will give me WAY more room for expandability ( I plan eventually to move on to even higher current and brighter leds ). It sounds like that N-Channel MOSFET from Sparkfun will do perfectly.

Heres another related question:

Before i was using 2n3904's with some 150mA leds, and I had some pretty bad flickering issues. I did some debugging and my pwm output isnt "flickering". Any ideas on what might have been causing that, and what i can do about it?

will I have that same issue with the MOSFET?

Thanks,

--Bishop

Also, Thanks AltairLabs, that really ironed out my understanding of the math, I appreciate you explaining all of that.

Before i was using 2n3904's with some 150mA leds, and I had some pretty bad flickering issues.

2n3904 has a max Ic of 200mA so you are pretty close to the limit which, depending on how you designed your circuit, could be a problem.