Component guide · Intermediate · 3 min read
Battery UPS HATs and Shields

Waveshare UPS HAT E, DFRobot Pi 5 UPS, 16340, PowerBoost)
By Geekobot Learning Team · Updated 29 Oct 2026
On this page
UPS HATs and battery shields keep a Raspberry Pi or Arduino running from lithium cells when mains power fails, and charge the cells when it returns. The Waveshare UPS HAT (E) holds four 21700 cells for a Pi 5, DFRobot's UPS HAT uses 18650 cells, and the 16340 shield suits small projects. The MCP73871 and MP2636 boards are charge-and-boost cores for custom builds.
Key specs at a glance
- Waveshare UPS HAT (E)
- 4 x 21700, 5 V 5 A, USB-C PD input, I2C monitor
- DFRobot Pi 5 UPS
- 18650 cells, 5.1 V 5 A
- 16340 shield
- 1 x 16340, 5 V and 3.3 V out
- MCP73871
- Load sharing USB/solar charger
- MP2636
- 5 V 2.5 A boost with charger
- Monitoring
- I2C voltage/current on HATs
A shorted, over-charged or damaged lithium cell can get very hot and catch fire. Use a protection board or BMS, never short the terminals, charge on a non-flammable surface and do not leave a charging pack alone. Throw away cells that are swollen or dented.
Models in this guide
These are alternatives. Pick the one that fits your project; you only need one.
Option 1Waveshare UPS HAT (E) 4 × 21700₹3,785
Option 216340 Battery Shield for Arduino and Raspberry Pi₹350
Option 3DFRobot Raspberry Pi 5 18650 Battery UPS HAT (5.1V 5A)₹6,735
Option 4MCP73871 USB / Solar LiPo Charger Board (5V PowerBoost)₹746
Option 5DFRobot MP2636 Power Booster & Charger Module – 5V 2.5A Output₹1,039
What the Battery UPS HAT and shield is
A battery UPS HAT or shield keeps a Raspberry Pi or Arduino running from lithium cells when the main supply fails, and recharges them when power returns.
Read battery status over I2C and shut the Pi down cleanly at low battery to avoid SD card corruption.
Cells are often not included; buy matched, quality cells and insert with the right polarity.
Battery UPS HAT and shield pinout
The pins on the Battery UPS HAT and shield and what each one does.
| Pin | Function |
|---|---|
| 40-pin header | Pi power and I2C |
| Battery holders | Cells |
| USB-C | Charging input |
| Pogo pins | Power to Pi (some HATs) |
- 40-pin header
- Pi power and I2C
- Battery holders
- Cells
- USB-C
- Charging input
- Pogo pins
- Power to Pi (some HATs)
Wiring the Battery UPS HAT and shield
Connect the Battery UPS HAT and shield like this.
| Battery UPS HAT and shield pin | Raspberry Pi | Arduino / small boards |
|---|---|---|
| HAT | Stacks on Pi 40-pin or pogo pins | Shield stacks on Uno |
| Input | USB-C PD charger | Micro USB 5 V |
- HAT
- Raspberry Pi:
- Stacks on Pi 40-pin or pogo pins
- Arduino / small boards:
- Shield stacks on Uno
- Input
- Raspberry Pi:
- USB-C PD charger
- Arduino / small boards:
- Micro USB 5 V
Example code
Address and thresholds depend on the HAT; use the maker's sample code.
from ina219 import INA219
import os, time
ina = INA219(0.01, address=0x41)
ina.configure()
while True:
if ina.voltage() < 6.4: # 2S pack near empty (check your HAT)
os.system("sudo shutdown -h now")
time.sleep(30)Setup and tuning
fit quality cells of the size the board takes (21700, 18650 or 16340) with the right polarity.
a Pi 5 UPS needs a USB-C PD supply that can charge the cells and run the Pi together.
read the battery level over I2C and shut the Pi down cleanly before the cells run flat.
charge the cells fully before relying on the UPS.
keep the cells away from hot parts and do not seal the board in a box with no airflow.
What you need
Shop this list7 of 7 found in our store · ₹47,05,913
Waveshare UPS HAT (E) 4 × 21700: the part this guide coversWaveshare UPS HAT (E) 4 × 21700₹3,785
16340 Battery Shield for Arduino and Raspberry Pi: another version this guide covers16340 Battery Shield for Arduino and Raspberry Pi₹350Closest match, check the specs
DFRobot Raspberry Pi 5 18650 Battery UPS HAT (5.1V 5A): another version this guide coversDFRobot Raspberry Pi 5 18650 Battery UPS HAT (5.1V 5A)₹6,735
MCP73871 USB / Solar LiPo Charger Board (5V PowerBoost): another version this guide coversMCP73871 USB / Solar LiPo Charger Board (5V PowerBoost)₹746
DFRobot MP2636 Power Booster & Charger Module – 5V 2.5A Output: another version this guide coversDFRobot MP2636 Power Booster & Charger Module – 5V 2.5A Output₹1,039
18650 Li-ion rechargeable cell: the cell to charge or protect18650 Li-ion Rechargeable Cell₹119Closest match, check the specs
Digital multimeter: to check supply and signal voltagesDigital Multimeter₹177
Alternatives and when to choose them
Common mistakes to avoid
- Inserting a cell backwards, which can damage the board or the cell.
- Mixing old and new cells in one UPS.
- Letting the Pi run until the cells are flat with no clean shutdown.
- Using a weak supply that cannot charge and run the Pi together.
Frequently asked questions
How long will a UPS HAT run my Pi 5?
It depends on load and cells. Four 21700 cells can run a lightly loaded Pi 5 for a few hours.
Can I use unprotected 18650 cells?
Use good quality cells of the right size and polarity. Some boards include protection, but never use damaged or mixed cells.
Will the Pi shut down safely when the battery is low?
Only if you run the maker's script or your own code that reads the level and calls shutdown.
Can I power the UPS from a solar panel?
Some boards, such as the MCP73871 charger, support solar input. Check the input range first.
Why does my Pi show undervoltage on battery?
The UPS output or cables cannot supply the Pi's peak current. Use the board's rated output and short leads.
Parts for this guide
Keep learning
Sources
Written by the Geekobot team from manufacturer datasheets. Always check the datasheet for the exact part and variant you buy.
