Can a capacitor be used to smooth PWM?

That depends on what factors you have used, i.e. what current you are assuming the led are getting and how much the voltage are allowed to vary. If you say 200mA (Remember we are not talking high mode) and 0.1 volt, the capacitor is 10000uF at 200Hz

Thank you DrJones and HKJ. Both of your numbers sound pretty big for a flashlight. I was just hoping to round off the corners a bit on the wave and then see if I noticed it in the light quality. I picked up a cheap used oscilloscope recently, but still need to get leads for it. I may have to play with around with it anyway, but at least my hopes won’t be unrealistic going into it now.

Thank you for your input.

Ahhh! So many things to comment on, no time… head exploding! :slight_smile:
Later on tonight I have many responses.

I actually tried this a few months ago, and the largest capacitor I ended up testing was a 2200uF, which was already way too big to fit in most flashlight heads. (It might fit in a SRK head.)

Although it made a slightly noticeable difference, it certainly wasn’t substantial, and nowhere near good enough. It also introduced some very strange additional problems when attempting to cycle modes.

Testing was done on a Shadow Mini T6, which I love, but I hate the PWM. (I need to do a driver swap.)

This appears to be the identical capacitor I was using:

I suppose this just confirms what DrJones and HJK said… you need a BIG capacitor.

That’s why I mentioned it wouldn’t fit in most small heads. Also the capacitor is potentially back feeding the driver during PWM off, depending on how it’s designed, which probably accounts for the mode switch anomalies you observed. You could try adding other buffering components, but that creates more loss and power handling problems when full on.

If it were that simple to smooth out the PWM flicker, I think circuit designers would’ve gone that way long ago.

KuoH

My LED analyzer device (Any interest in a LED/Battery analyzer device?) has a big MOSFET on it that is driven by a PWM signal (16 kHz, 10 bit resolution) that can PWM the battery input power to the LED/load output connector. It acts like a buck converter. The control software allows it to generate a constant voltage, current, or power to the load or charge lithium batteries. These operating modes require a filter cap to be installed across the load to smooth out the PWM pulses. I have been using a 1000 uF cap for most applications. Looking at the cap voltage on a scope shows a few percent overshoot when the PWM pulse turns on.

Note that if the battery input voltage is quite a bit higher than the desired load voltage, the PWM pulse width gets too small to get fine control from. For instance, if you wanted to charge a 4.2V Li-ion cells from a 12V input, the required PWM pulse width drops to around 2. With a 5V source it uses around a 50 pulse width.

Playing with some standard LED drivers, most don’t like having their outputs filtered. This is particularly true of switching type drivers.

Is there a catch-all explanation for this?

Yeah, they weren’t designed for driving capacitive loads.

Thanks for the info; it makes sense when you put it that way. Now, to go look into the math. I need to play around with the idea in order to actually grasp it fully.
Edit: I understood that output with parallel capacitor behaves like the plot below (courtesy tpub.com):

versus:

though after some reading I’m not able to deduce parameters under which a switching regulator would not ‘like’ their output being filtered. I do want to know, so I guess I’ll chat up my prof about it.

It has been a long time since I have had to think about this stuff. It seems to me that because the driver for an LED acts like a current source, we must take that into consideration. An ideal current source acts as though it has in infinite internal resistance. On the other hand, an ideal voltage source acts as though it a an internal resistance of zero. It seems to me that placing a capacitor across the load is going to behave in 2 entirely different ways, depending if the load is connected to a current source or a voltage source.

For a simple PWM controlled Constant Current Linear Driver (NANJG or pretty much any AMC7135 style driver) running at low-ish speed PWM Frequency (say 200 Hz), it would take a boat-load of cap to do anything useful…

Graph shows current with a 50% duty cycle at 200 Hz. Load is a (very close to) correctly simulated XM-L emitter.

No Cap.

100uF zero ESR

1mF zero ESR

10mF zero ESR

100mF zero ESR

100mF 7.2mOhm ESR ( Mouser Part Number 36DY104F025BF2A )

In short - absolutely not worth it. The size of cap you can fit in a flashlight won’t make a hill of beans difference. You’d either need a monster cap or the PWM frequency would have to be two or three orders of magnitude faster…

PPtk

A parallel capacitor will not act like that on a linear or (most) switching drivers. That plot shows sinusoidial AC input - the graphs of LED current look nothing like that when driven from a constant current DC source…

PPtk

Did you do those plots in PSpice, or…?

I used a ‘stripped down’ Spice program called 5Spice. Its rubbish for big simulations with complex circuits, but its far simpler to setup than the full blown sim packages for less critical stuff like this…

PPtk

OK, it looks like things are well covered here now. Thanks PPtk for the sims, very nice.
The only thing I want to add is the thing about the cap on the back of a NANJG. That has no effect on the output. It’s referred to as a decoupling capacitor. It’s purpose is to filter out noise and transients on the Vcc of the MCU (Tiny13A). It’s probably a 1uF capacitor. Without it, strange behaviour can be expected from the MCU.

Actually, it and the diode are used to keep the CPU powered when you click the switch when changing modes.

It could be used for that, but they chose to use on time instead of off time… maybe they needed too large of a cap to make it work?

No, it does not keep the MCU powered throughout a half-press, it’s capacity only suffices for a rew milliseconds.

Linear drivers can PWM as fast as 20kHz and I was thinking of using capacitor to take advantage of leds better efficency at lower currents.
As we all know led shines brighter at 0,5A than at 1A with 50% duty cycle.

How about an ultracapacitor?

http://www.ebay.com/itm/8PCS-0-33F-5-5V-KAMCAP-Coin-C-Super-Capacitor-Memory-Backup/261212647729?ssPageName=WDVW&rd=1&ih=016&category=4662&cmd=ViewItem

0.33 Farad, 13mm by 5mm… small enough to fit in most big torches.