Question on PWM LED Drive

Thread Starter

Sonoma_Dog

Joined Jul 24, 2008
99
Hi, I Have designed this very simple PWM LED Driver, but have couple question needs to make sure before i order all the parts and build a prototype.

This circuit will be controlled with a 5v PWM from a microcontroller and that signal will go through a comparator turns the 5v PWM singal to 12v. Then the singal will drive the power mosfet and it will light up the LEDs.

ok The questions i have is..

1) what kind of power mosfet should i use? If i only want to draw 3A of current MAX.

2) for the comparator, I can just pick up any cheapo op-amp and it should be fine right?

2) Why at that node (red arrow) the voltage goes below zore, from what i learned from school, that node should never go below zore right?


Thanks so much in advance,

Sonoma_Dog
 

Attachments

blocco a spirale

Joined Jun 18, 2008
1,546
What's the comparator for? A common-emitter transistor stage is the usual way to go.

Aside from the unnecessary comparator, since the LEDs are being driven from a PWM source, you could be a bit braver and go for smaller value series resistors.
 
Last edited:

hgmjr

Joined Jan 28, 2005
9,027
If you end up using an AVR microncontroller, most of them possess a built in PWM generator. I have used the PWM from an AVR microcontroller to fade LEDs and it works great.

hgmjr
 

SgtWookie

Joined Jul 17, 2007
22,230
This circuit will be controlled with a 5v PWM from a microcontroller and that signal will go through a comparator turns the 5v PWM singal to 12v. Then the signal will drive the power mosfet and it will light up the LEDs.
It would be much more simple if you used a MOSFET that was capable of being driven by logic-level signals, like an IRLIZ14 or IRLZ14. They're rated for 8A, but using components that are rated for 2x or more the expected load is good practice. This would enable you to drive the MOSFET directly from the output of the uC. Use a resistor to limit max current between the gate and the I/O pin of the uC.

Also, in your schematic you are using an N-ch MOSFET on the high side of the LEDs and their resistors. Instead, use the MOSFET to switch the ground side of the LEDs on and off. Otherwise, you will have to keep the gate voltage higher than the drain voltage to keep it turned on. You can't do that without using a high-side driver IC or equivalent.

1) what kind of power mosfet should i use? If i only want to draw 3A of current MAX.
Logic-level MOSFET, specified above.

2) for the comparator, I can just pick up any cheapo op-amp and it should be fine right?
You should never use an op amp as a replacement for a comparator. Op amps were not designed to be run in constant open-loop; this keeps their output in constant saturation, leading to heating and a short life.

2) Why at that node (red arrow) the voltage goes below zore, from what i learned from school, that node should never go below zore right?
The simulation isn't handling the circuit well, because you've used the MOSFET incorrectly. It needs to be between ground and the low side of the LEDs.

As far as the current limiting resistors for the LEDs, calculate them as:
Rlimit = (Vsupply - Vf(LED))/LEDCurrentDesired
For the moment, assume 100% duty cycle for PWM (on all the time)
Vf(LED) is the typical forward voltage of the LED at the specified current.
So, if your Vf was 2.1v, and your desired current was 20mA, your Vsupply is 12v:
Rlimit = (12 - 2.1)/20mA
Rlimit = 9.9/0.02 = 495 Ohms.
The closest standard value >= 495 is 510 Ohms.
I(LED) = 9.9/510 = 19.4mA. Close.
Let's calculate wattage required:
P=EI, or Power in Watts = Voltage x Current
P = 9.9 x 0.0194 = 0.19206 Watts
For reliability, we double that result to 0.38412 Watts.
You will need to use 510 Ohm resistors rated for 1/2 Watt for this example.

However, you could also run multiple LEDs in series. This will waste less current on heating up resistors, and instead spend it lighting up LEDs.
One reliable way to figure out how many you can run in series is
INT((Vsupply-1)/Vf(LED))
Or, subtract 1 volt from your supply voltage, divide that result by your LED's typical Vf, and use the integer result.
In our example:
INT((12-1)/2.1) = INT(11/2.1) = INT(5.2381) = 5
Then you would need to subtract the total Vf of the 5 LEDs from your Vsupply instead of just a single LED in the above equation.
 
Last edited:

Thread Starter

Sonoma_Dog

Joined Jul 24, 2008
99
Yeah i have used a CE NPN transistor configuration before (see picture, i lost the scehmatic, but i think that's what i had ), the transistor heats up pretty quick and i think is because the the voltage drop across the collector and emitter is big, so it increases the power dissipation. i might be wrong tho.

That's why i wanted to convert the 5v PWM to 12v. so it will decrease the voltage drop across the collector and emitter.

and also, the current will decreases when i add more LEDs in parallel . that's why i decided use a mosfet .

Please give me some more recommendation and advices.

Thank you so much.
 

Attachments

Thread Starter

Sonoma_Dog

Joined Jul 24, 2008
99
oh wow, looks like it can be done in just a very simple circuit.

i am going to simulate it then build the prototype and test it out.

hopefully this time i wont be blowing anything up as i always do.

thanks SgtWookie!!!
 

SgtWookie

Joined Jul 17, 2007
22,230
Yeah i have used a CE NPN transistor configuration before (see picture, i lost the scehmatic, but i think that's what i had ), the transistor heats up pretty quick and i think is because the the voltage drop across the collector and emitter is big, so it increases the power dissipation. i might be wrong tho.
In that schematic, you had the transistor basically shorting out the supply instead of gating the current through the LEDs! :eek:

If you had instead used the NPN transistor to control the LED's ground path, your circuit would have been much better.
 

Thread Starter

Sonoma_Dog

Joined Jul 24, 2008
99
In that schematic, you had the transistor basically shorting out the supply instead of gating the current through the LEDs! :eek:

If you had instead used the NPN transistor to control the LED's ground path, your circuit would have been much better.

I thought the LEDs will turn on when the NPN transistor is in it's cut-off mode.
 

SgtWookie

Joined Jul 17, 2007
22,230
Yes, they will. However, it would be a far more efficient circuit if you had used the transistor as a switch to turn the current to the LEDs on and off, rather than causing all of that power to be dissipated in the transistor and the collector/emitter resistors. Besides, you could also get rid of R2 and R8, as they would no longer be necessary.
 

Thread Starter

Sonoma_Dog

Joined Jul 24, 2008
99
I am going to do all the calculation and draw out the schematic, i will post it in a little bit.

Got another question, I am going to use one of these LEDs (see link). and it said it's resistor free. So is that mean the resistor is already integrated within the LED?

if the resistor is already integrated in the LED, the resistor values would be Vf(LED)/forward_current(LED) = 3.5V/20mA = 175ohm ?


Link: http://cgi.ebay.com/Lot-of-100-X-3mm-Green-LED-15000-mcd-Free-Resistors_W0QQitemZ280262600089QQihZ018QQcategoryZ66954QQssPageNameZWDVWQQrdZ1QQcmdZViewItem
 

Thread Starter

Sonoma_Dog

Joined Jul 24, 2008
99
Use a resistor to limit max current between the gate and the I/O pin of the uC.
I thought that the gate input resistance for the mosfet is big and it's a voltage controlled transistor. Do i still need an additional resistor between the I/O port and the gate? it seems like it's not necessary.
 

Thread Starter

Sonoma_Dog

Joined Jul 24, 2008
99
ok here is the circuit i have, what do you think? :)

And also, where can i find the spice model for IRLZ14? i looked around the LT yahoo group, i dont think it's there.

Thanks
 

Attachments

Last edited:

SgtWookie

Joined Jul 17, 2007
22,230
Got another question, I am going to use one of these LEDs (see link). and it said it's resistor free. So is that mean the resistor is already integrated within the LED?
They are not "resistor free", they come with resistors at no extra charge!

You specify the voltage that you will use the LEDs with, and they send appropriate resistance value resistors along with them - to be used 1 resistor per LED. However, if you're going to use multiple LEDs in series, you will need a different resistance value.
 

SgtWookie

Joined Jul 17, 2007
22,230
I thought that the gate input resistance for the mosfet is big and it's a voltage controlled transistor. Do i still need an additional resistor between the I/O port and the gate? it seems like it's not necessary.
The gate has nearly infinite resistance, however it DOES have capacitance. Without going through a lot of math at the moment, limit that maximum current to what the uC can source or sink, whichever is less.

If you're going to use a PIC uC, they can sink or source up to 25mA. Since R=E/I, your Vcc is 5v and your max current is 25mA:
R= 5/0.025 = 200 Ohms.
 

SgtWookie

Joined Jul 17, 2007
22,230
More on those green LEDs:
At 20mA, Vf is specified to be 3.2 - 3.6v. You should use the lower voltage in your calculations; that's the typical Vf. If you use the higher voltage, you will wind up putting too much current through those LEDs with a lower Vf; which will be most of them.

In a given batch of LEDs, about 80% will have a Vf in a very narrow range. Then you'll get perhaps 8% that are rather low, and another 8% that are rather high. You'll have a few % that are very low or very high. That's just the way it works out. You can't order them for a specific Vf, only brightness and focus.
 

SgtWookie

Joined Jul 17, 2007
22,230
ok here is the circuit i have, what do you think? :)

And also, where can i find the spice model for IRLZ14? i looked around the LT yahoo group, i dont think it's there.

Thanks
Use 3.2 for the LED's Vf.

Where are your calculations for the wattage required for the resistors? That's important too.

I don't happen to have a model for the IRLZ14, nor can I find one.

However, here is a model for an IRLIZ24, which is a step up in current handling capacity:
Rich (BB code):
.SUBCKT irliz24n 1 2 3
**************************************
*      Model Generated by MODPEX     *
*Copyright(c) Symmetry Design Systems*
*         All Rights Reserved        *
*    UNPUBLISHED LICENSED SOFTWARE   *
*   Contains Proprietary Information *
*      Which is The Property of      *
*     SYMMETRY OR ITS LICENSORS      *
*Commercial Use or Resale Restricted *
*   by Symmetry License Agreement    *
**************************************
* Model generated on Apr 24, 96
* Model format: SPICE3
* Symmetry POWER MOS Model (Version 1.0)
* External Node Designations
* Node 1 -> Drain
* Node 2 -> Gate
* Node 3 -> Source
M1 9 7 8 8 MM L=100u W=100u
* Default values used in MM:
* The voltage-dependent capacitances are
* not included. Other default values are:
*   RS=0 RD=0 LD=0 CBD=0 CBS=0 CGBO=0
.MODEL MM NMOS LEVEL=1 IS=1e-32
+VTO=2.28964 LAMBDA=0.0215953 KP=15.2899
+CGSO=4.31343e-06 CGDO=3.57832e-07
RS 8 3 0.0565541
D1 3 1 MD
.MODEL MD D IS=6.86381e-12 RS=0.0132391 N=1.12746 BV=55
+IBV=0.00025 EG=1 XTI=1 TT=0.0001
+CJO=3.01404e-10 VJ=1.71721 M=0.517385 FC=0.5
RDS 3 1 2.2e+06
RD 9 1 0.0001
RG 2 7 9.08134
D2 4 5 MD1
* Default values used in MD1:
*   RS=0 EG=1.11 XTI=3.0 TT=0
*   BV=infinite IBV=1mA
.MODEL MD1 D IS=1e-32 N=50
+CJO=4.34473e-10 VJ=0.5 M=0.70039 FC=1e-08
D3 0 5 MD2
* Default values used in MD2:
*   EG=1.11 XTI=3.0 TT=0 CJO=0
*   BV=infinite IBV=1mA
.MODEL MD2 D IS=1e-10 N=0.429456 RS=3e-06
RL 5 10 1
FI2 7 9 VFI2 -1
VFI2 4 0 0
EV16 10 0 9 7 1
CAP 11 10 1.16271e-09
FI1 7 9 VFI1 -1
VFI1 11 6 0
RCAP 6 10 1
D4 0 6 MD3
* Default values used in MD3:
*   EG=1.11 XTI=3.0 TT=0 CJO=0
*   RS=0 BV=infinite IBV=1mA
.MODEL MD3 D IS=1e-10 N=0.429456
.ENDS
[eta]
International Rectifier's models are avaliable on this page:
http://www.irf.com/product-info/models/
 
Last edited:

SgtWookie

Joined Jul 17, 2007
22,230
Even more on the resistors:
Whatever voltage you tell them that you are running the LEDs with, they will supply you with the correct value of resistance for that voltage for a single LED. However, the resistors will be 1/8W, which is not adequate for running them at 12v.
12v-3.2 = 8.8V to drop across the resistor at 20mA
20mA x 8.8v = 176mW. 1/8W is 125mW. But don't forget, for reliability you double the power, to 0.352W. 1/2W would be the wattage of choice.

But if you're running two in series, that changes things.
INT((12-1)/3.2) = 3. Why not run three in series? It's certainly do-able.
Rlimit = (12-3*3.2)/20mA = 2.4/0.02 = 120 Ohms
P(Rlimit) = 2.4 x 0.02 = 0.048W, double it to 0.096W. You can use 1/10W resistors and get good reliability.
 

Thread Starter

Sonoma_Dog

Joined Jul 24, 2008
99
The gate has nearly infinite resistance, however it DOES have capacitance. Without going through a lot of math at the moment, limit that maximum current to what the uC can source or sink, whichever is less.

If you're going to use a PIC uC, they can sink or source up to 25mA. Since R=E/I, your Vcc is 5v and your max current is 25mA:
R= 5/0.025 = 200 Ohms.
I am actually going to use a ATMega168 microcontroller, I was looking at the datasheet, but it doesn't tell me anything about the max I/O port current it can handle. But as i recall the ATmega 128 can handle 5mA of current.
 

Thread Starter

Sonoma_Dog

Joined Jul 24, 2008
99
Even more on the resistors:
Whatever voltage you tell them that you are running the LEDs with, they will supply you with the correct value of resistance for that voltage for a single LED. However, the resistors will be 1/8W, which is not adequate for running them at 12v.
12v-3.2 = 8.8V to drop across the resistor at 20mA
20mA x 8.8v = 176mW. 1/8W is 125mW. But don't forget, for reliability you double the power, to 0.352W. 1/2W would be the wattage of choice.

But if you're running two in series, that changes things.
INT((12-1)/3.2) = 3. Why not run three in series? It's certainly do-able.
Rlimit = (12-3*3.2)/20mA = 2.4/0.02 = 120 Ohms
P(Rlimit) = 2.4 x 0.02 = 0.048W, double it to 0.096W. You can use 1/10W resistors and get good reliability.
Great! I looks like i am going put three LED in series!

for the LTspice, how do i simulate LEDs? I right click on part and it poped up a diode properties window, it shows the forward current but it wont allow me to edit anything.
 

Attachments

Top