As we all know, the Raspberry Pi doesn't really use that much power (5v + 700mA is the spec).
I'd like to build a battery backup for power outages in a DIY-ish fashion. I don't need surge protection or any other fancy options, just security from minor power outages and brownouts.
How can I put a battery backup between the Raspberry Pi and the phone charger I'm using to run it?
You question is more suited for the Electrical Design Stackexchenge site [1] - Because you can always rely on the Gurus there, like Oli, to help design easy, up to date circuits.
I think that this question will be asked by many more Raspberrians to come so this is actually a very good place to answer your question.
My answer will go more into engineering your own circuit so that you can have full control of what you want it to do.
The circuit should handle...
Searching around the internet most UPS circuits and schatics will include a transformer to reduce 110V/220V down to DC 12 Volts.
Part List:
Do not feel like building your own circuits? There is
this MUPS available
[4] for purchase (gone, sorry) that does pretty much what the final circuit design outlines.
References
I have built a converter from 12v to 5v
That's enough for RaspberryPi's 5v requirement. IT also gives power for fan with adjustable thermostat (12v) and even active usb hub (in the future). Everything (Raspberry Pi, converter and thermostat) is enclosed in a router-box (I even have space for an additional 2.5" hdd, 3G modem and/or GPS unit ;) )
Such a converter can convert power from a battery pack (for example from 5 or more AA batteries) and SAFELY give 5V for Raspberry (watch out for voltage!). The converter is pretty small (i think 3 x 10 x 1.5cm). But if you are good at soldering and building circuit boards you can do it smaller.
This is the converter I use with a sample schematic.
It works great, you can attach from 7 to 40V from batteries. And we got max 3 amps on 5v side.
If you need to switch between phone charger and battery pack, you must build a switch (when power from charger goes down, the battery-pack power is connected and vice versa). I think that's pretty simple (transistor, capacitor... just few elements). Or do it manually ;)
I found the question very interesting but my self am not really interested in soldering and fiddling with resistors and stuff and I am sure other people might stumble upon the OP question with hope of a ready product.
So I did find this which for my needs would actually be great. Buy, wait a few days, plug in and viola.
As pointed out in comments. It seems like there could be an issue with high power consumption.. so end of day it looks like it will have to be opened and messed about with. But it is suitable for the Model A.
[1] http://www.dealextreme.com/p/direct-ac-recharge-usb-backup-power-pack-with-cell-phone-adapters-3600mah-4284Any external USB battery pack with built in overcharging protection will help your Pi survive power outage. It will simply work as a poor man UPS for your Pi. http://www.google.com/search?ie=UTF-8&oe=utf-8&q=usb+battery+pack [1]
[1] http://www.google.com/search?ie=UTF-8&oe=utf-8&q=usb+battery+packHere is a UPS for the Raspberry PI: http://www.eevblog.com/forum/projects/raspberry-pi-server-with-diy-ups/
Also, with sufficient changes and safety circuits, lithium rechargeable cells can be float charged. In this case it is best to use a single cell and a boost converter so that balancing circuits are not required. Here is some info on float charging lithium cells: http://www.electronicsweekly.com/Articles/01/02/2006/37528/Float-charging-lithium-ion-cells.htm
So you want a SIMPLE reliable DIY ups like powersupply for your RPi:
Wire it as follows:
from the +12v of the power supply to the anode of the diode
from the cathode of the diode to the 5Ah Pb sealed battery, this protects against the power supply draining the battery when no 220v
, plug in the usb cable
I was liking to put a picture of all parts needed, but i'm not allowed by this website until received 10 points... when this will happen, then i will post the picture
Results of running the RPi(running ssh,wospi,lighttpd) + Davis VPro2+ console (console added 300mA) + usb hub : after 20 hours on the battery , the battery voltage was dropped from 13.08v to 11.77v ! considering 10v as empty this means enough juice for at least 32 hours on a 5Ah battery total costs 30 usd, everything brand new
Here [1] is a supercapacitor based UPS solution for brown-outs and safe shutdowns.
The main difference to other UPS-like circuits is that there is no need to use batteries. This helps to avoid a lot of problems, like recycling the batteries after end of life, the energy is stored in the supercaps which are soldered to the PCB. Why not, when the lifetime of the supercaps is equal to the lifetime of the whole circuit board? You don't have to care about overcharcharging and all the temperature issues, like charging only at temperatures above zero. Supercaps hav no memory effect. They don't need discharge and charge cycles to keep them healthy.
On the other side: supercaps don't have the energy density of batteries, but the circuit should only backup short-term power failures or brown-outs. You really don't need a battery with 2000mAh capacity to backup 1A for a few seconds. Let us evaluate: 700mA for 30 seconds is 5.9mAh capacity you need at 5V. Have you ever seen a battery with this little capacity? Even if it would exist, you would never be able to draw 700mA out of such a small battery. In other words: battery based UPS for short time backup times ALWAYS use batteries with extremly oversized capacity. A supercapacitor is able to source a current of a few Amps even at very small capacities. I think therefore are batteries not the optimal energy storage device in this case.
One thing is bit complicated using supercapacitors: The voltage at the supercapacitor depends on the state of charge, so the need of a step-up/step-down converter makes the use a bit complicated if you think about DYI.
[1] http://www.juice4halt.comThe LiPo Rider Pro [1] was meant for solar applications, but the USB port can also charge the battery, so you don't really need a panel. Coupled with a larger LiPo battery, it should keep the Raspberry Pi alive for a number of hours.
[1] http://www.seeedstudio.com/depot/lipo-rider-pro-p-992.htmlI'm kinda cross-posting this to all the UPS questions on this Stack Exchange because I was looking for something similar, and could never find any answers I liked, so I ended up researching it myself. You can use a standard, off-the-shelf UPS, and the Network UPS Tools (NUT) package to allow a Pi to shut itself down when the power goes out. I have just posted an article I wrote with step-by-step instructions for setting it up:
https://melgrubb.wordpress.com/2014/09/05/raspberry-pi-home-server-part-15power-failures/
Of course, if what you were really after was a DIY hardware project, then I'm afraid this doesn't involve any soldering.
You can try one of these, and use battery instead of super capacitor.
As others have stated, a USB power bank is an easy and fairly cheap solution. Be sure to get one which supports charging and discharging at the same time (which, unfortunately, isn’t usually indicated—you will have to figure that out).
The Pi typically draws anywhere between ~200 to north of 500 mA; for later models the maximum is 2000 mA. So a 6000 mAh power bank will give you anything from 3 hours to a day’s worth of battery power; make sure you get a power bank with sufficient capacity.
Plug your Pi into the output of your power bank and the charger into its input. If the power goes out, your Pi will keep on running until power is restored or the battery runs out.
Limitations are that the Pi has no way of knowing whether it’s running on AC or battery power, or how much battery power is left. Consequently, if the battery runs out before power is restored, the shutdown will be an unclean one.
A more advanced solution, also involving a power bank, is described at https://raspi-ups.appspot.com/en/index.jsp. It includes a daemon which uses the Ethernet connection to determine if it is running on AC—if the Ethernet connection drops, it assumes it is running on battery power. It measures the power consumption of the Pi and estimates the charge level of the battery based on consumption and total capacity (which needs to be configured beforehand). When power runs out, it shuts down the Pi cleanly.
As a variation of the above, if you have some USB peripheral hooked up to the Pi that runs on AC power, you could modify the daemon to use that as a power indicator.