I've seen many motors having capacitors attached in parallel in bots. Apparently, this is for the "safety" of the motor. As I understand it, all these will do is smoothen any fluctuations--and I doubt that fluctuations can have any adverse effects on a motor. Apparently these protect the motor if the shaft is being slowed/blocked, but I fail to see how.

What exactly is the function of such a capacitor? What does it prevent, and how?


2 Answers 2


Capacitors are used with motors in two different ways. Sometimes the same motor will have both techniques applied, and be associated with two significantly different-looking capacitors.

  • When motors with brushes are running normally, the motor brushes produce sparks, which cause noise "from DC to daylight". This has nothing to do with PWM -- it happens even when these motors are connected directly across a battery, without any PWM. If we did nothing, the cable running from the electronics board (or directly from the battery) to the motor would act like an antenna, radiating TV and other radio interference. One way people fix that problem is to attach small ceramic capacitors directly to the motor to absorb much of that noise. b c d e

  • When using PWM to drive the motor, when the transistors turn "on", the motor may pull a current spike / surge current -- the above noise-filtering capacitors make that current spike worse. When the transistors turn "off", the motor inductance may cause voltage spikes from the motor inductance -- the above noise-filtering capacitors help a little. More complex filters attached directly to the motor can help these two problems. a b

  • When a motor -- even a motor that doesn't have brushes -- is first turned on at a dead stop, and also when the robot hits an obstruction and stalls the motor, the motor pulls much higher currents than it does in normal operation -- currents that may last for several seconds. This high current may pull down the battery power rail enough to reset all the digital electronics in the system (or perhaps reset just some of the digital electronics, causing half-brain syndrome).

    One work-around has 2 parts:

    1. add large electrolytic capacitors directly across the battery (or across the battery input to the PWM motor driver, or across the battery input to the digital electronics, or often capacitors in all three locations) -- these capacitors work better at supplying high currents for a few milliseconds than the battery does.
    2. In the few milliseconds we have before the stalled motor pulls all the energy from those big capacitors and then pulls the power rails low enough to start resetting things, program the digital system to somehow recognize that the motor has stalled and kill the power to that motor. Then that motor no longer drags down the power rail, and the digital electronics and all the other motors continue to operate normally. ("soft-start", "current-limiting", "torque-limiting", etc. are more sophisticated forms of this idea). (Those big capacitors, also absorb some of the energy that comes out of the motor when the PWM turns "off", and later put that energy back into the motor when the PWM turns "on").

The above capacitors protect other things from the motor's electrical interference. I suppose one could argue that step (2) above prevents a stalled motor from eventually, after many seconds, overheating and failing -- but that's not really its primary purpose.

  • 1
    $\begingroup$ This is another good explanation of what happens when the motor turns off, scroll down to "main capacitor": 4qdtec.com/pwm-01.html $\endgroup$
    – Ian
    Commented Dec 2, 2012 at 14:15
  • 1
    $\begingroup$ @Ian: Thank you. The inductance of battery wires is something my answer completely overlooks, but as that link points out, is not negligible. $\endgroup$
    – David Cary
    Commented Dec 2, 2012 at 18:05

The capacitor seen on a lot of brushed motors is there to absorb RF noise due to the arcing as the brushes commutate. You often see these on the motors used in RC cars, where the motors are fairly powerful and spinning fast.

The problem comes when you are using PWM to drive the motor. At the beginning of the duty cycle, when the current is switched on, you'll see a current spike as the current rushes into the capacitor from the H-Bridge. This inrush current can sometimes cause noticeable voltage ripple at the power supply, adding noise into any sensitive analogue sensors.

To prevent the inrush current, you can add a pair of inductors between the H-Bridge and the capacitor. This will hold the current fairly steady. Actually, you'll often see inductors on motor drive circuits anyway. Even though the motor itself is an inductor, it's often quite a low inductance, so extra inductance is added to help smooth out any current fluctuations when using PWM drive.

The capacitors have nothing to do with protecting the motor in the case of a stall. When the motor stalls, the current increases and you risk overheating the motor.

  • 1
    $\begingroup$ +1 for the last paragraph especially. $\endgroup$
    – Ian
    Commented Dec 3, 2012 at 18:02

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.