# Two 5V Raspberry Pi UPS Idea

I need a cheap, reliable and easy to build UPS for my raspberry pi server. The UPS must maintain power for a maximum of 1 hour. Based on what I found on the internet,I came with two solution. (see diagrams below).

Please rate both and tell me, which one has fewer flaws.

The first solution uses a relay that switches the 5V output from power supply to 20000mAh bank power. In order not to reset the raspberry when relay switching power source, the voltage for 2 seconds is maintained by the super capacitors. When blackout end, the relay should switch back to the power supply

The second solution uses BMS with three 18650 li-ion batteries, generic 12V power supply and step down converter. In the event of a power failure, the batteries support the power on buck converter. When blackout end, PSU charge batteries and buck converter.

For the first solution i have every part except supercapacitor but i found 3$deal on Ali. SuperCapacitor Relay is Omron G6BU-1114P-US-DC12 For second solution i need more parts: XL4005 5A Max DC-DC Step Down - 1$ XL4005 30A 3S Polymer Lithium Battery Charger Protection Board 3 Serial 12V - 2\$ BMS Barrel jack, 12V PSU, 6 old 18650 battery from laptop, some usb cable lying in my house

• must maintain power for a maximum of 1 hour .... don't you mean must maintain power for a minimum of 1 hour (at least 1 hour) – jsotola Aug 30 '18 at 16:06

I'll just comment on the first proposal.

The first solution uses a relay that switches the 5 V output from power supply to 20000 mAh bank power. In order not to reset the raspberry when relay switching power source, the voltage for 2 seconds is maintained by the super capacitors. When blackout end, the relay should switch back to the power supply.

Let's draw a simplified circuit with the mains power on.

simulate this circuit – Schematic created using CircuitLab

Figure 1. A simplified version of the mains-powered switching.

• Mains is switched on. U1 generates DC output.
• RLY1 is energised. A great big spark occurs on the relay contact as C1 initially appears as a super-short circuit and has to be charged.
• C1 charges up at a rate determined by the current limit of the PSU.
• Mains power is lost.
• Current now flows backwards from C1 to the relay coil through the NO contact. The relay remains energised until C1 discharges below the relay hold-on voltage. This is typically 40 to 60% of the pick-up voltage. It then slowly drops out until the contacts open and the rest of the contact transfer motion occurs quickly.
• Meanwhile the Pi has lost power and will reboot when the battery connects.

Option 2 has a better chance of success.

You didn't give the model number for your 20000 mAh power bank, but the easiest option seems like it would be to always power the Raspberry Pi from the power bank, leaving the power bank plugged in all the time. Check the power bank manual to make sure it is ok to leave it plugged in, though.

simulate this circuit – Schematic created using CircuitLab

• Oh, I just noticed this is an old post that was bumped to the homepage by Community for some reason. Oh well. – Justin May 22 '19 at 14:35
• Most power banks can't be charged and dischaged at the same time as you propose. – winny May 22 '19 at 14:40