Electrical – How to calculate size of filter capacitor for microcontroller that has changing loads on its 5V supply

capacitorpassive-filter

How do I calculate the size of a filter capacitor to reduce the ripple when I have a microcontroller on the same regulated power supply as a high current load like an LCD strip or a motor controller? (I'm aware of the need to use flyback diodes on inductive loads.)

If I'm building a power supply that rectifies AC and filters it, there are lots of articles out there that describe how to calculate the size of the filter capacitor, e.g.: https://makingcircuits.com/blog/calculate-filter-capacitor-smoothing-ripple/

The formula for that is C = I / 2 x f x Vpp, where I is the load current, f is the AC frequency (usually 50 Hz or 60 Hz, and Vpp is the allowable ripple.

All the searches I've done lead me to articles about filtering ripple on AC power supplies.

However, I'm not trying to smooth ripple from a rectified AC supply. I'm trying to smooth out variations in an already regulated 5V supply as the load to the supply changes.

Say, for example, I have a regulated 2A 5V supply that's driving a 1.5A LED array AND an Arduino-based system that draws ≈200mA. I am feeding the 5V from the supply into the Arduino, and also using it to drive the LED array. I'm under the 2A limit of the regulated supply, with a little "wiggle room", but concerned that as the LED array turns on and off, it will cause droops and spikes in the regulated 5V supply as the power supply lags slightly in adjusting the output voltage for changes in load.

Assume the Arduino can tolerate ±0.5V on it's 5V supply. I imagine the LED array's load spikes are going to be nearly instantaneous, like switching on and off a resistive load. (Assume the 5V supply is a typical switching supply. I don't know how to estimate its max voltage variation under changing load, or recovery time, and need help with that bit.)

How do I calculate the rating of a filter capacitor to put on the 5V rail that feeds the Arduino to smooth its input voltage as the load to the power supply changes?

Best Answer

Here is a first order calculation, ignoring cap ESR and other secondary effects. And assuming that your switching regulator is already chosen, and it is a budget off-the-shelf module. If you are doing a rigorous design from scratch, use Sunnyskyguy's answer.

\$ v = \frac 1 C \int i dt \$

If i is a step from one constant current to another, we can simplify:

\$ \Delta V = \frac{I_{step} \Delta T}{C} \$

Solving for C:

\$ C = \frac{I_{step} \Delta T}{\Delta V} \$

I is the current step, delta V is the allowable voltage sag. Delta T is the regulator recovery time from a step current change, i.e. how long the cap needs to hold-up the voltage until the regulator closed-loop recovers.

Example: I = 1.5 A, delta V = 0.5 V, delta T = 1 mS

The regulator dynamic recovery time is usually not going to be included in a budget regulator data sheet. And if it is, it may be specified another way. 1 mS is a wild guess, you need to measure it by applying a step current change and looking at the voltage with a scope.

C = 1.5 * 0.001 / 0.5 = 3000 uF

A Rubycon YXJ 3300 uF, 16 V, has an impedance of 0.032 ohms, this is small, but not quite negligible for this application. 1.5 A * 0.032 ohms will add another 48 mV to the sag.

And remember, this is an approximation, we don't know what is inside the switching regulator, it already has capacitance included, most likely small compared to 3300 uF if it is a modern high frequency converter.