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:
- I do want the negative pin for the capacitor wired to ground and the black wire on the servo?
- I do want the positive pin for the capacitor wired to 5V and the red wire on the servo?
- 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.