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 a motor?

enter image description here

My parameters:
Motor: DC 5V; 0.82W; 180 mA (with PWM up to 200 mA)
PWM with 70%-100% Duty Cycle
Vdd = 5V = Vmax
PWM: 20kHz

f = 1/20kHz = 50 μs
The load requires a burst of 0.2A without reducing the voltage across it than 4.9 V for 50 usec
Vpp = Vmax - Vmin = 5V - 4.9V = 0.1 V
C1 = (I*f)/Vpp = (0.2 [A] *50 [μs]) / 0.1 [V] = 100 μF

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.

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


2 Answers 2


C1 should be large and close to the motor load or at least close to the MOSFET.

In this way, the current drawn by the motor will be supplied by the large capacitor C1.

In your calculations use the Ton of the duty cycle instead of the frequency.

It's not quite correct using the frequency because your motor draws current during Ton.

I = C * (dV / dt)

once expanded:

C = (I * Ton) / ΔV

That will increase the value of C1 with respect to your calculations.

After calculating the value of C1, I suggest you to increase it by at least 30%.

I also suggest you to use an Aluminum electrolytic capacitor type.

Pick one that stands a maximum voltage value of at least 16 Volt: the higher the better in terms of filtering.

The best manufacturers are: Panasonic, United Chemicon, Rubycon, Vishay, Epcos, Kemet.


  • \$\begingroup\$ I'm using PWM with 70%-100% duty cycle. \$\endgroup\$ Commented Apr 28, 2021 at 17:19
  • \$\begingroup\$ I wouldn't use the diode. \$\endgroup\$ Commented Apr 28, 2021 at 18:30
  • \$\begingroup\$ Calculation values: PWM frequency 20 kHz, duty cycle 70%, load 0.2A. My calculations: C=(I*Ton)/ΔV; Ton=period * duty cycle= 1/20000*0.7=35μs; C=(0.2A*35μs)/0.1A=70μF , Is my calculation correct? \$\endgroup\$ Commented May 2, 2021 at 14:21
  • 1
    \$\begingroup\$ Yes, it's correct. I would use 330 uF at least. Motor filtering is one of the toughest problems when designing digital + motor circuits. \$\endgroup\$ Commented May 2, 2021 at 15:10
  • 2
    \$\begingroup\$ I quit using using tantalum capacitors in 2002 for many reasons. I use aluminum electrolytic SMD or TH capacitors. I would use 220/10 V because 6.3 V is too close to 5 V. Make room for 2 capacitors in parallel in case you need to increase the value of X. \$\endgroup\$ Commented May 2, 2021 at 21:31

If the goal is to reduce the ripple on your microcontroller, I recommend that you protect your microcontroller from the high current draw by the motor.

You can do so using a diode that prevents current flowing from the capacitor dedicated to your microcontroller back into the motor:


simulate this circuit – Schematic created using CircuitLab

Your motor will still suffer from voltage variations, but your microcontroller not so much and your capacitor can be smaller than the one you would need to cover the voltage variations from your motor. The question did not request to reduce the ripple on the motor.

It is also likely that your regulator jumps in at some point to regulate the voltage back to the expected level even while the motor is on. This could mean that the voltage drop is not as long as the \$T_{on}\$ time of your motor.

You can make an estimate of the capacitor value once you estimate the maximum current (I) of your microcontroller.
You also need to estimate the time (T) during which the power voltage drop is unacceptable. That time may correspond to the \$T_{on}\$ time of your motor plus the time your power regulator needs to recover from the power drop, or less if your regulator needs at most 20ms for instance and your \$T_{on}\$ time is much higher than that.

Finally you need to settle on the maximum voltage drop (\$V_d\$) you accept on your microcontroller - possibly 0.05V or even more if you can accept a higher drop.

The capacitor to limit your microcontroller voltage variations has to be \$C=\frac{I}{t.V_d}\$ determined as indicated above when the diode is added.

If you do not add a diode, the current \$I\$ also includes the motor current. The considerations with regards to how good your voltage regulator reacts to varying loads will still impact your considerations about the time \$t\$.

Using a scope to visualize your current voltage drop will help you to get an idea about different factors, but remember that a datasheet will provide the guaranteed limits (delay, current, etc).

  • \$\begingroup\$ I can't get involved in inner build a circuit. I have only two pin +5V and GND, and GPIO 3.3V. \$\endgroup\$ Commented Apr 28, 2021 at 17:28
  • \$\begingroup\$ Your schematic is not showing the uC. If your uC is already on a board "with" the motor, depending on your issues you could still cut power trace(s) going to the uC and put a diode in between that. \$\endgroup\$
    – le_top
    Commented Apr 28, 2021 at 20:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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