My goal is to add capacitors to the Raspberry Pi power-supply.

Currently I have my raspberry Pi plugged straight into a portable 5v battery, this works fine. However, I want to be able to swap from one battery to another battery (via a switch) without the Raspberry Pi turning off. I figured the easiest way to do this is with supercapacitors.

I've added two 25F 2.5v supercapacitors in series as shown in the picture. However, when I do this, the raspberry pi powers on for about 10 seconds (both red and green lights come on) but then it shuts down.

What am I doing wrong here? See image here: https://i.ibb.co/Pcc8RXw/capacitor.png

  • 1
    I'm not an expert here but I would have presumed putting the two batteries in parallel, with a switch on both (that changes the circuit path without closing it), would mean you could turn a fresh one on then turn the old one off without need for capacitors. – goldilocks Apr 20 '20 at 13:24
  • I think you may only need a make-before-break switch. There are also battery selector switches with 1/2/both positions, although the ones I can find are for marine applications and are pretty big. – Bob Brown Apr 20 '20 at 18:55

You need the supercaps to be in parallel to the power supply, not in series. However, before fixing your circuit, mind a few things:

  • If you simply connect your supercaps between 0 and 5V, most power supplies / batteries will have trouble starting your system, since a discharged capacitor is essentially a short circuit. Most power supplies handle shorts gracefully, but a poor one or a bare battery can start a fire.

  • Connecting two caps in series without any voltage balancing will eventually result in one cap getting charged above the 2.7V limit. Again, this can start a fire.

  • supercaps lose voltage very quickly when discharging, much faster than batteries. Without a DC-DC boost they make a very poor UPS, and 25F is not that much to begin with. Unless you need a supply which only lasts a couple of seconds, you should generate stable 5V from whatever voltage the supercaps are charged to.

A very minimal UPS could look like this:


simulate this circuit – Schematic created using CircuitLab

Make sure to pick a boost converter which gracefully handles overvoltage on the output, and tune it to just below 5V, so that it is halted when an external power is provided to the Pi.

For a UPS which only lasts a few seconds, you can use smaller supercaps and/or replace the boost converter with a Schottky diode (anode to the supercaps, cathode to the Pi).

If you have no experience in electronics, consider buying an off-the-shelf UPS.


Putting two caps that are rated at 2.5V in series is NOT going to give you an equivalent 5V rated cap. You shouldn't do that. And think through the physics of holding up a (let's say) 5 Watt load with capacitors while you move wires around. There are better ways to do this:

Perhaps the simplest way to do what it sounds like you want to do is as follows:


simulate this circuit – Schematic created using CircuitLab

The diodes form a "wired-OR" power source that isolates one battery from the other. In this way, both batteries may be connected at the same time - effectively giving you a "make before break" power switch. The diodes are Schottky diodes chosen because they have a lower forward voltage drop than a p-n junction diode. In fact, you could extend this scheme to 3 or 4 or more batteries. This particular part (DSS 20-0015B) appears to have good availability & reasonable price.

One potential issue with this scheme is the batteries themselves, and the RPi's rather tight tolerances for input voltage. If these figures are still correct (4.75V - 5.25V), your batteries will need to be almost "spot on" to get reliable operation. If your application is "critical", all is not lost as we can still use the "wired-OR" scheme above with a slight twist:


simulate this circuit

Adding a buck regulator/converter will easily keep the RPi input voltage in the 4.75V - 5.25V range, using higher voltage batteries. And as before, the "wired-OR" configuration allows you to swap batteries without dropping power to the RPi. In this case, we don't need Schottky diodes, so a conventional diode/rectifier (e.g. 1N5626) may be used.

Buck regulators that meet your specs are readily available as ICs, but may require wiring up a few external components. If you prefer a more finished regulator, those are also available as an assembly from the usual sources. You should probably avoid linear regulators in this application as they are much less efficient than a switch-mode buck converter - but they'll certainly work.

  • 1
    I like your idea, but the statement that two 2.5V caps in series don't give you a 5V cap is not true. In fact, that's exactly how higher-voltage supercaps (or Li-ion batteries with more than 4V) are made. – Dmitry Grigoryev Apr 22 '20 at 7:58
  • @DmitryGrigoryev: I said a 5V rated cap. The max voltage rating has nothing to do w/ the voltage impressed on a cap in a circuit application. Also, I didn't mean to imply that the voltage impressed across capacitors in series couldn't be managed by clever design - as you have shown in your answer. [continued-] – Seamus Apr 22 '20 at 12:05
  • But if the caps are strung in series across a load - as the OP I think intended in his question - it's demonstrably true the voltage impressed across a cap is a function of the charge stored in it, and the Kirchoff equation for that particular arrangement. Surely you agree with this - that belief is reflected in the design you've presented in your answer! You know as well as I that you cannot put a 5V-rated cap in series with a 10V-rated cap, and have an effective max voltage rating of 15V. Sorry that wasn't clear in my writing - I'll try to fix it. – Seamus Apr 22 '20 at 12:07

Your Answer

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

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