Is mcu pwm a decent way to control a power led current?

I have a project whereby I am energizing a single 10W LED at 12 volts. I am controlling the current with a logic mosfet controlled by pwm from the mcu.

the questions are: Is it useful to put a capacitor in parallel with the led? The idea is obviously to get smoothing.

Another issue is to monitor current by the mcu. This is not absolutely necessary, but wonder if there is a trick to get this measure.

I am using an 18 pin picaxe, which is extremely easy to program.

thanks in advance. jb

Reply to
haiticare2011
Loading thread data ...

Above 100 Hz, flicker is not noticable. So forget the cap, it will cause more problems.

Cheers

Reply to
Martin Riddle

--
You're controlling the _average_ current.
Reply to
John Fields

I assume that a "10 W" LED is a white LED (voltage drop about 3 V) with absolute maximum current of 3 A, so some marketing people talk about 10 W LEDs.

If you really intend to run those LEDs at 3 A, you are going to have severe cooling problems, especially at higher environment temperatures. The phosphor life time is going to be very limited, perhaps only hundreds of hours, before the light output drops significantly.

Except for intermittent flashlight applications, for general lighting, the maximum usable current for these "10 W" LEDS is about 1-1.5 A, when you have chances of getting 50000+ hour lifetimes.

Unless dimming is required, I would suggest simply using three of those "10 W" LEDs in series at 1 A with a simple 2.7 ohm resistor to

+12 V. For the generated (long time) lumens vs. current consumption from 12 V, the result will be better, since the efficiency [lm/W] drops quite fast when going from 1 A to 3 A.
Reply to
upsidedown

Capacitors "smooth" voltages

Inductors "smooth" currents

I'd suggest a classic buck (series inductor), with no output capacitor, and control the loop by sensing current. ...Jim Thompson

--
| James E.Thompson                                 |    mens     | 
| Analog Innovations                               |     et      | 
 Click to see the full signature
Reply to
Jim Thompson

Do you have a current-limiting resistor in there, or an inductor? Or are you applying chopped 12V straight to the LED?

--
Tim Wescott 
Wescott Design Services 
 Click to see the full signature
Reply to
Tim Wescott

No just pwm to a logic mosfet - which switches a 12 V supply.

Reply to
haiticare2011
100 Hz is not fast enough to prevent visible flicker if there is any motion, even the motion of your eye, i suggest you go faster,

also ensure that the hardware design is such that the LED will be "safe" even if the uP decides to go to 0% or 100%, because if it can, it will at some point.

Mark

Reply to
makolber

good point. The pwm is automatic on th Pic chip, so I think khz frequencies easy.

Reply to
haiticare2011

the mcu.

viously

ecessary, but wonder if there is a trick to get this measure.

Thanks - now, given that the ADC likes to measure .5 volt, and the led drop s 12 V, then .5/1 amp => .5 ohm. jb

Reply to
haiticare2011

The higher the frequency you manage, the smaller the required inductance value. ...Jim Thompson

--
| James E.Thompson                                 |    mens     | 
| Analog Innovations                               |     et      | 
 Click to see the full signature
Reply to
Jim Thompson

= SMOKE ...Jim Thompson

--
| James E.Thompson                                 |    mens     | 
| Analog Innovations                               |     et      | 
 Click to see the full signature
Reply to
Jim Thompson

I got a few of these--

formatting link

Glancing, it appears to be a current-mode flyback converter, from discretes. HV MOSFET switch.

They'll need a little care, but don't look too terribly flammable at first inspection.

Cheers, James Arthur

Reply to
dagmargoodboat

LEDs are -- very roughly -- constant voltage devices, whose brightness you control by controlling the current through the LED. You really don't want to put voltage to an LED through a low-impedance source unless you really, really, really know what you're doing. You either end up with very little current because your applied voltage is too small, or you end up with way too much current because your applied voltage is too big.

If power savings is less important that circuit simplicity, put a resistor in series with the LED. Calculate the series resistance such that the LED consumes its maximum current with the supply at its highest possible voltage.

If power savings matters, use a buck converter as JT suggested. You'll probably have to monitor the LED current, or use a small dropping resistor, because while the LED roughly dictates its voltage, that voltage varies over temperature and with each individual LED.

I don't know the physics of the LED phosphor degradation, but if the rate of phosphor degradation is more than linear with light intensity, then the dropping resistor and PWM scheme won't save your phosphor, because the LED will come up to the maximum (phosphor-damaging) brightness each time; it'll just be your eyes that average it out.

--
Tim Wescott 
Wescott Design Services 
 Click to see the full signature
Reply to
Tim Wescott

Heartily agree!

One should *never* depend on software alone, to assure the safety of system components (or of the user). It's far better to design a layer of hardware safety into the system, to provide robust limiting or shutdown if software (or the system user) does something egregiously stupid. Current-limiting resistors, zeners, "hard" limit switches, crowbars, etc... the more expensive it is to repair the system (or deal with a human's injuries) the more sense it makes to make the design as hardware-fail-safe as you can.

(And I'm speaking as a software weenie with a fair bit of experience in embedded-system and microcontroller-based project design.).

Reply to
David Platt

I believe that's what's often referred to as a noise-emitting diode. They're good for one loud "CRACK!" each.

Even with a current-smoothing inductor in place, this is a recipe for failure.

Reply to
David Platt

You'd have to approach the whole current-smoothing business with care, for sure. A boost topology with guaranteed-discontinuous operation may do it, but -- why bother?

--
Tim Wescott 
Wescott Design Services 
 Click to see the full signature
Reply to
Tim Wescott

The PWM needs feedback to ensure stable current control. Can a uP emulate a feedback loop? ...Jim Thompson

--
| James E.Thompson                                 |    mens     | 
| Analog Innovations                               |     et      | 
 Click to see the full signature
Reply to
Jim Thompson

You measure the current at a particular fixed point in the PWM cycle (such as shortly after turn-on) - that gives you a solid feedback for regulation.

For an LED, you do not want constant current unless you actually require continuous light (such as for lighting when filming). You want PWM fast enough to avoid any sort of flicker (100 Hz is often enough, but 200 Hz is safer). The eye will perceive a 20% duty cycle as being about the same brightness as 60% steady state current - meaning you can save two thirds of your power by using PWM without any sort of smoothing. It also means that you will get only one third of the heating in the LED for the same brightness, and (depending on reliability and lifetime requirements) can mean you can overdrive your LED with higher peak currents will keeping a lower average current.

The microcontroller here (a PIC) is brain-dead monstrosity to work with and far more expensive than far better modern chips, but it is still perfectly capable of such PWM and regulations.

Reply to
David Brown

That depends on how you define "emulate" -- but with an ADC it can sure _implement_ one. I'm doing that with a motor controller right now, in fact.

But, some points:

First: I'm not sure if I'm tongue-in-cheek here, or if I'm thinking in terms of minimalist hardware, or what. So don't think I'm married to this whole idea.

Second: I stipulated a boost with a duty cycle that guarantees discontinuous operation for a reason: because as long as the coil current is discontinuous, the output impedance will be high, or at least the thing won't be super-stiff in voltage. There will be _some_ current dependence on the output voltage, but it won't be huge (I think), and the more discontinuous you let the current be, the higher the effective impedance (I think).

If a situation arose where the current _did_ become continuous in the coil, then you'd probably let the smoke out of _something_. The situation may not end up being an entirely unmitigated disaster, but it may not be far from it -- so I would suggest not allowing that to happen.

Third: You don't need active control to achieve discontinuous operation after startup. You just need to keep the ratio below the ratio of the LED forward drop over the supply voltage. For startup you can either say "what the hell" and let it happen (because it'll stop once the output cap gets charged up), or you can ramp up the duty cycle.

Here's an LTSpice netlist, showing what I've thrown together to demonstrate the concept. I'm sure that there's many things wrong with it, but it does show that you can get a pretty good relationship between LED current and duty cycle, without having a hyper-critical "it'll blow up in your face" situation unless you get way too enthusiastic with the duty cycle:

Version 4 SHEET 1 900 680 WIRE 560 80 64 80 WIRE 704 80 560 80 WIRE 0 160 -32 160 WIRE 64 160 64 80 WIRE 64 160 0 160 WIRE 80 160 64 160 WIRE 208 160 160 160 WIRE 240 160 208 160 WIRE 352 160 304 160 WIRE 384 160 352 160 WIRE 560 176 560 80 WIRE 704 176 704 80 WIRE -32 208 -32 160 WIRE 208 224 208 160 WIRE 160 304 96 304 WIRE 96 336 96 304 WIRE 384 336 384 160 WIRE 560 336 560 240 WIRE 560 336 384 336 WIRE 704 336 704 240 WIRE 704 336 560 336 WIRE -32 448 -32 288 WIRE 96 448 96 416 WIRE 208 448 208 320 FLAG 96 448 0 FLAG -32 448 0 FLAG 208 448 0 FLAG 0 160 Vsup FLAG 352 160 Vled SYMBOL ind 64 176 R270 WINDOW 0 32 56 VTop 2 WINDOW 3 5 56 VBottom 2 SYMATTR InstName L1

SYMBOL cap 576 240 R180 WINDOW 0 24 56 Left 2 WINDOW 3 24 8 Left 2 SYMATTR InstName C1

SYMBOL LED 720 240 R180 WINDOW 0 24 64 Left 2 WINDOW 3 24 0 Left 2 SYMATTR InstName D1 SYMATTR Value LXK2-PW14 SYMATTR Description Diode SYMATTR Type diode SYMBOL schottky 240 144 M90 WINDOW 0 0 32 VBottom 2 WINDOW 3 32 32 VTop 2 SYMATTR InstName D2 SYMATTR Value 1N5817 SYMATTR Description Diode SYMATTR Type diode SYMBOL nmos 160 224 R0 SYMATTR InstName M1 SYMATTR Value AO6408 SYMBOL voltage -32 192 R0 WINDOW 123 0 0 Left 2 WINDOW 39 0 0 Left 2 SYMATTR InstName V1 SYMATTR Value 12 SYMBOL voltage 96 320 R0 WINDOW 123 0 0 Left 2 WINDOW 39 0 0 Left 2 SYMATTR InstName V2 SYMATTR Value PULSE(0 12 100n 1p 1p 500n 5u) TEXT -66 472 Left 2 !.tran 1m

--
Tim Wescott 
Wescott Design Services 
 Click to see the full signature
Reply to
Tim Wescott

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.