I'm planning to power the circuit from a micro usb charger rated 1.8A. The peak current for the circuit is 1.5A but if the charger is not providing enough current I can use PWM with e.g. a 50% duty cycle, then the average current should be 0.75A (half of 1.5A).

I suppose to average out the current so that to the supply it looks like a constant 0.75A I need a capacitor. Provided the PWM is at approx 1.5KHz with 320uS ON and 320uS OFF and the voltage is 5V what type and value of a capacitor should I use on the input (preferably a smaller size)?

## Best Answer

Some entering notes:

Rough behavioral model might look like:

^{simulate this circuit – Schematic created using CircuitLab}You are worried that \$R_s\$ is large enough that the voltage from the USB power source will droop too much under full load. You'd like to add a capacitor to supply additional current to your LED controller IC and PWM so as to lower the average current draw to something the USB power supply can handle.

The equation for the capacitor, in general, is:

$$C = I_C \frac{\Delta t}{\Delta V_C}$$

In this case, your USB power source is continually supplying current to the IC and to \$C_1\$. But your controller is, we assume, pulling more current than the USB source can provide during the ON times.

A minor problem is that you don't know \$R_s\$, but are just worried about it. In reality, the USB power source will be supplying current (some) all the time, even while the LED controller is ON. Just not enough.

So let's assume it can supply half the current needed during ON times. Then during this time the current from the capacitor will also be half. You've mentioned that you want to be certain of \$1.5\:\textrm{A}\$. So this gives us a value for \$I_C\$ when the LED controller is ON: \$I_C=750\:\textrm{mA}\$. With a PWM frequency of \$1.5\:\textrm{kHz}\$ and a duty cycle of 50%, the ON period will be \$\tfrac{1}{3}\:\textrm{ms}\$. So we have an approximation for the period where the capacitor is supplying current and its voltage starts drooping: \$\Delta t=\tfrac{1}{3}\:\textrm{ms}\$. The only remaining problem is the allowable droop of the voltage at the LED controller IC. Let's assume that this should be no worse than \$200\:\textrm{mV}\$. (You can choose other acceptable values, though.)

Then the capacitor should be:

$$C = 750\:\textrm{mA} \frac{\frac{1}{3}\:\textrm{ms}}{200\:\textrm{mV}}= 1250\:\mu\textrm{F}$$

Make it the next size bigger, I suppose.