Even if the infrastructure in Germany is very good, occasional power outages for a few seconds, or even for minutes can happen once or twice a year. Every time this happens, I feel really afraid for my Raspberry Pi. Although, up to now, it was never a real problem and the Raspberry Pi just booted fine after the power came back, the uneasy feeling remains.
After the last power outage that lasted for about 15 minutes, I started to look for a way to keep my Raspberry Pi running during a power outage. If you search the Internet for an UPS for the Raspberry Pi, you basically will find three different solutions for it.
A ‘real’ UPS with a built in lead acid battery
Solutions including a backup battery that connect to the Pi’s HAT
A power bank that can be charged and discharged at the same time
But all of these solutions have at least one big disadvantage that makes it unusable for me. A big UPS which is normally used for desktop PCs would be an overkill. It is just to big and expensive and also uses usually at least 10W during standby.
Also, I want to continue using the original case and don’t want to connect anything big to the Raspberry Pi directly, so this also excludes the second solution. A software that shuts down the Raspberry Pi, if a power outage is detected is also unnecessary for my purpose. For me, it is only important to keep it running independently for as long as possible.
What I don’t like about the idea with the power bank is, that it is hard to find a power bank that can be charged and discharged at the same time and also, the power bank is not really designed in the way a UPS should work. I would rather have a battery that is constantly kept full than a battery that is charged and discharged all the time.
Finally, I found the PowerWalker DC SecureAdapter 12V. A small and lightweight DC UPS, especially designed for routers, security cameras and similar devices. This power supply contains a rechargeable 18650 Li-Ion battery as a backup. Only downside is that it outputs 12V and the Raspberry Pi needs 5V. So, one more step is necessary, if you want to use this nice little UPS together with your Raspberry Pi, you have to convert the output voltage. For that, I use a 15W DC-DC converter that can output 5V/3A maximum, just like the original Raspberry Pi power supply can do. You can find various DC/DC converters all around on Amazon, eBay, AliExpress and so on. Luckily, there are ones available that directly have a Micro USB connector on the output, so all you have to do is to connect the output of the UPS with the input of the DC/DC converter. For that, I use an adapter that has a screw terminal on one side and a 5.5mm/2.5mm DC socket on the other side, so finally not even soldering was required for putting it all together.
Below, you can see everything connected together and also a table from the box of the PowerWalker DC SecureAdapter that gives you an idea about the approximate backup times. If you assume that the DC/DC converter has an efficiency of about 90%, the Raspberry Pi can run about 150 minutes with a power consumption of 10.8W (2.16A)!
Another advantage of the PowerWalker DC SecureAdapter is, that the rechargeable 18650 Li-Ion battery is a very common rechargeable battery which can easily be found, and that it can be replaced on your own.
Although, there is always one voltage conversion more present than it would ideally need (230V to 12V to 5V, instead of 230V to 5V and 3.7V to 12V to 5V, instead of 3.7V to 5V), I think this solution is the closest one to what the perfect solution for me would be at the moment. Maybe some day, there will be a device like the PowerWalker DC SecureAdapter available that directly outputs 5V…