To run a Raspberry Pi 5 (peak 15W, average 8W) for 24 hours on a reliable RasPi UPS, you need a 12V 40Ah LiFePO4 battery bank paired with a 5V 5A USB-C PD DC-DC buck converter and a 10A MPPT charge controller. Avoid using a 12V-to-120V AC inverter just to plug in the Pi’s stock USB-C power supply; double-conversion losses will waste up to 30% of your battery capacity. A DC-coupled architecture is the standard for efficient embedded backup power.
The Anatomy of a DC-Coupled RasPi UPS System
A robust RasPi UPS avoids the inefficiencies of AC inversion by keeping the entire power path in direct current (DC). Here is the exact system block description from source to load:
- Source: 120V AC wall adapter (stepped down to 12V DC) OR a 100W 12V nominal solar panel.
- Charge Controller / UPS Management: A 10A MPPT solar charge controller (for off-grid) or a dedicated UPS HAT with power-path management (for grid-tied backup). This board handles battery charging and load-sharing.
- Energy Storage: 12V LiFePO4 (Lithium Iron Phosphate) battery bank. This acts as the system buffer.
- DC-DC Step-Down (Buck) Converter: A high-efficiency 12V-to-5V step-down module rated for at least 5A continuous output, terminating in a USB-C PD cable.
- Load: Raspberry Pi 5 (requires 5V @ 3A minimum, 5A recommended for full peripheral support).
By utilizing a power-path management IC on the UPS HAT, the system seamlessly switches between the wall/solar source and the battery without dropping the 5V rail, preventing the Pi from resetting during grid flickers.
Sizing the Battery Bank and Inverter/Charger
Sizing a battery bank requires calculating the total Watt-hours (Wh) needed, then adjusting for converter efficiency, Depth of Discharge (DoD), and Peukert’s Law. Let’s size for 24 hours of continuous runtime for a Raspberry Pi 5 running a moderate Python script and a USB Wi-Fi dongle.
The Sizing Math
- Base Load: 10W average draw (accounts for idle and compute spikes).
- Target Runtime: 24 hours.
- Raw Energy Needed: 10W × 24h = 240Wh.
- Efficiency Factor: A quality DC-DC buck converter operates at ~92% efficiency. 240Wh / 0.92 = 260.8Wh required from the battery.
- Peukert’s Law Adjustment: Peukert’s Law dictates that battery capacity decreases as discharge rate increases. However, at a 10W draw from a 40Ah battery, the discharge rate is roughly 0.03C. For LiFePO4 chemistry, the Peukert exponent (k) is effectively 1.0 at this low C-rate, meaning zero capacity loss. (If you were using Lead-Acid, you would lose roughly 15% of your capacity at this rate).
- Depth of Discharge (DoD): To achieve 3,000+ life cycles, LiFePO4 should not be discharged below 20% State of Charge (80% DoD). 260.8Wh / 0.80 = 326Wh total nameplate capacity required.
- Amp-Hour (Ah) Conversion: 326Wh / 12.8V nominal = 25.4Ah.
Verdict: Select a 12V 30Ah LiFePO4 battery as the absolute minimum, or a 12V 40Ah pack to provide a safety margin for aging and winter temperature derating.
Inverter and Charger Sizing
While the Pi runs on DC, your RasPi UPS might also need to power auxiliary AC loads, such as a 40W network switch or a 50W Starlink router. If adding a 12V DC-to-AC inverter, size it at 1.5× the continuous AC load. A 90W continuous load requires a 150W minimum inverter; purchase a 300W pure sine wave inverter to handle startup surges.
For the charger, LiFePO4 batteries should be charged at a maximum of 0.5C to preserve longevity. For a 40Ah battery bank, your charge controller or AC-to-DC power supply must be limited to 20A maximum.
| Component | Specification | Wire Gauge (AWG) |
|---|---|---|
| Battery Bank | 12V 40Ah LiFePO4 (4S1P or 4S4P) | 10 AWG to BMS |
| DC-DC Buck Converter | 12V to 5V, 5A continuous, USB-C PD out | 16 AWG input, USB-C output |
| Charge Controller | 12V MPPT, 10A to 20A max | 12 AWG from panel/battery |
| Auxiliary AC Inverter | 300W Pure Sine Wave (if AC loads exist) | 8 AWG (short run < 3ft) |
Charge/Discharge Limits and Cell Configuration Rules
Understanding how cells are configured is critical when building or buying a battery pack for your RasPi UPS. The consequences of series vs. parallel wiring dictate your system voltage and capacity:
- Series (S): Increases voltage, capacity (Ah) remains the same. Four 3.2V LiFePO4 cells in series (4S) yield 12.8V nominal.
- Parallel (P): Increases capacity (Ah), voltage remains the same. Four 10Ah cells in parallel (1P) yield 40Ah at 3.2V.
- Combined (4S4P): Sixteen 3.2V 10Ah cells wired in a 4S4P configuration yields a 12.8V 40Ah battery bank.
LiFePO4 charge and discharge limits are generally forgiving, but you must respect the manufacturer's C-rates. A standard 40Ah pack allows a 1C continuous discharge (40A) and a 0.5C charge (20A). Because the Raspberry Pi 5 draws roughly 1.2A from a 12V system, it operates at a microscopic 0.03C discharge rate, which generates virtually zero heat and maximizes cell life.
RasPi UPS Sizing and Troubleshooting FAQ
How long will a 12V 20Ah battery run a Raspberry Pi 5?
A 12V 20Ah LiFePO4 battery holds 256Wh of energy (12.8V × 20Ah). Applying an 80% Depth of Discharge limit leaves 204.8Wh of usable energy. Assuming an average Pi 5 draw of 8W and a 92% efficient DC-DC buck converter, the usable energy at the 5V rail is roughly 188Wh. Dividing 188Wh by 8W yields 23.5 hours of runtime. If the Pi is under heavy compute load (12W average), runtime drops to approximately 15.6 hours.
Can I use standard 18650 Li-ion cells instead of LiFePO4 for my RasPi UPS?
Yes, but it requires a different topology and carries higher risks. Standard Li-ion (NMC) cells have a nominal voltage of 3.7V and a fully charged voltage of 4.2V. To achieve a ~12V system, you must wire them in a 3S configuration (11.1V nominal, 12.6V fully charged). You must ensure your DC-DC buck converter can handle the 12.6V peak input, and your charge controller must have a strict 4.2V/cell cutoff. Li-ion offers higher energy density but suffers from a much shorter cycle life (500 cycles vs 3,000+ for LiFePO4) and a significantly higher thermal runaway risk if the BMS fails.
Why does my Raspberry Pi reboot when the UPS switches to battery power?
This is caused by voltage sag during the mechanical or solid-state switchover. The Raspberry Pi 5 brownout detector is highly sensitive and will trigger a hard reset if the 5V rail drops below 4.65V for even a few milliseconds. To fix this, you must bridge the switchover gap. Solder a 4700µF low-ESR electrolytic capacitor directly across the 5V and GND pins on the Pi’s GPIO header, or upgrade to a UPS HAT that features an onboard supercapacitor array designed specifically for ride-through power.
What size solar panel do I need to keep a RasPi UPS charged off-grid?
Use the solar sizing formula: Panel Wattage = Daily Wh / (Peak Sun Hours × 0.7 System Efficiency). If your Pi consumes 240Wh per day and your location averages 4 peak sun hours, the math is: 240 / (4 × 0.7) = 85.7W. You should install a 100W 12V monocrystalline solar panel. In winter months or high-latitude regions where peak sun hours drop to 2, you must double the array to a 200W panel to prevent the battery bank from entering a chronic deficit.






