I have an RGB LED controller which controls the brightness using a 100 Hz PWM, seemingly without any built-in smoothing at all. (recorded it with a soundcard, and those pulses are 100 percent rectangular. :)

I want the resulting voltage coming to LEDs to be as flat as possible, using a custom built filter/simple scheme, which should not be too expensive (otherwise it makes more sense to buy a better controller in the first place).

The LEDs are going to be used for lighting, so the filter should be ready for pretty high power (~100W max).

How should I go about configuring such a filter? Should I use an RC or LC filter? Just one or a series of filters? How do I decide on the electronic properties of the elements (capacity, inductance, etc.)?

UPD: by "as flat as possible" I mean as close as a simple, cheap-ish filter system based on usual components is going to get me. A 99.99% flat line is NOT a requirement! Just a filter that will smooth it out as best it can.

  • 1
    \$\begingroup\$ Given your power requirements, and the frequency of the pulse, why do you want to filter it heavily? Maybe a little smoothing may help, but a heavy smoothing will waste a lot of power that has to be dissipated in your components, which will need higher power ratings. Are you really sure? \$\endgroup\$ – clabacchio Mar 29 '12 at 14:57
  • \$\begingroup\$ Yep :) I want to maximally reduce flickering, even if the system will eat up some power. (Of course in sane limits, if it is going to take 10x more, that won't even work with the power sources I have available.) As for practical reasons, a 100 flickering is still pretty easy to notice, especially when moving the sight, plus that I want to be able to record video in that room, and with any decent fps a 100 hz flickering is just going to destroy the video. \$\endgroup\$ – Cray Mar 29 '12 at 15:07
  • 2
    \$\begingroup\$ Can't you raise the frequency of the PWM? To avoid the flickering, you need a quite heavy filter then... \$\endgroup\$ – clabacchio Mar 29 '12 at 15:08
  • \$\begingroup\$ Yeah, that would be great, and raising it enough probably would even eliminate all needs for filtering, but I cannot do it with this particular controller. \$\endgroup\$ – Cray Mar 29 '12 at 15:14
  • 2
    \$\begingroup\$ @Cray: So get a controller that can. It seems you are letting the tail wag the dog. \$\endgroup\$ – Olin Lathrop Mar 29 '12 at 15:41

A better question would have been, "How do I reduce the flicker when controlling brightness of LEDs?" So that's the question I'm going to answer... :)

There are two ways to control brightness of LED's: PWM or a constant (but variable) current power regulator.

You have a PWM controller. The problem is that you are wanting to somehow convert a PWM controller into a constant current controller. While possible, it quickly turns into a square-peg-round-hole kind of problem. It could be done with an LC filter (don't use an RC at these power levels), but if you do it wrong then you could blow up your LED controller or negate any effect of the dimmer control.

The obvious thing, as other have suggested, is to bump up the PWM frequency from 100 Hz to something higher. 500 Hz would be a good target. As you go to a higher frequency the less efficient things become. Also, switching 100 watts at higher speeds can cause issues.

If your LED controller can't go faster, as you indicated, then you are really stuck. Your only option then is to throw out the LED controller and get/buy/build a new one. If you do this then you have the choice of getting one with a faster PWM rate or a constant-current type LED controller.

A constant current regulator is just like a voltage regulator-- except that it regulates current and not voltage. For 100 watts you would need a switching regulator type to keep the efficiency high. While not as common as a normal voltage regulator, current regulators are common enough that a quick look at various chip makers web sites should get you the info you need. I like Linear Tech for this sort of thing because their stuff is easy to simulate before you build it. Their simulator, LTSpice, is a free download.

Update, on why using an LC filter isn't practical...

Ok, let's start by saying that you just put a cap on the PWM signal. What's going to happen is that cap will completely charge when the PWM is on, and discharge into the LED's when the PWM is off. If you don't control the rate at which the cap is charged then all you are doing is increasing the PWM duty cycle. The bigger the cap the more you'll extend the duty cycle.

But here's the killer: There is a threshold to cap size. If the cap is smaller than this threshold then you are doing nothing to eliminate the 100 Hz flicker. If larger then you've removed the flicker but you've also eliminated any dimming ability of the controller since you've extended the duty cycle to 100%!

And another killer: The caps are going to be charging to near 100% when the PWM is on. This is going to put a huge load on your LED controller. Your controller will need to be rated for 5 or 10 times the wattage of what the LED's themselves actually consume.

Putting an inductor in there, making an LC filter, will help both of these problems (allowing for dimming and restricting the current going into charging the caps). You'll still need a controller rated for more than what you need, but it won't be 10 times more.

The problem with an inductor is that you need a HUGE one. I did some calculations and you'll need something like a 5,000 uH inductor and a 10,000 uF cap. This is assuming 100 volt PWM at 1 amp max, your setup might be slightly different. But these values get you at least in the right ballpark.

Have you tried to buy a 5,000 uH inductor that can handle 1 amp? It's hard! You'd probably have to build one yourself. Looking in the Digikey catalog I saw several at 2,000 uH that could work, but none at 5,000 uH. Of course you could use several in parallel.

Next comes the cap. For this setup you want 160v caps, or even 200v. I couldn't find a cap of 10,000uF at that voltage, but it is easy enough (and common) to use several in parallel. One I saw was 2,700 uF, 200v, and was 50mm tall by 30mm in diameter and cost US$6/each. You'll need four.

After all this, you might need a big diode between GND and the input side of the inductor. If there is any weird inductive kickback going on then this diode will help protect your LED controller from damage.

So it is possible to do this, but it will be big, expensive, and even if you get it "right" then there is still no guarantee that it'll work as good as a proper LED controller. It's possible that your LED controller just isn't designed to operate with such an inductive load on it and will end up not working right or dying entirely.

  • \$\begingroup\$ Thanks, but this is not the question I have asked ) I want to know about how to do this with a filter. \$\endgroup\$ – Cray Mar 29 '12 at 18:23
  • \$\begingroup\$ @Cray The answer is, "Don't use a filter". Really. It's not going to work well, if at all. \$\endgroup\$ – user3624 Mar 29 '12 at 19:03
  • 1
    \$\begingroup\$ @Cray While RC and LC filters are used for this sort of thing, they are not used as much for this SIZE of thing. Just because your toy truck works just like the big trucks doesn't mean you can move your house with it. I added stuff to my answer to address this. \$\endgroup\$ – user3624 Mar 29 '12 at 20:37
  • 2
    \$\begingroup\$ @Cray, the capacitor does not generate any power, but it loads up quickly when the PWM is on (drawing way more current than normal) and releases it when the PWM is off. If you have a really large capacitor, a very low resistance and a power supply that can handle the current draw, it would remove the dimming ability completely. \$\endgroup\$ – drxzcl Mar 30 '12 at 11:59
  • 1
    \$\begingroup\$ @Cray A lower voltage helps with getting the right caps, but doesn't help the inductor. Let's say you have 50 watts total at 12v. That's 4 amps. Divide by 3 for the RGB and you're down to 1.333 amps. This doesn't change the inductor value, but you now have to find an inductor that can handle 1.333 amps instead of 1.0 amps. So you're actually worse off than my assumptions. \$\endgroup\$ – user3624 Mar 30 '12 at 13:48

It won't work.

LED brightness is linear with duty cycle. It is NOT linear with voltage. If you lowpass filter your PWM output, you'll get a voltage which is less than the turn-on voltage of the LED, and it will not turn on at all. And even if the duty cycle is high enough that the filtered voltage turns on the LED, you'll lose brightness control. The power emitted by an LED varies very rapidly with only a tiny change in voltage.

You can not effectively control LEDs by varying a flat voltage.

  • \$\begingroup\$ Good point. How narrow is the voltage band that dims the LEDs without turning them off? Maybe there are some good graphs or literature about this? I am thinking of other ways to build the zero-flicker LED circuit now, as it seems that PWMing indeed has a lot of problems with this. \$\endgroup\$ – Cray Aug 6 '12 at 21:51
  • \$\begingroup\$ @Cray: It's the exponential current-voltage relationship common to all diodes. You'd have to refer to the specific datasheet for your particular diode to get actual numbers. \$\endgroup\$ – Ben Voigt Aug 7 '12 at 3:44

LEDs are driven with PWM. Thats just how its best done. You'll get a worse dimming curve if you try to drive them another way. Filtering PWM is great for other applications, its how PSUs are made, but as David keeps telling you, not appropriate for LEDs.

If you have a problem with LED flicker, i would look into:

1) The stability of the power supply (especially to the MCU)

2) The pwm frequency. set a higher one.

3) The code on the microcontroller.

although i imagine you're not able to reprogramm your LED controller, or you wouldnt be asking this. Might i suggest you get an arduino or similarly accessible MCU so you can play with this stuff properly?

  • \$\begingroup\$ Is the sinusiodal form of the signal (as opposed to square one on the output of PWM) the reason filtering can be effectively used for PSUs but not for PWMs? In that case, would a variable transformator (from 220/110) + filtering be a good choice for the absolute least flickering? Also, could you recommend a good high frequency PWM controller? How high can frequencies get on those? \$\endgroup\$ – Cray Jul 25 '12 at 20:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.