5V UPS for Raspberry Pi: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
Line 1: Line 1:
== Why not to use Powerbanks ==
== Powerbanks ==
[[File:Powerbank.jpg|200px|thumb|Xiaomi PowerBank 10,000mAh]]
[[File:Powerbank.jpg|200px|thumb|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.
Using USB 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 (up to 2A) 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. Futhermore you cannot monitor power bank recharge status.
 
=== Advantages of Li-On batteries ===
* widely available
* very easy to connect
* reasonable price
 
=== Disadvantages of Li-On batteries ===
* does not works correctly as UPS
* low capacity
* does not report status of battery to RPI


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 ==
== USB current and USB cables ==
[[File:Cabling.jpg|200px|thumb|Belkin USB cable]]
[[File:Cabling.jpg|200px|thumb|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.
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. [http://www.adafruit.com/products/1944 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.
Unfortunately not all power supplies and power banks are able to provide that much power. You can buy some cheap Li-On UPS for 500mA from Adafruit (e.g. [http://www.adafruit.com/products/1944 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? ==
== How much current do you need? ==
[[File:Charger-doctor.jpg|200px|thumb|USB Charger Doctor]]
[[File:Charger-doctor.jpg|200px|thumb|USB Charger Doctor]]
Line 15: Line 26:
== Possible solutions for UPS / Battery types ==
== Possible solutions for UPS / Battery types ==
[[File:Lead-acid.jpg|200px|thumb|Lead-Acid battery]]
[[File:Lead-acid.jpg|200px|thumb|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.
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 for Li-On batteries 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 explosiveness -so 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.
Because '''Li-On batteries are expansive and quality charging accessories 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 [http://en.wikipedia.org/wiki/Lead%E2%80%93acid_battery Wikipedia article Lead–acid battery]
If you need some more info about Lead-Acid batteries please read [http://en.wikipedia.org/wiki/Lead%E2%80%93acid_battery Wikipedia article Lead–acid battery]
=== Advantages of Lead-Acid batteries ===
* widely available
* easy to buy good charging accessories
* very good price
* nice capacity
=== Disadvantages of Lead-Acid batteries ===
* high weight
* lower lifetime
* larger size
== All in one UPS device for 12V ==
== All in one UPS device for 12V ==
[[File:All-in-one-ups.jpg|200px|thumb|12V UPS Device]]
[[File:All-in-one-ups.jpg|200px|thumb|12V UPS Device]]
Fortunately there are UPS devices for alarm/camera systems which you can buy for few dollars from [http://www.aliexpress.com/ 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 [http://www.t-led.cz/ups-zdroj-12v-35w-s-nabijenim 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.
Fortunately there are UPS devices for alarm/camera systems which you can buy for few dollars from [http://www.aliexpress.com/ 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 [http://www.t-led.cz/ups-zdroj-12v-35w-s-nabijenim 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 for 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.


From my measurements battery is usually disconnected when 11.5V in order to prevent damage and fully charged at 13.3V.
From my measurements battery is usually disconnected when 11.5V in order to prevent damage and fully charged at 13.3V.
Line 28: Line 51:
== DC-DC Converter from 12V to 5V USB ==
== DC-DC Converter from 12V to 5V USB ==
[[File:12-to-5v.jpg|200px|thumb|DC-DC 12V to 5V converter]]
[[File:12-to-5v.jpg|200px|thumb|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 [http://www.ebay.com/ 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.
At first it might seems as a good idea to use power stabilizer but problem with this solution is that all difference (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 [http://www.ebay.com/ 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.
 
=== Advantages of DC/DC converter from 12V to 5V ===
* affordable price
* high efficiency
* available on international stores
 
=== Disadvantages ===
* higher price than stabilizer
 
== Everything connected together ==
== 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.'''
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.'''
[[File:Ups-connected.jpg|500px|thumb|center|Everything connected together]]
[[File:Ups-connected.jpg|500px|thumb|center|Everything connected together]]
[[File:Ups-diagram.jpg|500px|thumb|center|UPS Connection diagram]]
[[File:Ups-diagram.jpg|500px|thumb|center|UPS Connection diagram]]

Navigation menu