# Help with bipolar NPN selection

Discussion in 'The Projects Forum' started by ke5nnt, Oct 30, 2009.

1. ### ke5nnt Thread Starter Active Member

Mar 1, 2009
384
16
I am trying to select the appropriate transistor for switching on and off an array of LEDs.

I am using 5V+ out of an output pin from a microcontroller into the NPNs base through a resistor. (I assume that 5V Vdd means I get 5V from an output pin, maybe I'm wrong?)

9V into LED array
24 LEDs in array, 12 parallel columns each with 2 LEDs in series
LEDs are Vf 3.2 @ .024A
Total amp draw for array .288A
Each series has 120Ω resistor
All cathodes then go to NPN Collector
Emitter to ground
Base and Emitter are connected through a resistor.

I am thinking THIS TRANSISTOR.

Here are my calculations, please correct me if I'm wrong (this is the part I'm not that good with yet, at least I don't think).

HFE = 100
R1 value (resistor from uC pin to Base) = 9V / (.288 / 100 * 1.3) = 2404 (note I added 30% extra current to ensure saturation), next standard resistor value = 2.7K

R2 value = R1*10 = 270K

NPN collector-emitter saturation voltage is 1.5V so...
NPN power dissipation for this setup is 1.5V * .288A = 432mW (within the range of this NPN's max power dissipation rating of 900mW)

So, based on this I assume that since max collector current is 1A, and my array draws .288A, I'm ok here.
Also, based on max Power Dissipation of 900mW and my calculated 432mW need, I'm ok here as well.

Am I correct that this NPN will work for my application?

Are my values for R1 and R2 correct?

Thanks!

Jul 17, 2007
22,201
1,809
3. ### ke5nnt Thread Starter Active Member

Mar 1, 2009
384
16
Thanks Sgt,

Couple of questions to help me understand a point better:
What was it about my original choice that wasn't optimal?
With the mosfet you recommended, aside from the 270 Ohm resistor from I/O to Gate, there's no need for a second resistor, or a need to connect the Gate to the Source?

Originally I was using FQP13N10L which is a TO-220 package (too big for my tastes) plus, its rated at 12.8A, waaay over what I need.
Also on original TO-220 setup, I had 200 Ohm from I/O to Gate, Gate connected through 6.8K Ohm to Source which was then to ground, and LED array cathodes to Drain.

Thanks again.

4. ### SgtWookie Expert

Jul 17, 2007
22,201
1,809
That's basically correct, but the more current you try to source/sink from an I/O pin, the further away from Vdd/GND you get.

I hope that you are not planning on using a 9v "transistor" battery, as those will not provide enough current.
OK, if the LED Vf is 3.2 then:
Rlimit >= (Vsupply - VfLED) / DesiredCurrent
Rlimit >= (9 - (3.2 x 2)) / 24mA
Rlimit >= 2.6 / 0.024 = 108.2 Ohms. The closest standard E24 value is 110 Ohms.
Standard values: http://www.logwell.com/tech/components/resistor_values.html
This will give you 2.6v/110 Ohms = 23.6mA current per string, total of 284mA for the array.
Each resistor will dissipate 61.4mW. Double it for reliability, that's 123mW. You can use 1/8W or higher rated resistors.

When you are using a transistor as a switch, you use a forced beta (hFE)=10.
However, your uC would not be able to supply 284mA/10=28.4mA from an I/O pin. That is why I suggested the logic-level MOSFET.
You're using 9v from the output of the uC. It won't be above 5v.
You forgot about Vbe. That gets subtracted from the Uc's output voltage. With low base currents, Vbe will range from around .63v to .7v. As Ib gets higher, Vbe increases. You might see .8v or more when Ib=10mA, depending on the transistor.
But anyway, uC's are generally limited to 20mA maximum source/sink current per I/O pin, and then there is also a package limit; the latter depends on the individual uC.

So, assuming your uC's Vcc is 5v and Vbe will be around .8, that leaves 4.2v for 20mA current. 4.2v/0.02A = 210 Ohms. The closest standard value is 220 Ohms. 4.2v/220 Ohms = 19.1mA.

You don't have to use a pull-down resistor to turn the transistor off as long as you don't change the I/O pin to an input. Setting the output to a logic low will turn the transistor off.

If the transistor is saturated, Vce will be very low; 0.2v or less. Vce=1.5v is not in saturation.
The MOSFET would be better and less of a strain on your uC. Once the gate was charged or discharged, there would be no current on the I/O pin.

Nope.

5. ### ke5nnt Thread Starter Active Member

Mar 1, 2009
384
16
Thanks again for taking the time to explain all that, makes more sense now. That's what I get for using a "wizard" to calculate resistor values for me. Do them myself from now on, point taken.

6. ### SgtWookie Expert

Jul 17, 2007
22,201
1,809
Well, bjt's need continual current flow on the base to keep them saturated. Your Ic requirements were just a bit over the limit for a uC's I/O pin to ensure saturation; and low power dissipation in the transistor.
Connecting a 10k to 20k resistor from the gate to source is a good idea. That way in case the 270 Ohm resistor fails or the I/O port fails, the MOSFET gate will not be floating.

That would've been OK.

I like those little logic-level power MOSFETs I suggested; very compact with a decent Id rating, and handy for hobbyists who don't want to use SMD/SMT parts. I wouldn't want to sink more than about .5A without a large copper pour area to act as a heat sink.

7. ### Ron H AAC Fanatic!

Apr 14, 2005
7,012
681
@ke5nnt: if you want a second opinion, I agree with SgtWookie.

@SgtWookie: Those are nice MOSFETs! Thanks for the link. Now, If I only had a place to file stuff like this...

8. ### SgtWookie Expert

Jul 17, 2007
22,201
1,809
Ron_H,
You're welcome! I'd found those a year or so ago and keep forgetting about them - just happened to stumble on the datasheet again when I was looking at a different project. Heck of an idea they had with those!

I have a whole slew of datasheet PDF files stored on my computer. Glad I don't have to print them all out!

9. ### Ron H AAC Fanatic!

Apr 14, 2005
7,012
681
Actually, I do too. I even have a whole slew of subfolders for various types of components. Why didn't I remember that?