PWM through a transistor

Thread Starter

KansaiRobot

Joined Jan 15, 2010
324
Usually it's per 3 serially connected LEDs - have been in all the LED strings I've worked with.
12V to each 3 LEDs (plus resistor).


So 18 LEDs will take 120mA in my book and a BC337 would be a good choice. ~2.5mA to the base (you need to saturate the transistor to get the C-E drop low).
(5-0.7)/0.0025 = ~1k8 and that's the base resistor, no further resistors needed.

I thought it was a long string, a couple of meters at least and in that case, I'd have suggested a MOSFET like this
https://www.sparkfun.com/products/10213
with a gate resistor of 22..47 Ohm.
After much thinking I am going to use the BC337. It supports 800 mA.
Also your statement is correct, I found out that every 3 LEDs have a 150 ohm resistor so if they are all connected in parallel and assuming each LEDs take three volts, the current through each patch is 20mA so the whole strip of 18 LEDs would take 120 mA

Now the Power generated is P=VI so where I= 120mA and V would be 0.7 (max collector -emitter saturation voltage) so P =84mW that is less than the 625mW that is the limit (Total device dissipation)

I ask this because my supervisor mentioned something about requiring a heatsink and gave me another transistor (I dont recall the number now) , but I dont think in these conditions is necessary. What do you think?


EDIT: the transistor I got was the 2SK2313 (a FET)
 
Last edited:

Søren

Joined Sep 2, 2006
472
Now the Power generated is P=VI so where I= 120mA and V would be 0.7 (max collector -emitter saturation voltage) so P =84mW that is less than the 625mW that is the limit (Total device dissipation)
Collector-emitter will be more like 0.1V to 0.3V max. (that's what saturation does). The 0.7V (0.65V more likely) is the base-emitter drop.


I ask this because my supervisor mentioned something about requiring a heatsink and gave me another transistor (I dont recall the number now) , but I dont think in these conditions is necessary. What do you think?
You know the saying: "Those who can - do, those who can't - teach"
(But don't relay that to your supervisor, might lower your grades ;))

Worst case: 0.3V * 0.12A = 0.036W or 36mW around 1/17 of what they can handle, then there's a bit of switching loss, but that's close to negligible here.


If you want to get lower, you need a Zetex part, they make some with an extremely low drop - you won't need them here though, but they're good to know :)
 

Thread Starter

KansaiRobot

Joined Jan 15, 2010
324
This 2.5 mA to the base.. where did you get that?
Perhaps, Fig 4 of the datasheet??

http://www.onsemi.jp/pub_link/Collateral/BC337-D.PDF

If I have the necessary Ic, how can I obtain Ib if I can not use β??


You don't need a resistor to ground! Neither on the base, nor the emitter, the former is governed by the PIC driving actively both high and low, but it would be another thing if you were to set the pin to input at some time, or have 12V on the LED string while the PIC was powered down - in that case, eg. 4k7 (or whatever) to ground/Vss directly from the base would be a good idea, to keep noise from turning the transistor on.
so I have to disconnect the 12V power before powering down the PIC, or are you talking about saving power modes?

As you were told already, yes, the transistor will switch the PWM through to your LEDs - Put a transistor in a sim with a 1k8 base resistor. Set a signal generator to eg. 1kHz square wave (5V amplitude) and feed to the other end of the resistor. put 3 white (or blue) LED's and a 82 Ohm resistor from +12V to the collector and let it rip - change the duty cycle to see it replicated on the collector (oh yeah, add a scope to the collector to see it) - Happy studying
I assume you are talking about the internal structure of the LEDs: 3 Leds and a resistor. Am I correct?
Excuse me a scope???[/quote][/quote]
 
Last edited:

Thread Starter

KansaiRobot

Joined Jan 15, 2010
324
Report:

I completed the task, with the following circuit
schemeit-PWMLed.png
and I could control the 12V LED strip with the potentiometer.

Two issues only still worry me:

1) First, this is not related to the 12V lamp cause the same thing happened to me when using a simple LED: The maximum brightness is reached when the signal to the AD conversor is 4.8V. If I surpass that, for some reason the brightness diminish abruptly and then increase again normally. I wonder why

2) This really worries me: When the brightness is high, the Vce is as predicted 0.1V, so the transistor is in saturation. With that P=VI=120mA*0.1V= 12mW which is quite nice.
But when I decrease the brightness (with the potentiometer and therefore modify the PWM duty cycle) the Vce becomes quite high, I measure a max of 5.24V and with this P= 120mA*5.24V=628.8mW which is slightly higher than the max (625mW) that is written in the datasheet. Do I have cause of concern?? :oops:

EDIT: Wait, I realize in that case the current wouldnt be 120mA but much less.. right?? :confused:
 
Last edited:

Søren

Joined Sep 2, 2006
472
1) First, this is not related to the 12V lamp cause the same thing happened to me when using a simple LED: The maximum brightness is reached when the signal to the AD conversor is 4.8V. If I surpass that, for some reason the brightness diminish abruptly and then increase again normally. I wonder why
You need to change (or make) a scaling factor in the software. Your A/D-C or the holding variable you use (or how you use it to make the PWM) is overrun.
Perhaps you're mixing up eg. 10 bit and 8 bit values/variables, although that would mean 4 of these overruns - a wrong/missing factor is the most likely.


2) This really worries me: When the brightness is high, the Vce is as predicted 0.1V, so the transistor is in saturation. With that P=VI=120mA*0.1V= 12mW which is quite nice.
But when I decrease the brightness (with the potentiometer and therefore modify the PWM duty cycle) the Vce becomes quite high, I measure a max of 5.24V and with this P= 120mA*5.24V=628.8mW which is slightly higher than the max (625mW) that is written in the datasheet. Do I have cause of concern?? :oops:

EDIT: Wait, I realize in that case the current wouldnt be 120mA but much less.. right?? :confused:
You measure with a DMM right?
That will only measure an average and unless your DMM is true RMS, it won't even do that right.
With PWM, you use the same current to control the transistor and it saturates just as much, but with periods where the transistor is completely off.

PWM: ON=saturated and OFF=off.
Saturated means small voltage drop, so small amount of power dissipated in the transistor and off means no current at all through, so no power at all dissipated.
The transitions are short compared toa sensible PWM frequency, so won't matter much.

I'll be using the BC337 to drive a 1W LED for a stroboscope soon :)
 

Thread Starter

KansaiRobot

Joined Jan 15, 2010
324
Thank you for all the help.
I have soldered the circuit on a perfboard... (boy! I suck at soldering :eek:) and test the circuit. It works well (havent change the software yet though)
now my supervisor has make me leave the LED on for the whole day as a final test for this project...
 

Søren

Joined Sep 2, 2006
472
Practice (and patience when soldering) will make you good at it :)

I guess that your supervisor isn't the brightest LED himself, as he gave you the partial 12V strip light, so wondering if it will survive on 12V is a serious waste of time and completely uninteresting, as you didn't build that - if it dies or whatever, it's not your fault anyway.

A more valid test would be, to run it with eg. 50% PWM for a day, to make sure that your software stays on the job for that long - possibly adding a lot of nearby electrical noise, to see how well it holds up under less than ideal conditions (texting from a cellphone or just turning it off then on again will ensure a nasty pulse burst than can tilt most open circuits at short range).

If your circuit flickers the LEDs on such a burst, but returns to a controlled state it's fine (test after a flicker if you can still regulate the PWM).
If OTOH it dies, latches up or break out of your loop into uncharted territory, it's failed - better remember to use the watchdog timer :)
 

Thread Starter

KansaiRobot

Joined Jan 15, 2010
324
Well, i cant help but breathing some of that poisonous smoke that comes out when soldering.... :confused: it comes so much usually...

Thanks a lot for the help and insights. I am now going to the Stepper motor problem... would appreciate some help there too :)
 
Top