Since for a headless Raspberry Pi it makes no sense to use a large UPS (Uninterruptible Power Supply) to keep it running in case of power failure, I bought and tested a Raspberry Pi battery kit a couple of years ago. The kit included an acrylic case, a battery charging board, and LiPo battery and it worked most of the time as a UPS. “Most of the time” means the switch from mains to battery would not occur fast enough maybe 10% of the time (it depends on the load), so the Raspberry Pi board would reboot.
The kit also did not include a GPIO / I2C interface to report the charge level of the battery, so you would not be able to safely power the board when the battery is almost fully depleted. In recent years, it’s become more and more difficult to get batteries shipped from overseas, so a design based on standard batteries like rechargeable 18650 batteries may be preferable, since you can easily purchase them locally.
There are several UPS solutions for the Raspberry Pi on the market, but the latest Pi-Zero-UpTime UPS boardfrom Alchemy Power looks particularly interesting since it comes in Raspberry Pi Zero size, relies on a standard 14500 Li-Ion battery, reports when battery level is low via GPIO 26, and works with an Raspberry Pi boards with a 40-pin header, as well as “clones” like Tinker Board, ROCK64, ODROID-C2, and others.
Key features of Pi-Zero-UpTime (aka PiZ-UpTime):
- Works with Raspberry Pi Zero, Pi Zero W, and other 40-pin boards
- Battery Support
- Works with Lithium Ion 14500 (AA size) rechargeable battery
- Recommended battery capacity – 700 mAh to 2,000 mAh
- Includes battery management (BMS)
- On-board circuitry prevent over charging, deep discharging.
- Temperature monitor checks temperature
- Hard shutdown when battery runs dangerously low, protecting the battery.
- UPS – 5V out via 40-pin header or via micro USB for Pi-Zero without the header.
- Reset switch for rebooting the Pi, or an external reset switch can be connected
- GPIO 26 used to report low battery voltage.
- Status LEDs, which can be turned off to save power
- Dimensions – 65mm x 30mm x 18mm
- Weight – About 20 grams, for reference the battery adds around 30 grams
Some Python code is provided to automatically shut down the Raspberry Pi when the battery is low. For reference, a 1,200 mAh battery lasts around one hour with the Raspberry Pi 3 connected to USB mouse and keyboard, monitor, and with WiFi and Bluetooth on.
I first found PiZ-UpTime UPS board on Tindie where it is sold for $29.99, but the Raspberry Pi UPS board is also sold on Amazon and eBay. If you need more battery the company also sells Pi-UpTimeUPS taking two 18650 batteries for around $50. More details can be found on Alchemy products page.
Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011.