To keep a Raspberry Pi 5 running for 4 hours during a mains outage, you need a 7.4V (2S) 6,400mAh (47.3Wh) Li-ion pack, a power-path management UPS HAT capable of 5A output, and a 12V/5A AC adapter. Unlike simple USB power banks, a true uninterruptible power supply (UPS) requires hardware that seamlessly bridges AC and DC power without resetting the Pi's 5V rail. As of 2026, the Pi 5's increased power envelope (up to 25W with peripherals) demands rigorous sizing math to prevent brownouts.

System Architecture: From Mains to the Pi's 5V Rail

A robust backup battery for Raspberry Pi deployments is not just a battery; it is a managed power-path system. The energy flow follows a strict block sequence to ensure zero-millisecond switchover during an outage:

  1. AC Mains Source: 120V/230V AC feeds a 12V DC wall adapter.
  2. Power Path Controller: A dedicated UPS HAT (using ICs like the Texas Instruments BQ25895 or similar) manages the 12V input, routing power to the DC-DC converter while simultaneously charging the battery.
  3. Energy Storage: A lithium-ion or LiFePO4 cell pack stores energy, monitored by a Battery Management System (BMS) for cell balancing and over-current protection.
  4. DC-DC Conversion: A high-efficiency buck (step-down) or boost (step-up) converter regulates the battery's variable voltage (e.g., 6.0V–8.4V) to a rock-solid 5.1V.
  5. Load: The regulated 5.1V is fed directly into the Raspberry Pi's USB-C power input or GPIO 5V pins.

For authoritative baseline power requirements, always cross-reference your specific board's maximum current draw against the official Raspberry Pi power specifications.

Sizing the Backup Battery: Math, C-Rates, and Efficiency

Let's size a system for a Pi 5 running a moderate workload (Home Assistant with a Zigbee dongle), drawing an average of 8W, with a target runtime of 4 hours.

The Sizing Formula

Raw energy required = Load (W) × Time (h) = 8W × 4h = 32Wh. However, you must account for three real-world loss factors:

  • DC-DC Efficiency: Buck/boost converters on UPS HATs typically operate at 88% efficiency under a 1.5A load.
  • Depth of Discharge (DoD): To achieve a 500+ cycle lifespan, Li-ion cells should not be discharged below 15% remaining capacity (85% usable DoD).
  • Peukert's Derating: While Peukert's law heavily penalizes lead-acid batteries at high discharge rates (exponent ~1.3), lithium-ion cells exhibit a near-linear discharge curve (exponent ~1.05). At a 1C discharge rate, Li-ion yields about 95% of its rated 0.2C capacity.

Adjusted Capacity Calculation:
Required Pack Wh = 32Wh / (0.88 Efficiency × 0.85 DoD × 0.95 Peukert Derating)
Required Pack Wh = 32 / 0.7106 = 45.03 Wh

Using a 2S (7.4V nominal) lithium-ion configuration, the required Amp-hour rating is:
45.03 Wh / 7.4V = 6.08 Ah.
We round up to a standard 2S2P pack using four 3,200mAh 18650 cells, yielding 6.4Ah (47.3Wh).

⚠️ LITHIUM FIRE-SAFETY CALLOUT
Never parallel mismatched lithium cells (different capacities, ages, or chemistries). Voltage imbalances during charging can cause the higher-voltage cell to overcharge, leading to thermal runaway and catastrophic fire. Always use a BMS rated for your specific series/parallel configuration, and never leave raw lithium packs charging unattended on a combustible workbench surface.

Cell Configuration: Series vs. Parallel and DC-DC Conversion

The way you wire your cells dictates the DC-DC topology required by your UPS HAT. Series wiring increases voltage; parallel wiring increases capacity (Ah).

Configuration Nominal Voltage DC-DC Topology Needed Pros & Cons for Pi 5
1S (1 Cell) 3.7V Boost (Step-up to 5.1V) Simple BMS, but boost converters struggle to deliver 5A efficiently without high ripple.
2S (2 Cells Series) 7.4V Buck (Step-down to 5.1V) Optimal. Buck converters are highly efficient and easily handle the Pi 5's 5A peak transients.
3S (3 Cells Series) 11.1V Wide-range Buck Overkill for a Pi; requires heavier, more expensive UPS HATs designed for 12V router backups.

Charge/Discharge Limits and Hardware Selection

Lithium-ion NMC (Nickel Manganese Cobalt) cells have strict operational boundaries. The maximum charge voltage is 4.2V per cell (8.4V for a 2S pack), and the hard discharge cutoff is typically 2.8V per cell. Discharging below this threshold causes copper dendrite formation, permanently damaging the cell.

C-Rate Constraints

The C-rate defines how fast you charge or discharge relative to the battery's capacity. For our 6.4Ah 2S pack:

  • Charge Limit (0.5C): Maximum safe continuous charge current is 3.2A. At 7.4V, this requires ~23.7W of charging power.
  • Discharge Limit (1C to 2C): Standard 18650 cells easily handle a 1C continuous discharge (6.4A, or ~47W), which comfortably covers the Pi 5's 25W absolute maximum draw.

Inverter and Charger Sizing

In a DC microgrid like a Pi UPS, the "inverter" is the DC-DC buck converter, and the "charger" is the lithium charge controller. Your external AC-DC power supply must be sized to run the Pi and charge the battery simultaneously.

Total Adapter Sizing: Pi Max Load (25W) + Max Charge Power (23.7W) + 10% Converter Overhead = 53.6W.
Selection: A high-quality 12V / 5A (60W) AC-DC adapter (such as a Mean Well GST60A12) is the exact right fit. Undersizing this adapter will cause the Pi to brownout when the battery is deeply depleted and the system attempts to fast-charge it upon mains restoration.

For deep-dive IC specifications on how power-path controllers manage this switchover, review application notes on integrated charge path management from Texas Instruments Battery Management.

Frequently Asked Questions (FAQ)

How long will a 10,000mAh backup battery run a Raspberry Pi 4?

A standard 10,000mAh (10Ah) 1S lithium power bank holds 37Wh of energy (10Ah × 3.7V). A Raspberry Pi 4 idling with an SSD draws about 5.5W on average. Factoring in 85% usable DoD and 88% boost-converter efficiency, the usable energy is 27.6Wh. Divided by the 5.5W load, you will get approximately 5 hours of runtime. Note that this assumes the power bank does not auto-shutoff during low-load idle states.

Can I use a standard USB power bank as a Raspberry Pi backup battery?

No, standard USB power banks make poor UPS devices for two reasons. First, most feature an "auto-shutoff" function that turns the bank off if the draw drops below 50mA–100mA, which happens when the Pi enters deep sleep or halts. Second, they lack power-path management. When mains power drops, a standard power bank cannot simultaneously charge and discharge; it will physically disconnect the output to switch internal relays, causing a 200ms voltage drop that instantly crashes the Pi. You must use a dedicated UPS HAT with a seamless switchover IC.

What is the best lithium battery chemistry for a Raspberry Pi UPS?

The choice depends on your deployment environment. Use the decision matrix below to choose:

Criteria Li-ion NMC (18650 cells) LiFePO4 (LFP)
Energy Density High (250 Wh/kg) Moderate (140 Wh/kg)
Cycle Life ~500 cycles to 80% ~3,000+ cycles to 80%
Thermal Safety Prone to thermal runaway if punctured/overcharged Highly stable, no oxygen release during failure
Best Use Case Portable, space-constrained Pi builds (e.g., drones, rovers) Stationary 24/7 IoT gateways, off-grid weather stations

If your Pi is sitting in a closet acting as a Pi-hole or Home Assistant server, the bulkier LiFePO4 chemistry is vastly superior due to its decade-long cycle life and inherent fire safety.