My question is about the correct way to add a capacitor to a circuit with a Raspberry Pi driving a servo.

I have seen undervoltage events in the logs of my app when the servo runs so I added a 470uF/25V capacitor as instructed e.g. here, but the undervoltage events still occurred.

So then I tried replacing the 470uf capacitor with a 1000uF/16V one and noticed it was very hot and the end seemed to be bulging out slightly so I immediately (and carefully) removed it. I did not notice that issue with the 470uF capacitor.

I didn't take any pictures either time, but I was careful to attach the negative pin to ground (black) and the positive side to 5V (red). Both capacitors had the negative side marked on the body and that lined up with the shorter lead.

So on the one hand, I think I did it right, but on the other hand the 470uF capacitor didn't resolve the issue and the 1000uF one clearly wanted to burn up, so maybe not?

Lastly, and this hopefully doesn't explain all my problems, I know servos draw too much power to be fed from the Raspberry Pi's 5V pin, so I am powering it by splicing into the USB wire that powers the Pi. It's plugged into a USB adapter (TROND G2U) that claims 2.4A per USB port. No other high-drain devices are plugged into the Pi so when I did the math it seems like I should have plenty of power to do this hack, other than the voltage drop at the moment the servo turns on.

So to confirm:

  1. I do want the negative pin for the capacitor wired to ground and the black wire on the servo?
  2. I do want the positive pin for the capacitor wired to 5V and the red wire on the servo?
  3. Is my USB splicing hack that I thought was so smart actually a terrible idea and somehow causing all my current problems?

I don't want to try again until I'm sure I'm doing it right so I don't destroy another capacitor, the Pi, the servo, the whole project, my house, etc. Any guidance would be greatly appreciated, even if it's to (politely) tell me how wrong I was on any or all of the above.


  • \$\begingroup\$ FWIW: you can look up electrolytic capacitor explosions on YouTube, they're a mess but unless it's a huge capacitor I don't think it'd do any damage to your house. \$\endgroup\$ – immibis Aug 27 '18 at 1:18
  • \$\begingroup\$ To draw more than 500mA from a USB port you need to talk nicely to it. \$\endgroup\$ – mlp Aug 27 '18 at 1:36
  • \$\begingroup\$ @mlp So apparently for a USB port to identify itself as a "dedicated charging port" and bypass the negotiation over how much current it should make available it is supposed to short the two data pins. I would assume my USB charger does this but maybe I need to short the data pins in the USB charging cable to enable my mutant cable to draw more than 500mA? \$\endgroup\$ – Joel P. Aug 27 '18 at 2:17
  • \$\begingroup\$ @mlp according to the standard, but not in practice. Especially not if you already know it's a dedicated charger. \$\endgroup\$ – immibis Aug 27 '18 at 5:25
  • 1
    \$\begingroup\$ did you perhaps connect the 1000uF capacitor backwards.? \$\endgroup\$ – Jasen Aug 27 '18 at 6:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.