CategoriesCalendar
ArchivesQuicksearchSyndicationStatisticsLast entry: 2012-09-11 21:41
38 entries written
457 comments have been made
8189 visitor(s) this month
203 visitor(s) today
16 visitor(s) online
|
Monday, July 2. 2012Running a Raspberry Pi from batteriesOne 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 regulatorThe 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 nonrechargeable 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.
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 UBECDecent 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 converterIf 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 boxFinally, 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 calculationsI 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 levelWhen 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.
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. Comments
Display comments as
(Linear | Threaded)
This is a really interesting guide. I'm considering putting a Pi in my shed to run as a security camera with a webcam.
I did wonder if it was possible to run the Pi from one of these Battery boxes with Li cells and charge the cells at the same time (basically to try and keep the Pi running constantly, possibly from some sort of solar cells)? Rob Comment (1)
Yes, that should normally work fine, though it could possibly depend on the battery box.
The usual model is that they're like a laptop battery - you should be able to seamlessly start and stop charging at the same time as running a load from the battery. If you're looking into security cameras, take a look at the "motion" package ("sudo apt-get motion", if you're on debian, or "pacman -Su motion" on ArchLinux). It looks ideal for that sort of application. Comment (1)
Simply want to say your article is as astonishing. The clarity for your post is simply excellent and that
i can think you are knowledgeable in this subject. Well together with your permission allow me to grab your RSS feed to keep updated with approaching post. Thanks one million and please continue the enjoyable work. Comment (1)
What are the dimensions of the battery box you're using? Have you found anything with a smaller footprint?
Comment (1)
How feasible is running a Pi from a vehicle battery? I am considering running a Pi in a remote location and using a solar trickle charger to top up the battery when possible (Belfast weather :/)
I don't know enough about batteries yet to see if it is possible, without draining the battery before it can be recharged. Interesting stuff all the same Comment (1)
Hi, nice explanation thanks. I've bought a RasPi B model and i want to implement your "Battery box + 4x18650 (rechargeable, 3.7V / 2800mAh each)" because i want over 10h lifetime for my Raspi.
Do i need a DC-DC regulator here too? if i understood correctly 4 batteries will give me 14.8v output and the B model only needs 5v is that correct? Or do i need something else? Many thanks. Comments (3)
Посетите сайт недвижимости Киева Снять квартиру
http://sdamkvartiry.com/ Comment (1)
|
Donate!
If you have found my site or software useful, please consider donating a small amount of money using the button below.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

