Power a Raspberry Pi with Batteries

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
Khosrownia
 
Posts: 13
Joined: Mon Aug 11, 2014 7:58 pm

Power a Raspberry Pi with Batteries

Post by Khosrownia »

Hi,

I just bought a Raspberry Pi for an imaging project that requires the system to be in the field where there are no A/C power supplies. I want to build a rechargable and long-lasting power supply for the system. The AC/DC power supply I bought with it is capable of delivering 5V 2.4A, which is what I assume my field power supply should be able to provide and for about 6 hours or so, and I need to be able to charge it perhaps with the same AC/DC power supply that came with the Pi. The first thing is that I need to find batteries that can provide that amount of voltage and wattage. With all the PCB control boards that I build they need to fit in a 4-inch PVC pipe. Can you point me to a battery that is compact-enough and that can produce the power needed? I can connect a few together to get what I need if I had an idea where to start from. Thanks

User avatar
annaek
 
Posts: 6
Joined: Tue Nov 08, 2016 9:04 pm

Re: Power a Raspberry Pi with Batteries

Post by annaek »

Hi,

I've been working on a variant of the same problem (powering a raspberry pi with batteries), so, while I don't have all the answers, I may be able to help out.

I'm assuming you're working with a raspberry pi 3, as you explicitly mentioned the 2.4 amp power supply (which is commonly recommended for the pi 3). If not, your needs will be even less.

First of all, you should evaluate what your actual power needs are. I ran tests on my pi 3 today, and I don't draw anywhere close to 2.4 A. I'm running in a headless configuration, with a couple of peripheral devices powered separately. My current draw peaks at about 400 mA. This peak occurs during boot, presumably because of high CPU load. To assess your actual power draw, Adafruit sell a couple devices that might be useful, like this cable with built-in current and voltage monitor: https://www.adafruit.com/product/3388
or this 'USB Charger Doctor': https://www.adafruit.com/product/1852
Of course, the other option for assessing power requirement is to hack apart a USB cable and put a standard multimeter in line with the power line. This is what I did, and, honestly, it's a lot of trouble and I wouldn't really recommend it.

Once you know what your actual peak and typical current is (be sure to measure with your pi set up and performing the task you intend), you can calculate your approximate battery capacity requirements.

As far as batteries themselves, you have 3 general options. The simplest are USB power packs. These are generally meant to recharge smart phones, but Adafruit sells a few that they have tested and verified will work with the pi. The only one capable of outputting 2 A is this 10,000 mAh pack: https://www.adafruit.com/product/1566
If you only need 1 amp, then you can look at this 4000 mAh pack https://www.adafruit.com/product/1565
or this 2200 mAh pack (which is probably honestly too small, but do the calculations): https://www.adafruit.com/product/1959
Any of these USB power packs are super easy to recharge from your existing power supply or any micro USB cable connected to your powered computer or USB hub.

Your second main option is to use standard rechargeable nickel metal hydride cells. This is going to be larger, heavier, and cheaper than the other options. These are your common rechargeable AA or AAA batteries. Each cell can supply 1.25 V, so you would need four of them in series to reach 5 V. (Honestly, maybe more than that. The pi is really sensitive to low-voltage conditions.) The issue you're going to run into, though, is current. As explained in Adafruit's tutorial on batteries (https://learn.adafruit.com/all-about-batteries?view=all), nickel metal hydride batteries can be discharged at a rate of 0.2 C. That means that, for a 2500 mAh AA battery, you can draw at most 500 mA of current. If your setup is like mine and draws at most 400 mA, that's not a problem. But if you are using 2 A, well, then you would need a minimum of four sets wired in parallel of four batteries wired in series. That's a minimum of 16 AA batteries. Not impossible, but probably not what you want, either. (Actually, you would need way more than 16 batteries if you are continuously drawing 2 A. Assuming no losses, which isn't realistic, you would drain those 16 batteries in just five hours.) The good thing about nickel metal hydrides (aside from low-cost) is that they are also easy to recharge. You do have to design your enclosure so that you can easily remove them, but, once removed, you can use a standard wall charger. All things told, I'm guessing this is not the right battery technology for your project, but I do know that Adafruit sells lots of battery holders, including some for lots of AA's. I don't have links at my fingertips, but they shouldn't be too hard to find.

The third option is lithium polymer/lithium ion batteries. This is going to be your lightest and smallest option. With the products that Adafruit sells, this is only easy to do if you need at most 1 amp of current. (If you need more, I would really look at a USB power pack.) The issue with using lithium polymer/lithium ion technology is that these cells only have a voltage of 3.7 V. So, a single one is definitely not enough voltage for the pi, but two in series is way too much. Of course, Adafruit sells a product to solve this, the PowerBoost 1000: https://www.adafruit.com/product/2465
This device boost the 3.7 V from your battery to 5.2 V, which is great for the pi. It also includes the proper circuitry to safely charge your battery from a micro USB connection, including the power supply you already have. (So charging is as simple as plugging in your power supply to the micro USB port on the board.)
It also comes with the option to solder on a USB A port for the output, which would make it really easy to connect your pi using a standard micro USB cable.
Adafruit sells a variety of lithium polymer/lithium ion batteries that you can use with the PowerBoost. I haven't looked at these in detail, but the main thing is just to make sure you get enough capacity for your desired run time.

I will mention one more option, which I don't think is at all what you want, but it is one that I have settled on for my own project. When it comes to really inexpensive, high-capacity batteries that can support a lot of current, lantern batteries take the cake. These are large and heavy, but they do come in rechargeable varieties. The most common design seems to be 6 V, so you would need a voltage regulator. In fact, I'm currently trying to figure out the details of that,, and I'm going to post my questions in another thread. So look that up if you happen to be interested.

I confess, this is actually my second time powering a raspberry pi from batteries. The first time was a pi zero, so a bit different. I used a USB power pack, which was totally fine. I want to mention what was not so fine about that project, though. Just in case you haven't thought about it. Safe shutdown. You can't just remove the power from a raspberry pi like you can an Arduino. The raspberry pi is a computer, and it does not appreciate having its power suddenly removed. If you do it enough times, you will eventually corrupt the SD card. Trust me. I've done it. The easy way to handle this is to have 2 parts to shutting off your system. First, you power down the pi (from the UI or using a set up with the button connected to GPIO). Then, after allowing the pi to shut down safely, you remove power from the system, either with a physical switch or by removing the batteries. (If you skip the second step, then the pi will continue to drain your batteries even though it is "off.") If you want to do both actions with a single button press, well, I can probably help with that but be warned that it is a lot more work. (Suffice it to say that I spent dozens of hours debugging my power switch circuit. And that was after I thought I knew what I was doing.)

Anyway, I hope something here is helpful. And hopefully I wasn't too annoying in mentioning the failures of projects past. Good luck with your project!

User avatar
Khosrownia
 
Posts: 13
Joined: Mon Aug 11, 2014 7:58 pm

Re: Power a Raspberry Pi with Batteries

Post by Khosrownia »

I appreciate your time in writing this thorough response to my needs.On the one hand the best thing is to get the power packs, on the other hand I like to build stuff. I tell you, my project is about a self-contained imaging tube that I can build using a wide PVC pipe and a translucent plastic dome with a camera inside. The system will image the dark skies while I am doing deep space photography. It is just for fun, and I don't really expect to be drawing all that amperage from the device. I do have a couple of power testers which are for USB A and USB C and I have adapters to make Micro B to work also. And I have burned enough electronics to now have a breadboard for testing cables that I make.

I am definitely going to test the system and its power requirements and see if I can just do with the DIY kind of rechargeable system or I need to use one of my existing power packs.

Thanks again.


Farzad

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Power a Raspberry Pi with Batteries

Post by adafruit_support_mike »

Find a farm store and take a look at the Sealed Lead-Acid (SLA) batteries used for solar powered electric fences. Those operate at voltages between 6V and 24V, and hold 5Ah to 10Ah of energy. Despite the name, SLA batteries are safe and durable.

In general, you get more bang for your energy buck by storing or transmitting the highest voltage you can get away with. A 24V battery connected to a 5V step-down switching regulator will convert the excess voltage into extra current, so 2.4A @ 5V of output power will only consume about 550mA @ 24V from the battery (assuming 90% conversion efficiency). To get 6 hours of battery life, you'd need about 3.5Ah of battery storage capacity.

SLAs usually start at 5Ah and get bigger, so a relatively small battery would give you all the power you need.

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”