Friday 3 July 2015

Add a battery pack to your Raspberry Pi

Add a battery pack to your Raspberry Pi

Don’t leave your Raspberry Pi behind – incorporate it into mobile projects by powering it with AA batteries

Your Raspberry Pi’s mobility is usually restricted by the length of the power lead. Rather than limiting it to your desk or living room, however, you can use it for mobile projects as diverse as launching it into near-Earth orbit or monitoring and automating your garden.


Of course, to do this you will need batteries, but adding battery power to your Raspberry Pi is simpler than you might have imagined. All that is required are six rechargeable AA batteries (or single-charge alkaline), a battery box with space for the batteries and a UBEC. The latter is a Universal Battery Elimination Circuit, a voltage regulator that will regulate the power supply and prevent damage to the Raspberry Pi, and can be bought for under £10.

What you’ll need
- AA battery box (bit.ly/1FDiJGa)
- 3-Amp UBEC (bit.ly/1HLKih7)
- 3-Amp terminal strip
- 6x AA rechargeable batteries

01 Order your components


If you’re buying your components online, you should be able to get them all within five days. However, if you’re ordering offline (specifically the UBEC), you should avoid traditional electronics stores and instead visit a model enthusiast store, as these circuits are regularly used in RC-devices.

02 Check your UBEC


Two types of UBEC are available. If you used the store that we suggest in there sources box to the left, you’ll receive one with a micro USB power connector for easy connection to your Raspberry Pi. However, if you bought one from eBay then there is a strong chance that you will receive one with a 3-pin connector.

03 Change the UBEC connector pins


To use the UBEC with a 3-pin connector, alter the position of the pins so that they occupy the two outer slots. Use a small jeweller’s screwdriver to lever up the small plastic catch and remove the red wire from the central slot, before sliding into the unoccupied outer slot.

04 Connect the UBEC to the battery box


With five batteries in the battery box, connect it to the UBEC: red-to-red, black-to-black. You might do this by twisting the wires or soldering, or employ a 3-amp terminal strip, cut down to two pairs. The terminal strip can be cut to size using a modelling knife.

05 Add a battery to boot


With your Pi ready to use and your Wi-Fi dongle plugged in, connect the UBEC to the micro USB port and insert the sixth battery into the battery box. The Pi’s power and status lights should indicate that the computer is booting up, which gives you a fully portable computer.

06 Connect the 3-pin UBEC


If you purchased the UBEC with the now-modified 3-pin connector, you’ll need to connect this to the Raspberry Pi’s GPIO header. Specifically, connect the positive +5V (red) connector to Pin 2 and the negative 0V connector to Pin 6. Once again, check the status lights to ensure the Pi is booting.

07 Measure uptime


You should have already set up your Pi for SSH use, so connect to the device via Putty after giving it time to boot fully (at least 60 seconds). In the terminal, enter:

watch -n 60 uptime

This command will display the system uptime and also keep the Wi-Fi connection active.

08 Judge your uptime results


Uptime results depend upon the type of battery you use and the Raspberry Pi model. Single-charge batteries will last a little bit longer, but this is a more expensive option. Meanwhile, newer models have greater power requirements but run for less time. For more power, add more batteries!

09 Power extreme!


More batteries added in parallel should result in almost double the uptime (at least 16 hours on a 256MB Raspberry Pi Model A), but instead of alkaline or rechargeable batteries you might consider a modern lithium-based AA cell, which will last considerably longer than alkaline batteries.

Use a UBEC


It is possible to power your Raspberry Pi directly from four or more batteries, but without the safety that the UBEC provides you’re likely to burn out the computer. Unregulated power can cause considerable damage to your Raspberry Pi, and as you increase the current with more batteries, the risk also increases. Unless you are planning to learn the hard way and you have plenty of cash to burn, always use a UBEC!