# PWM NPN Transistor Wiring

hey guys,

i want to controll 39 led's each drawing 20mA with PWM. In order to do this i utilize a BD139 transistor with 1k resistance connected to B.

since it's a NPN, is it possible to put the load in front of the collector and connecting the emitter directly to GND? all parts are supplied by regulated 5V. see picture added below.

led pwm.pdf (56.4 KB)

TobiasCrackz:
hey guys,

i want to controll 39 led's each drawing 20mA with PWM. In order to do this i utilize a BD139 transistor with 1k resistance connected to B.

since it's a NPN, is it possible to put the load in front of the collector and connecting the emitter directly to GND? all parts are supplied by regulated 5V.

As I see it, that's "basically" fine.
If your intention is 780mA through one transistor - maybe (probably) not.

the BD139 is capable of up to 80V / 1,5A / 8W

so 780mA at 5V should be fine !?!

Only one way to find out (probably not all at once.)
Try a few, see how it goes, add more.

N-channel MOSFET will run even cooler. AOI-514

With Rds of <12Ohm with 5v on the gate, then power dissipated by the MOSFET will be I^2 x R = .78A x .78A x .012 = 7.3mW.
WIth BJT, assuming 0.7V Vce, power dissipated = I x V = .78A x 0.7V = 546mW.
To Saturate the BJT, get it to turn full on, you need 50mA of base current to support 500mA Ice current:
VCE(sat) Collector-Emitter Saturation Voltage at IC = 500 mA, IB = 50 mA: 0.5V
which Arduino pin can't support (for very long).

It will work with a 220ohm base resistor.
Saturation voltage of the transistor is a bit higher, the transistor gets hot, and the LEDs are not getting full current.
You could add a small NPN transistor, and make a darlington.
But as CrossRoads suggested, a logic fet would be better/easier.
Leo..

I started a subject along these lines awhile back.
It was more about drawing lots of current than about LEDs, but using LEDs was more visually convincing than just using resistors (I supposed.)
[If it was about getting 20 LEDs going, I would have put bunches of them in series.]

http://forum.arduino.cc/index.php?topic=160532.0

are you sure using MOSFET is a good idea, since i'm using it to controll 39 LEDs with PWM....those high frequencies will increase power loss at the MOSFET?!

if not: all i have to do is connect gate via 330 ohm or so to the arduino pin (and via high resistor - eg. 100k - to GND), source to GND and drain via the load to VCC ?

the BD139 is capable of up to 80V / 1,5A / 8W

That rating is for a properly heatsinked device. (without it the device is significantly derated)

Are you using a good heatsink ?

folks, problem solved like this:

since all LEDs are controlled through shift registers i connected all OE (output enable) via 10k to the PWM output of the arduino.

TobiasCrackz:
are you sure using MOSFET is a good idea, since i'm using it to controll 39 LEDs with PWM....those high frequencies will increase power loss at the MOSFET?!

Firstly the default PWM frequencies on the Arduino are either about 1kHz or 500Hz depending on
which pin... Not particularly fast.

Secondly a reasonable choice of MOSFET for 1A load or so will have perhaps a couple of nF gate
capacitance, which with a 220 gate resistor would give a switching time of the order of 0.5us
which is fine. Probably faster than BD139 switch-off time from saturation.