Battery Backup For The Raspberry Pi

You can go to any dollar store, gas station, big box store, or your favorite Internet retailer and get a USB power bank. It’s a lithium battery mashed into a plastic enclosure with a USB port, probably poorly engineered, but it does serve as a great power supply for the Raspberry Pi. For the Raspberry Pi Zero contest we’re running over on, [Patrick] built a lithium phosphate battery pack that’s much better engineered and has some features a simple USB power bank will never have.

Battery[Patrick]’s Raspberry Pi UPS isn’t just a battery and charge controller attached to the power rails; this board has a microcontroller that has full control over when the Pi wakes up, when the Pi goes to sleep, and can put the Pi into a clean shutdown, even in headless mode. SD cards around the world rejoiced.

The electronics for this project are just a low-power MSP430 microcontroller and a boost regulator. The battery pack/power manager attaches to the Pi through the first few GPIO pins on the Pi’s 40-pin header. That’s enough to tap into the 3.3 and 5V supplies, along with the serial console so power events can be scripted on the Pi.

So far, [Patrick] has made a few time-lapse movies with his lithium battery backup, a Pi Model A+, and a Raspberry Pi camera. He managed to take 99 pictures over the course of about 24 hours, powered only by a single lithium-ion cell. You can check that video out below.


The Raspberry Pi Zero contest is presented by Hackaday and Adafruit. Prizes include Raspberry Pi Zeros from Adafruit and gift cards to The Hackaday Store!
See All the Entries || Enter Your Project Now!

29 thoughts on “Battery Backup For The Raspberry Pi

  1. So Impressed :)
    I’ve been looking for something to do this for ages! was thinking along the lines of an SLA and PSU with 2 diodes, which could also run an external drive.

    1. Thanks! :)
      I hope to be selling these pretty soon. I was thinking the price point would be $20-25. I know that’s as much or more than a Pi, but unfortunately I don’t have the connections they do and need to make a living… ;)
      So would you buy one for that price? I’m trying to figure out if it’s worth it to invest in a build…

  2. I have got a project about this just around the corner. I just have to put it in
    Best thing about mine: no micro…
    This project here does have charging which i do not have.

    1. More details ? As I can imagine it right now, it’s just a voltage regulator. Maybe you have included more functionality like shutting down the battery when the voltage gets too low (using some amp op to keep it analogic) ?

  3. I never could wrap my head around why the Pi wasn’t designed to deal with power loss. Despite being a Linux computer, it’s also a microcontroller for all intents and purposes. Even if the Pi foundation didn’t do that with the first version, certainly later versions of the Pi should have had a way to deal with that design flaw after the foundation saw how their product was being used.
    That’s half the reason why I don’t even use mine, the other half is that I can’t think of a cool project to use it in (complete brain failure).

  4. For an ideal “back up” battery you would want to utilize a Lithium-Thionyl-Chloride cell. Yes they can not be recharged, and are only suited for extremely low discharge use (sub 1 mA). But they can last an extremely long time. Some even ~20 years provided they’re maintained and used correctly.

    1. Of course, 20 years of backup is not really the point of this project. A Lithium-Thionyl-Chloride cell would not run a power-hungry beast like a Raspberry Pi for more than a couple of hours either! *lol*
      The Lithium Iron Phosphate chemistry works well for this because it provides 1000-2000 recharge cycles and doesn’t mind staying at the float voltage as much as other lithiums.

  5. Thanks so much for featuring my project on the blog Hackaday! :) I was wondering what happened that made me get 20 new follows and 15 skulls overnight! *lol*
    I’m hoping to either do a Kickstarter or just run a build to have these available in my Tindie store real soon.
    Since this project has an unusual amount of attention at the moment, a couple of questions for potential users:
    This provides UPS functionality, an hour (RPi2) or better (2:30 on Model A+ and PiZero) independent run time, provides clear power down with touch button or when power fails, and has a (somewhat inaccurate) wakeup timer. Anything I’m missing that would be really useful?

      1. Excellent idea! I could probably add PCB edge connections for that.
        Downside is that the low power oscillator will be running at 32 kHz instead of 12 kHz so power consumption in sleep mode will be a little higher. But adding RTC functionality and making the wakeup timer accurate is probably worth it!
        I will probably need to upgrade the micro from the 1K to the 2K version since the flash is completely stuffed as it is. :)

        1. I’ve been looking for a decent board that does charging/low battery detection and RTC. Preferably that can be configured for whatever high capacity battery I can find … but I guess that would explode the amount of complexity of your project?

          1. Not necessarily… The base LiFePO4wered/USB board has been used by customers with much bigger cells successfully. It takes some hacking, but this IS Hackaday after all. ;-)

            In principle I could also provide the top board (the Pi power manager) by itself if you bring your own battery and charger. It has to be LiFePO4 though since the micro is powered straight from the battery and other lithium chemistries reach too high a voltage during charge.

  6. This seems like it’s entering into territory better suited for a C.H.I.P with its rather nifty-looking onboard power management and LiPo support. I know they’ve been pushing a bunch of code upstream to support that natively in Linux too. (Unfortunately I haven’t managed to get my hands on either that or a Pi Zero yet.)

  7. There was a succesful Kickstarter campaign in 2014 for a product called MoPi which seems to have similar functionality as this but with additional features. Created by Sheffield University based in the UK. They are already commercially available and have been for a long time. I currently have one running a time-lapse camera. If you are based in the UK or Europe it might be worth taking a look at.

  8. We need more projects like this!

    I have lots of 18650 cells but I don’t use them because I am worried they will catch fire/explode. I’d love to have a project that uses more cells, charges and cuts off when the voltage is low.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.