|
10/01/2010, 09:06 PM | #1 |
Registered Member
Join Date: Mar 2009
Location: Brazil
Posts: 250
|
Question on LED driver from PWM output circuit
I'm thinking of building an Arduino based LED controller, using Arduino's PWM output to regulate LED intensity. Obviously Arduino's PWM is too low current to run a power LED so I was thinking about using an auxiliary circuit to provide the necessary current for the LEDs.
I was thinking about a simple transistor based on/off switch but after googling a while I noticed there is a lot of talk about constant current sources for LEDs. My question: would the simple circuit below work to ensure a constant current on a LED fed by a PWM source (which could be 100% on all the time)? The idea is having R2 dimensioned so Q2 starts functioning when the LED current goes over 700mA, therefore reducing base current of Q2 and ensuring the LED current doesn't go over 700mA. I haven't seen anyone using a similar circuit, and it is quote simple.... so there must be some pitfall here. What is it? What am I missing? Thanks, Snorkeler
__________________
Tank: 180L (46gal) 60cm cube DT visible from all sides with central overflow column, 10cm crushed coral base, LR, 79L (20gal) sump with skimmer, ATS and refugium. External jerrican DIY ATO. Livestoc |
10/01/2010, 09:45 PM | #2 |
100-mile-commuter
Join Date: Dec 2004
Location: almost nevada
Posts: 4,721
|
You'd be dumping a lot of current through the base of Q2 (bad), plus its hard to tune. Needs more work I suggest firing up LTSpice or similar and doing simulations.
There are two types of drivers here: linear and switching. They're both direct analogues of their voltage controlled counterparts, except become current controlled through a sense resistor, generally at the cathode end. Switching buck converters are generally structured using two comparators to control the switch circuit.
__________________
Custom electronics purveyor. blueAcro.com Current Tank Info: 90g SPS+mixed reef (10 yrs): LEDBrick LEDs, 40g custom sump, Ca reactor, chiller, Vortech, lots of custom electronics |
10/01/2010, 10:26 PM | #3 |
Premium Member
Join Date: May 2004
Location: Longmont, Co
Posts: 4,566
|
Just use the Arduino to drive an optocoupler then drive a MOSFET from that.
Stu
__________________
Some people think that I have Attention Deficit Disorder. They just dont understand that........ Hey! Look a chicken! Well, We KNOW GOD exists, but for US to exist without a GOD is preposterous….Umm wait a minute…. Sounds a bit circular to me… Current Tank Info: 125 Gal. display w/80 gal mud/caulerpa sump. Basement sump w/ LED Grow Light,Gravity fed Reeflo200 skimmer w/ ORCA Recirc, DIY calc reactor & kalk stirrer. Inline plumbed 75 Gal frag/settling tank. |
10/01/2010, 11:48 PM | #4 |
100-mile-commuter
Join Date: Dec 2004
Location: almost nevada
Posts: 4,721
|
Opto is overkill, no need for isolation. A single low side N channel would be sufficient. Make sure you're capable of driving it hard enough to fully switch.
__________________
Custom electronics purveyor. blueAcro.com Current Tank Info: 90g SPS+mixed reef (10 yrs): LEDBrick LEDs, 40g custom sump, Ca reactor, chiller, Vortech, lots of custom electronics |
10/02/2010, 04:56 AM | #5 |
Registered Member
Join Date: Dec 2007
Location: Central California Coast.
Posts: 5,383
|
Yep. And don't get hung up on "constant" current. The LED couldn't care less. You do have to keep the average current in the ball park.
|
10/02/2010, 07:14 PM | #6 |
Registered Member
Join Date: Mar 2009
Location: Brazil
Posts: 250
|
Thanks folks, I think I get the idea, I understand I'll need a resistor in line with the LED with that setup to limit current. I'll study some more how use a MOSFET (a little rusty there) and if I have more questions I'll shoot them in this thread. Thanks!
Snorkeler
__________________
Tank: 180L (46gal) 60cm cube DT visible from all sides with central overflow column, 10cm crushed coral base, LR, 79L (20gal) sump with skimmer, ATS and refugium. External jerrican DIY ATO. Livestoc |
10/03/2010, 12:31 PM | #7 |
Premium Member
Join Date: May 2004
Location: Longmont, Co
Posts: 4,566
|
theatrus,
"Opto is overkill, no need for isolation." There are many advantages of using optos other than isolation: 1 - you can drive a MOSFET that needs a Vgs(on) of 5 volts using 3.3V logic. 2 - you can drive high side and low side FETs (P-type & N-type) without a FET driver chip. 3 - you can get Optos that have enable/disable pins so you can use more than one IO line to drive the PWM so that a software bug (or power up default) does not fry your LEDs. Or you can use two logic gates from the CPU to drive the LED in the opto to provide protection ( one must go HI & the other LOW to provide current through the opto) Stu
__________________
Some people think that I have Attention Deficit Disorder. They just dont understand that........ Hey! Look a chicken! Well, We KNOW GOD exists, but for US to exist without a GOD is preposterous….Umm wait a minute…. Sounds a bit circular to me… Current Tank Info: 125 Gal. display w/80 gal mud/caulerpa sump. Basement sump w/ LED Grow Light,Gravity fed Reeflo200 skimmer w/ ORCA Recirc, DIY calc reactor & kalk stirrer. Inline plumbed 75 Gal frag/settling tank. |
10/08/2010, 07:05 PM | #8 |
Registered Member
Join Date: Mar 2009
Location: Brazil
Posts: 250
|
OK, I looked up the MOSFET stuff, some extra Arduino stuff, my LED's specs and figured out the circuit below should work. But it is still pretty simple.
Each PWM output would drive six LEDs. For simplicity's sake I only drew PWM11's MOSFET circuit, but all the others would be identical. I dimensioned R=35ohms to ensure max Current was 685mA on a voltage source of 24V. My LEDs (EHP-AX08EL) are ideally driven at 700mA so 685mA should be fine. The 1K resistor between the Arduino PWM output and the MOSFET is to keep current at 5mA (Arduino's max is 40mA). Am I missing something, or should this work? (if the picture is blurry, check it out with zoom at Picasaweb: http://picasaweb.google.com/lh/photo...eat=directlink) Thanks! Snorkeler
__________________
Tank: 180L (46gal) 60cm cube DT visible from all sides with central overflow column, 10cm crushed coral base, LR, 79L (20gal) sump with skimmer, ATS and refugium. External jerrican DIY ATO. Livestoc |
10/09/2010, 12:15 PM | #9 |
Registered Member
Join Date: Mar 2009
Location: Brazil
Posts: 250
|
theatrus, stugray, kcress? Anyone else?
I'd really appreciate your opinions on this simple design. Thanks, Snorkeler
__________________
Tank: 180L (46gal) 60cm cube DT visible from all sides with central overflow column, 10cm crushed coral base, LR, 79L (20gal) sump with skimmer, ATS and refugium. External jerrican DIY ATO. Livestoc |
10/09/2010, 12:33 PM | #10 |
Registered Member
Join Date: Feb 2008
Location: springfield, missouri
Posts: 374
|
I am just using a transistor (NPN) from radio shack connected to the PWM on the arduino. It is working great for me. No heating problems at all. One neat thing I did see with the PWM, is on one of my powerheads, there is a kinda strobe effect. Kinda neat.
__________________
Saving the world one paper plate at a time!!! There is no I in team, but there is a me! Dagget from the Angry beavers Current Tank Info: Solana, MP10es w, Ecotech radion, water, salt, pretty colored thingys |
10/09/2010, 01:05 PM | #11 |
Registered Member
Join Date: Mar 2009
Location: Brazil
Posts: 250
|
One change that I decided: instead of using a 24V source I'll switch to a 12V source (an ATX PC power source/unit) and do 10 3-LED strings in parallel.
I'll also use only two Arduino PWM outputs, one for whites and another for the blues. So each Arduino PWM signal would drive 5 MOSFETs in parallel. I guess that means I need to increase the MOSFET resistor size in order to reduce the current so that it doesn't go over Arduino's 40mA limit.
__________________
Tank: 180L (46gal) 60cm cube DT visible from all sides with central overflow column, 10cm crushed coral base, LR, 79L (20gal) sump with skimmer, ATS and refugium. External jerrican DIY ATO. Livestoc |
10/09/2010, 01:17 PM | #12 | |
Registered Member
Join Date: Dec 2007
Location: Central California Coast.
Posts: 5,383
|
Quote:
Yes. What you have there will make the LEDs go ON and OFF. Dependability will hinge on keeping the various players in their happy temperature ranges. Depending on the RC you have created with the FET's base capacitance and the base resistor, there will be periods during both transitions that the FET hangs out in the linear region. Any transistor in the linear region is a transistor acting as a resistor. That means it will be heating up. I would instead change that base resistor to a 40mA value if that is what the Arrr can take. That 40mA will only occur during the first 5% of the time it takes to switch the FET. |
|
10/09/2010, 01:36 PM | #13 |
Registered Member
Join Date: Mar 2009
Location: Brazil
Posts: 250
|
Yep, just dimming of resistor limited current.
I'll have the LEDs hooked to heat sinks so that should keep them cool enough. Regarding the FET it has a switch on voltage of 1V, not sure about the capacitance. Arduino's signal is 5V therefore I'm assuming that it will switch the FET completely on and out of the linear region. Thanks for the pointers and confirmation the circuit makes sense! Snoekeler
__________________
Tank: 180L (46gal) 60cm cube DT visible from all sides with central overflow column, 10cm crushed coral base, LR, 79L (20gal) sump with skimmer, ATS and refugium. External jerrican DIY ATO. Livestoc |
10/09/2010, 01:57 PM | #14 | |
Registered Member
Join Date: Dec 2007
Location: Central California Coast.
Posts: 5,383
|
Quote:
This is why the first thing about FETs is their maximum voltage blocking. The second is the voltage at which they turn ON at. And the third is the gate capacitance that has to be charged and discharged every switch cycle. Look it up - it will be listed. Tell us what it is. |
|
10/09/2010, 06:59 PM | #15 |
Registered Member
Join Date: Mar 2009
Location: Brazil
Posts: 250
|
The FET is an IRLR/U014NPbF from International Rectifier.
Input Capacitance = 265pF Output Capacitance = 80pF Reverse Transfer Capacitance = 38pF (the three parameters above at conditions Vgs=0V, Vds=25V, f=1Mhz) Turn-On Delay Time = 6.5ns Rise Time = 47ns Turn-Off Delay Time = 12ns Fall Time = 23ns (the four parameters above at conditions Vdd=28V, Vgs=5V, Id=6A, Rg=6R2, Rd=4R4) Thanks for the help! Snorkeler
__________________
Tank: 180L (46gal) 60cm cube DT visible from all sides with central overflow column, 10cm crushed coral base, LR, 79L (20gal) sump with skimmer, ATS and refugium. External jerrican DIY ATO. Livestoc |
10/09/2010, 11:18 PM | #16 |
Registered Member
Join Date: Dec 2007
Location: Central California Coast.
Posts: 5,383
|
OK, you take the 38pF and the 1k => 1000 x .000000038 = 38us
Almost double that and call it 50us turn ON and turn OFF. During this time the FET is in the linear region heating up. If you buy a larger than otherwise needed FET it probably won't matter. I would do 5V(Arduino drive) / 40mA = 125 ohms. This would drop the transition time down to: 125 x 38pF = 5us. Call it 8us. You need to put a pull-down resistor on each of those FET bases to ground. Otherwise the Arduino's output leakage current can turn ON a channel even when set low. Also, if while the Arduino is booting it floats the outputs, as almost all micros do, you can have things like FETs frying or the strings flashing. Use anything around 47k to ground. |
10/10/2010, 09:23 AM | #17 |
Registered Member
Join Date: Mar 2009
Location: Brazil
Posts: 250
|
Thanks kcress! Help like the one you provided is what makes ReefCentral such a great place.
The FET is rated for Continuous Drain Current @ 100oC Id=7.1A, and Avalanche Current Iar=6A. I'm planning on passing only 0.7A through it so I believe it qualifies for "larger than needed". Now that I'm planning on driving 5 FETs in parallel from one PWM Arduino output I have to limit each FET's current so they don't go over 40mA. Maximum current per FET gate would be 40mA / 5 = 8mA now. Super thanks for the pull-down resistor tip, I'll add a 47K to the circuit as you recommend. I would never have figured that one out by myself. Snorkeler (Fabio Paoli)
__________________
Tank: 180L (46gal) 60cm cube DT visible from all sides with central overflow column, 10cm crushed coral base, LR, 79L (20gal) sump with skimmer, ATS and refugium. External jerrican DIY ATO. Livestoc |
10/10/2010, 11:34 AM | #18 |
Premium Member
Join Date: May 2004
Location: Longmont, Co
Posts: 4,566
|
kcress,
"If you buy a larger than otherwise needed FET it probably won't matter." buying a FET that is much larger than required (whil OK) will result in a larger gate capacitance, resulting in longer switch on/off times. "You need to put a pull-down resistor on each of those FET bases to ground" you meant "gate" for the pulldown right? stu
__________________
Some people think that I have Attention Deficit Disorder. They just dont understand that........ Hey! Look a chicken! Well, We KNOW GOD exists, but for US to exist without a GOD is preposterous….Umm wait a minute…. Sounds a bit circular to me… Current Tank Info: 125 Gal. display w/80 gal mud/caulerpa sump. Basement sump w/ LED Grow Light,Gravity fed Reeflo200 skimmer w/ ORCA Recirc, DIY calc reactor & kalk stirrer. Inline plumbed 75 Gal frag/settling tank. |
10/10/2010, 01:31 PM | #19 |
Registered Member
Join Date: Dec 2007
Location: Central California Coast.
Posts: 5,383
|
|
10/10/2010, 01:44 PM | #20 | |
Registered Member
Join Date: Dec 2007
Location: Central California Coast.
Posts: 5,383
|
Quote:
5V/8mA = 625 ohms. 38pF x 625 = 24us switch time. Consider this. If you were to turn ON then OFF the FET faster than 48us you would probably never see the the LEDs come ON. 1/period = frequency 1/48us = 20kHz. So any switching faster than 20kHz will probably do nothing but heat the FET. If you sent out an ON / OFF pulse 49us long you would get an ON period of 1us. I hope your LED chain doesn't make noise. Whenever you electrically excite a system below 20kHz you run a chance of audible noise. I'll be interested if your's makes noise. |
|
10/10/2010, 04:03 PM | #21 |
Registered Member
Join Date: Mar 2009
Location: Brazil
Posts: 250
|
Yes, it is 40mA per pin, but I intend to user 2 pins to drive 10 FETs so there is where I see the 8mA limit.
Arduino's PWM frquency is around 490Hz, really very low. When I saw that figure I was concerned with noise production, but I haven't seen anyone using Arduino mentioning noise so let's see how it goes. After all pure 490Hz is audible! Snorkeler Sent from my Nexus One using Tapatalk
__________________
Tank: 180L (46gal) 60cm cube DT visible from all sides with central overflow column, 10cm crushed coral base, LR, 79L (20gal) sump with skimmer, ATS and refugium. External jerrican DIY ATO. Livestoc |
10/11/2010, 04:42 PM | #22 |
Premium Member
Join Date: May 2004
Location: Longmont, Co
Posts: 4,566
|
If you use a 10K pulldown on each FET gate, then each drive circuit will only pull 0.5mA (assuming 5V logic drive).
You can drive all 10 with just one output from the micro. If you use a 1K ( faster switch times ) you are still only pulling 5mA per FET. You can also look into FET driver chips. They have charge pumps that can source a large amount of charge very quickly. They are used to drive very high power FETs very fast. But dont try to drive a group of things using two outputs if you are anywhere near the max using one. Even though we think that microprocessors are fast, you may not be able to switch the state of two outputs "simultaneously" unless the write function can set two bits in the same output status register. Stu
__________________
Some people think that I have Attention Deficit Disorder. They just dont understand that........ Hey! Look a chicken! Well, We KNOW GOD exists, but for US to exist without a GOD is preposterous….Umm wait a minute…. Sounds a bit circular to me… Current Tank Info: 125 Gal. display w/80 gal mud/caulerpa sump. Basement sump w/ LED Grow Light,Gravity fed Reeflo200 skimmer w/ ORCA Recirc, DIY calc reactor & kalk stirrer. Inline plumbed 75 Gal frag/settling tank. |
10/11/2010, 08:37 PM | #23 |
Registered Member
Join Date: Dec 2007
Location: Central California Coast.
Posts: 5,383
|
You lost me stu.. He's going to use a 47k pull down which represents about 100uA of pull down. The pull down is inconsequential.
Yes he could certainly run more than one but he couldn't control string-2-string brightness that way. I doubt most people do actually run their strings of the same color at different brightnesses. Maybe a blue drive and a white drive? |
10/15/2010, 06:52 PM | #24 |
Registered Member
Join Date: Mar 2009
Location: Brazil
Posts: 250
|
I'm going to buy my resistors tomorrow and a question arose in my mind.... When I dimension the LED current limiting resistor should I do U=RI using the power source voltage as U, or, using the power source voltage minus the LED voltage drops as U?
Like, my LEDs are rated as 3.85V voltage drop. So, with a 12V power source and 3 LEDs in series and desired current 700mA should I make the resistor R=12/0.7=17R1 or should I make R=(12-3*3.85)/0.7=0R7? It seems to me that I should subtract the LED voltage drops from the power source to calculate the resistor, therefore R would be 0R7. Is that thinking correct? Thanks! Snorkeler
__________________
Tank: 180L (46gal) 60cm cube DT visible from all sides with central overflow column, 10cm crushed coral base, LR, 79L (20gal) sump with skimmer, ATS and refugium. External jerrican DIY ATO. Livestoc |
10/15/2010, 07:41 PM | #25 |
Registered Member
Join Date: Mar 2009
Location: Brazil
Posts: 250
|
OK, found the answer.... here: http://www.reefcentral.com/forums/sh....php?t=1751598
I should subtract LED voltage drops from power source, so my R would be 0R7. Also interesting to add a 1A fuse to the circuit. Thanks kcress for that thread!
__________________
Tank: 180L (46gal) 60cm cube DT visible from all sides with central overflow column, 10cm crushed coral base, LR, 79L (20gal) sump with skimmer, ATS and refugium. External jerrican DIY ATO. Livestoc |
Tags |
arduino, driver, led, pwm, transistor |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Question about LED fixture | cman_pogey | Lighting, Filtration & Other Equipment | 0 | 07/08/2010 03:06 PM |
Meanwell Current Question | ChrisOz | Lighting, Filtration & Other Equipment | 6 | 07/07/2010 09:37 PM |
Powering LEDs without drivers/buckpucks | mtcs | Do It Yourself | 22 | 06/25/2010 06:08 AM |
Meanwell driver wiring configuration question? | subpg | Do It Yourself | 2 | 03/18/2010 12:11 AM |
CREE XLED & LED Drivers Questions??? | DeathWish302 | Do It Yourself | 19 | 09/24/2008 11:01 AM |