5V UPS for Raspberry Pi

From EnigmaGuy Wiki
Jump to navigation Jump to search

Why not to use Powerbanks

 
Xiaomi PowerBank 10,000mAh

Using power banks as a cheap UPS might seems as good idea because they are widely available and more expensive ones (around 20USD) provide enough power not only for Raspberry Pi but also for tablets and other devices. Main issue with power banks (I tried Xiaomi MI 10,000 mAh) is that they contain just one DC-DC power converter so you can either charge them or discharge them. With my power bank when I disconnected power supply from power bank suddenly resetted and stopped providing power for nearly 5 seconds so my Raspberry Pi went down. Not only that. I was suspicious that when powering output power bank was not charging itself properly.

Also there is an issue with capacity. Capacity 10,000mAh means capacity of LiPol 3.7Volts battery inside power bank. After DC-DC converting you will get capacity around half - 5,000mAh for 5Volts output. If your RPi is just with all accessories is just taking out 500mA per hour this power bank will last for 10 hours maximum which is not in all scenarios (e.g. security, automation systems) enough.

USB current and USB cables

 
Belkin USB cable

Firstly you should be aware of this. By specification USB 2.0 is able to provide only 500mA current but some devices (including RaspberryPi) might need more. For example RaspberryPi model B+ needs 700mA for itself + connected devices, total up to 2,000mA. Some tablets needs 2A and new Apple iPad needs if my information is correct 3A.

Unfortunately not all power supplies and power banks are able to provide that much power. You can buy some cheap UPS for 500mA from Adafruit (e.g. PowerBoost 500 Charger - Rechargeable 5V Lipo USB Boost) but they won't be able to provide enough current for your RaspberryPi with all accesories which might use as much as 2A. Not only that - some cables has high impedance and are unable to transfer enough power for your device. For example devices with Belkin USB cable was charging only 400mA while with Samsung USB cable I was able to achieve charging speed up to 1,000mA with same charger.

How much current do you need?

 
USB Charger Doctor

It is sometimes difficult to determine how much current is your device using and how much current do you need. Of course you can use multimeter but in case you do not want to buy two USB connectors and connect multimeter between them for example using breadboard I would recommend you using ready to use solution called CHARGER Doctor. You can buy it from China on E-Bay for approximately 2 USD including WorldWide shipping from many suppliers.

Possible solutions for UPS / Battery types

 
Lead-Acid battery

Although it initially seems that using Li-On batteries would be a great idea it turned out as a terrible idea. Main problem with Li-On batteries are that you need high current UPS device which I was unable to find out on the market (all devices are able to provide 1A current at most). So you would need to make your UPS completely yourself from one AC-DC converter (you will probably not be able to find 3.7V converter on the market so you will need to use AC-DC converter and than DC-DC converter), you also need a charger and step-up DC-DC converter to 5V volts. Li-On batteries also has an issue with exposiveness if you connect anything wrongly not mentioning relatively high price of them.

So because Li-On batteries are expansive and neccesary devices are not on the market (that means you would have to build them yourself) I recommend usage of cheap Lead-Acid batteries. It is not difficult to buy your Lead-Acid battery in any hobby market for fraction of the price of Li-On battery (e.g. I bought in local store 12Volts 7Ah Lead-Acid battery for 15 USD). If you compare capacity of Lead-Acid and Li-On batteries please bear in mind they have different voltage. So If you get Li-On battery with 10,000mAh on 3.7V in the end on 5V you will get approximately 5,000mAh. But if you get a Lead-Acid battery with 7,000mAh on 12V in the end on 5V you will get 14,000mAh. So triple capacity at one third price.

If you need some more info about Lead-Acid batteries please read Wikipedia article Lead–acid battery

All in one UPS device for 12V

 
12V UPS Device

Fortunately there are UPS devices for alarm/camera systems which you can buy for few dollars from AliExpress, just search for ups 12v output and looks for example these rated at 35W (these are the smallest possible but still more than enough for any USB device). I was able to buy one of these in Prague in local store called T-Led around 20USD personally. But you can get them directly from China to anywhere in the world for around same price including shipping. The UPS power supply I bought has 110-230V AC input and two 12V outputs. One 12V output is for battery charging (0,5A) and second is for your DC-DC converter to USB (we will talk about this later). If you connect battery to UPS it would not automatically start but wait for power supply to be connected. Once power supply is connected it will start and if there is an outage it will automatically keep voltage without any downtime (tested, Raspberry Pi did not went down when I disconnected main power and it switched to battery supply). If you need a cold start (start from battery without any external power connected) there is a small button (unfortunately not external one) connected solely for this purpose.

DC-DC Converter from 12V to 5V USB

 
DC-DC 12V to 5V converter

At first it might seems as a good idea to use power stabilizer but problem with this solution is that all diference (12V-5V = 7V) would be converted implicitly to heat. So not only you would need to have some cooler but also a lot of power from battery would be lost without any usage. This is a reason why usage of DC-DC power converter is recommended. DC-DC converter has one large advantage specifically low power lose and high efficiency. If you put 12V at 2A to input you will likely get minimally 5V at 4A. One disadvantage of DC-DC converter is price which is slightly higher than using stabilizer but still pretty low if you buy it on Ebay.com. Just try to search for DC-DC step-down buck converter 5V USB 3A (or 2A of your choice) and you should get some for as low as 2-3 USD.

Everything connected together

You necessarily does not need to do any soldering or use any breadboard or circuit board. All components can be bought on E-Bay or Aliexpress together for price lower than 50 USD and everything you just need to do is connect all cables properly. For this reason there is a simple diagram how to connect it. Colors of wires are type used in EU - in your country it might be different. In any case you connect everything at your own risk and I am not responsible for any misuse or damage caused by my diagram.

 
Everything connected together
 
UPS Connection diagram