What voltage range can it accept? What sort of batteries are appropriate?
Standard USB uses 5V, and the Model B Pi claims to need 700mA. Taken from the Raspberry Pi FAQs:
The device should run well off 4 x AA cells.
If you were using 1.5V alkaline batteries, you would be oversupplying the board. As with most SoC-based computers, you should use NiMH batteries, as they supply an average 1.25V. This would leave your board at a safe, more controlled, 5V. The Pi will draw the correct amount of Amps it requires from the batteries, so you don't need worry there.
Here's some comparison of various cheap options for battery power, that will all supply the Pi well within its specs: Running a Raspberry Pi from batteries [This link is actually dead -- and searching the domain for "raspberry batteries" fails -- but Pikamander2 suggested the below as edit which supposedly contains the original content(??). Hopefully this can be considered public domain. -> goldilocks]
Including content below:
Running a Raspberry Pi from batteries
One of the essential properties of a mobile, Raspberry Pi-based robot is that it needs to run on battery power - trailing a power cord around is not much use.
The problem is that the Pi takes an appreciable amount of current (say 500mA, depending on activity and attached peripherals), and needs a pretty narrow input voltage range (5V +/- 0.25V, or so). Because battery voltage varies pretty wildly depending on the current charge level, running directly from a battery is not really sensible.
So, I set about looking into various options for converting standard battery voltages into something suitable for the Pi.
Using a linear regulator
The traditional approach, back when I was first tinkering with electronics about 30 years ago, would be to put together enough batteries to get a significantly higher voltage than 5V (say, 4x non-rechargeable AA to get 6V, or 6x rechargeable AA for 7.2V), and then run that through a linear regulator (e.g. 7805-series IC) to get a steady 5V.
There are 2 main problems with this approach.
- Linear regulators are inefficient, and effectively burn off the excess voltage as heat. That means that you're just wasting battery life, and also probably have to deal with dissipating that heat with a heatsink.
- The Pi draws quite a lot of current, so it would need quite a large regulator, along with a large heatsink.
Fortunately, there are much better approaches nowadays, in the form of switched-mode regulators, which are much much more efficient, even at high currents.
Using an RC-model UBEC
Decent radio-controlled models, especially aircraft, often need an efficient, stable-voltage power supply running from a small, light battery. The standard approach for this is to use a rechargeable battery linked through a device known as a UBEC (Ultimate Battery Eliminator Circuit), which takes a higher voltage than the required output, and very efficiently down-converts it. Whereas a linear regulator feeding 500mA output from a 6V input would draw 500mA (leading to wasted power of (6-5)x0.5 = 0.5W), a UBEC will not need to draw the full 500mA from the input battery, and so wastes very little power.
Because UBECs are so commonly used for RC models, you can pick them up very cheaply, and they can generally handle some pretty high currents. For instance, I found a 4A model on eBay for about £1.50 including postage.
The drawback is that you need to supply more input voltage than the desired output voltage, which means you may need a lot of cells in the battery pack. Still, this is a very cheap option and works well.
Using a DC-DC converter
If weight is a priority, then keeping the number of battery cells to a minimum is important. Fortunately, there's a device called a DC-DC converter that works in a very similar way to a UBEC, but can work from an input voltage that's lower than the required output voltage. These are also typically really tiny.
Looking on eBay again, I found some really nice ones, which include a female USB-A socket. This means that you can use the same USB lead that you're probably using to power your Raspberry Pi, without any modifications. The price here was around £2.50, with free postage. Input voltage is 3-5V (ideal for 3x rechargeable AA), and output current is up to 1A, which should be plenty.
Using an integrated battery box
Finally, there are various solutions available which use rechargeable batteries plus a DC-DC converter, in a dedicated housing. These can be pretty nice, because they don't require any specialist assembly (e.g. soldering) - some even have the batteries already built in. The option I chose uses high capacity "18650" Lithium Ion cells (e.g. these, around £10 for a pair from eBay), and cost around £8 including postage. It can supply up to 2.5A, which is more than enough, and again has a built-in USB-B socket for easy connection, as well as a convenient USB-miniA socket for easy charging. Another nice feature of this type of box is that you can stick in anything from 1-4 cells, depending on how much battery life you need.
A drawback is that these boxes can be quite large. The one I chose is about the same size as the box that my Pi came in from Farnell.
If you do go for the 18650 option, then it's worth shopping around carefully. Some brands, most notably Ultrafire, have a poor reputation for quality and don't seem to live up to their rated capacities. These types of batteries are also prone to fire or explosion if used improperly - so you'll want to be very careful to look after them, and it's worth making sure that you're not using a dodgy brand.
Battery life calculations
I haven't experimentally verified any battery life figures for any of these options yet, although I have tested that my Pi runs happily from each of them (except, so far, for the UBEC).
When calculating theoretical battery life, because you're converting voltages, you can't go simply by the milliamp-hour (mAh) ratings printed on the battery. It's simplest to convert to watt-hours, which is simply voltage multiplied by the mAh figure. The RasPi needs approx 500mA at 5V, which is 0.5 x 5 = 2.5 watts. Assuming perfect efficiency in the converter (they're usually at least 90% efficient), a 1.5V AA cell with 1000mAh capacity would be able to supply 1.5Wh - i.e. run a RasPi for approx 1.5 / 2.5 = 0.6 hours (or 36 mins) on its own. With a switched-mode converter (i.e. any of the last 3 options), it doesn't really matter whether you connect multiple cells in series or in parallel - in each case, you're roughly multiplying the available capacity by the number of cells used.
Here's an easy side-by-side comparison of the options listed above. I hope it helps you to figure out an appropriate battery power solution for your Pi project.
Monitoring charge level
When running from batteries, it's wise to try to monitor the current charge level, so that you can estimate the battery life remaining. You can do this by observing the voltage across the battery - this will fall as the battery discharges. Apart from allowing for non-linear discharge curves (each cell type behaves differently, and has a different voltage range), there are two main difficulties with this when running a Pi from a voltage convertor.
- The input voltage at the Pi is always going to be a steady 5V, by design. So you need to connect wires from the input battery to your charge monitoring circuit, rather than being able to measure the voltage at the input to the Pi. For integrated battery boxes, this requires drilling some holes in the box to access the battery.
- The Pi does not have an analogue-to-digital convertor built in, so you can't directly measure the voltage using the Pi. You can get small, cheap, standalone ADC chips that are accessible using the Pi's GPIO pins (e.g. using I2C), which is probably the cheapest option. Personally, I have a lot of ATTiny85 microcontrollers lying around (essentially a mini-Arduino), and I'll probably look at using one of those to measure the analogue voltage, convert to a percentage remaining indication using software on the ATTiny, and then communicate that level to the Pi over I2C.
Unfortunately, you can't properly power down the Pi purely from software, so there's also a potential mini-project to provide a software-controllable, latching off-switch. Personally, I expect to just use the manual off-switch built into the battery box. If you're using Li 18650 cells, then it's worth getting the 'protected' type, as these automatically cut out at low voltages.
I got this battery powered USB cell phone charger, and a couple of lithium 18650 batteries. It did a pretty good job and ran for 5.5 hours when idle and over 4 hours when running a Quake 3 demo loop. You can read about my testing methodology here. These 18650 lithim batteries work great because they are high enough voltage that just 2 batteries will easily do the job, and they are also rechargeable. They also provide quite a bit of power and allow you to use the Pi for many hours even under full load. I would think that these batteries would be a good choice for anybody looking to power their Raspberry Pi from batteries.
It is inadvisable to run the RPi on batteries, as it has been designed to be powered by USB; USB power is regulated and accurately 5V. Most USB ports can supply ~500mA, whereas most USB chargers are designed to supply 1A. The RPi requires a minimum supply capable of 700mA, otherwise it may not boot properly.
It would be advisable instead to use a battery powered, emergency USB phone charger or wait for a LiPo shield, which will undoubtedly be developed.
http://elinux.org/R-Pi_Troubleshooting#Troubleshooting_power_problems suggests that the voltage needs to be between 4.75 and 5.25 V, suggesting that 4 NiMh batteries at 1.2V each should be 4.8V, within range. However, fully-charged NiMH batteries can go up to 1.4V * 4 = 5.6V, well over the maximum. If you test your batteries and find that they only go as high as 1.3V when fully-charged, they should be OK. The best solution is probably to use a switching DC-DC converter to convert from whatever your batteries put out to 5V.
Here is what I did and it seems to work well: You will need a 8xAA battery pack with a 9v battery like power connector. A 2Amp USB car adapter Optional - A plug to plug into the car adapter, otherwise just take the adapter apart.
Solder the center pin on the car adapter to the positive from the battery pack, or if you used the cable the appropriate wire. And solder the negative to the outer on the adapter
I then got 8xAA 2500mAh rechargable NiMH for a total possible of 24wH's. This should be good for a while.
I am measuring a steady 5.08v on the usb plug from the adapter. This will depend on the quality of the one you buy/have. I used a rayovac adapter.
The batteries will put out around 10-11V before the adapter.
The pi needs 5V if not a little more. The adafruit adapter is 5.25V
http://elinux.org/RPi_5V_PSU_construction is helpfull too.
I also measured the current draw from the battery pack when it was 10V at 0.54A. The device had a hub, Logitech Quickcam 9000, Netgear N150, and a USB2Serial adapter and the CPU was at 70-100%. At idle it was 0.38A. At poweroff it measured 0.14A. With only the Pi it idled at 0.24A. Under Load at 900Mhz, it only used 0.27A. When the device is idle it clocks down to 250Mhz. It does not look like the clock speed makes much difference or the cpu load.
So at 5W with all devices I should get about 4-5hrs, give or take, but 8-9hrs with just the Pi and ethernet.
I am using Rpi with cheap DC-DC converter. Used it with airsoft batteries and RC models batteries (7.2V and 11.8V). Works as a charm. Look like my 5000mah 11.6V battery can power it for days.
Just be careful to configure it prior to using. I am testing it with every new battery before connecting to Rpi.
I see at least 2 points to consider.
1. Efficiency of power regulator
If you are using battteries, you are probably worrying about power consumption of your Rpi. Rpi uses unefficient linear regulator (typical power efficiency of those are around 30-50%. But I am not sure for Rpi lin. regulator!). Linear regulator dissipates energy as heat to obtain desired voltage rail, i.e. 3.3V. The general rule regarding power line translation, e.g. USB@5V -> RPI@3.3V, is: the larger the input voltage, the larger is the dissipation on regulator for same working conditions. On the other hand, swithing regulator provides higher efficiency, typ. 80-85%, even up to 97%(LM2651). And it is more suitable (but also more expensive!), when you have need for larger voltage drop, e.g. battery pack's 12V or 24V to 5V.
You can find lots of tutorials to replace the original Rpi regulator on the Internet.
2. Battery type
You can make your own battery array using LiPo batteries to suite your project and then you can adjust dimensions, capacity, min. voltage and current specs, etc. You can purchase different types of LiPoly on frequently used e-markets, like eBay or similar. In addition to capacity, you should be careful about max. and standard dicharge current(needed if using high-power devices along Raspberry like UMTS modems), cycle life(typically 200-1000 for cheap LiPoly) and safety and protection specs(discarge, short circuit, overvoltage, undervoltage, etc.). I used LiPoly batteries in many projects due to good availability and performance vs. price ratio.
You can read more about LiPoly on RC forums.
This is a rather expensive USB battery pack, but its very versatile, and you will find several uses from it, other than a battery-backup for your pi.