Skip to content

wkcollis1-eng/DIY-LiFePO4-UPS

Repository files navigation

DIY UPS for Home Assistant Green & Xfinity XB7 Modem

12V LiFePO4-Based Uninterruptible Power Supply

License: MIT Status Runtime Switchover

A 12V LiFePO4-based uninterruptible power supply for keeping a Home Assistant Green and Xfinity XB7 cable modem running during grid outages. Built into an IP65 enclosure with Home Assistant monitoring via Shelly Plus Uni.

Honest context: A $85 APC BE600M1 provides comparable backup capability. This build costs roughly the same over 10 years as that option (based on battery replacements and electricity usage). The engineering rationale — longer battery life, faster switchover, direct HA integration, no DC-DC converter voltage regulation — is documented in design-rationale.md. Build this if those tradeoffs matter to you.


⚠️ Safety Warning

Caution

This project involves lithium batteries and AC mains voltage. Improper handling can cause fire, electric shock, or equipment damage.

  • Disconnect AC power before any work inside the enclosure
  • ✅ Use appropriate fusing on battery connections
  • ✅ Never charge LiFePO4 below 0°C (32°F)
  • ✅ Keep a Class B or ABC fire extinguisher accessible
  • ✅ Review docs/safety.md before building

Disclaimer: Information provided for educational purposes only. Build at your own risk.


Performance Summary

Validated Runtime: 4.25 hours to software shutdown (12.2V) and ~4.3 hours to hardware LVD (11.8V) under a sustained 14.5W load.

Key Finding

The UPS delivers a reliable ~4.3 hours of runtime at typical HA Green loads. This is ~55% of the theoretical maximum capacity of the 10Ah LiFePO4 battery.

This result is not due to battery degradation, measurement error, or software issues. It is a direct consequence of the single-rail 13.3V CV architecture.

Why the Runtime is Limited

The system uses a single shared rail for both charging and load. To keep the voltage safe for the connected equipment, charging is capped at 13.3V. This restricts the battery to approximately 65–75% SOC and prevents proper absorption charging at 14.4V. As a result, the top ~25–35% of the battery’s rated capacity is never accessible.

Discharge Characteristics

  • Extremely flat voltage plateau from 13.0V down to 12.8V (delivers the majority of usable energy)
  • Sharp “cliff” begins at ~12.45V, after which voltage drops rapidly
  • 12.4V warning provides an effective “immediate action” alert (~5–6 minutes before shutdown)

Conclusion

The system performs exactly as designed. The layered protection (voltage warnings → automated shutdown → BP-65 hardware LVD) is robust and safe.

Current validated specification: ~4.3 hours runtime at 14.5W under the existing single-rail topology.

A two-stage charging architecture (dedicated 14.4V charger + DC-DC regulator) would be required to approach the full ~7.8–8.5 hour theoretical runtime.

Report and Data can be found at: (docs/UPS_Validation_Report.md)

Last validated: March 2026 (Test D3)


Commissioning Results

Commissioning Results

The chart records a full two-cycle discharge test performed March 25–26, 2026 using a Netgear R6400 router (~7W DC) as a substitute load, with battery voltage logged via the Shelly Plus Uni at 5-second intervals.

Discharge 1 (7.76h): Voltage held the characteristic LiFePO4 flat plateau from 13.2V to 13.0V over 7.76 hours — a drop of only 0.2V at light load, confirming textbook cell behavior. Recharge (10.1h): AC restored; PSU returned the battery to float within minutes, peaking at 13.28V and holding stable through a 10-hour recharge window. Discharge 2 (9.36h): A second full discharge ran the battery to LVD cutoff. The Victron BP-65 tripped at 11.77V — within 0.03V of the 11.8V design target — confirming protection circuit accuracy. Post-LVD OCV rebound to 12.13V confirms healthy cell chemistry with no permanent capacity loss from the deep discharge.

Key findings:

  • Discharge plateau variance under 0.2%/hr
  • BP-65 cutoff accuracy ±0.03V
  • Internal resistance ~260mΩ at low SoC (derived from OCV recovery)
  • Bulk recharge from 12.9V to 13.2V completed in under 12 minutes after AC restoration

System Overview

AC grid powers a Mean Well HDR-60-12 PSU set to 13.3V float, which charges a 12V 10Ah LiFePO4 battery through a MOSFET ideal diode. On grid failure, loads switch directly to battery in under 1ms. A Victron BatteryProtect BP-65 disconnects loads at 11.8V to prevent over-discharge. A Shelly Plus Uni reports battery voltage and temperature to Home Assistant.

System Architecture


Key Specifications

Parameter Value
PSU Mean Well HDR-60-12, 13.3V float
Battery Cyclenbatt 12V 10Ah LiFePO4
Float voltage 13.3V (set on PSU trimmer)
LVD cutoff 11.8V (Victron BP-65, Setting 7)
LVD reconnect 12.8V (30s delay after threshold met)
Device voltage envelope 11.71–13.11V at terminals (2A worst-case)
Switchover time <1ms (MOSFET ideal diode)
Typical load 16.0W AC wall / 14.5W DC at devices (Kill-a-Watt measured)
Runtime at typical load ~7.8 hours (DC-based)
Battery lifespan 10–20 years (calendar aging at 13.3V float, 63–75°F)
Enclosure LeMotech IP65 ABS, 9.6″×7.6″×4.5″
Monitoring Shelly Plus Uni → Home Assistant
Total build cost ~$224

Operating Modes

Mode 1 — AC Present: PSU outputs 13.3V through ideal diode; battery held at float equilibrium. Loads draw from PSU, not battery.

Mode 2 — AC Failure: PSU output drops to 0V. Ideal diode blocks. Battery feeds loads directly, no interruption.

Mode 3 — Low Battery (~12.2V): Shelly detects threshold via ADC. Home Assistant initiates graceful HA Green shutdown; modem continues on battery.

Mode 4 — LVD Cutoff (11.8V): Victron BP-65 disconnects loads after 90-second hold-off.

Mode 5 — AC Restoration: PSU resumes 13.3V, ideal diode switches source, BP-65 reconnects after 30s hold-off.

System Architecture

Assembly Layout

Component Layout

Elevation (top) and plan (bottom) views of LeMotech junction box. Interior Dimensions in inches.

Assembly Pictures

Assembly Pics Assembly Pics

Documentation

File Contents
docs/bom.md Full bill of materials with vendor, price, and notes
docs/wiring.md From/To wiring tables, fuse locations, component mounting
docs/specifications.md Electrical, performance, and protection spec tables
docs/design-rationale.md Build-vs-buy analysis, float charging strategy
docs/component-selection.md Per-component selection rationale
docs/cost-analysis.md Build cost breakdown and 10-year lifecycle comparison
docs/safety.md AC and battery safety procedures
docs/voltage-drop-analysis.md Wiring resistance and voltage drop calculations
docs/supplemental-analysis.md Thermal Analysis & Enclosure Heat Budget, Runtime Analysis, Failure Modes & Effects Analysis (FMEA)
docs/design-specification.md Formal requirements, design decisions, and verification matrix
docs/commissioning.md System commissioning process and results
docs/Final_As_Built_Performance_&_Cost_Summary.md Final As-Built Performance & Cost Summary
docs/docs/UPS_Validation_Report.md Final Validation Report with Home Assistant configuration

Datasheets


Related Projects


Status

  • Design complete
  • Components specified
  • Components ordered / received
  • Build complete
  • XB7 power measurement complete (14.7W avg, 20.3W peak — 1.066 kWh / 72.4 hr standalone)
  • Combined system power measurement complete (16.0W avg, 23.0W peak — confirmed across 5 windows, 525 hours total)
  • Home Assistant automation documentation

Notes

  • Device input voltage tolerance (±10%) is inferred from IEC 62368-1 design practice; neither Nabu Casa nor Comcast publish explicit DC input voltage ranges for these products.
  • The PSU output trimmer is set to 13.3V and lacquered. Drift analysis shows expected aging drift of 3–5 mV/year — negligible relative to the 500mV headroom before OVP.
  • No DC-DC converter is used. The direct battery feed strategy is documented in design-rationale.md.

About

DIY 12V LiFePO4 UPS for Home Assistant Green and Xfinity XB7 modem. Victron BP-65 LVD, MOSFET ideal diode, 13.3V float, Shelly Plus Uni monitoring.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors