Electronic – How to configure an analog filter(s) to maximally smooth out a 100 Hz PWM signal from a LED controller


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.

Best Answer

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.