Building a Robust UPS: A Developer's Technical Deep Dive

Building a Robust UPS: A Developer's Technical Deep Dive

KICAD Files

Project Overview

As a former school project of Jesse, this project article will walk you through the same way he did.
The core objective of this project was to design and build an Uninterruptible Power Supply (UPS) capable of providing 30W at 12V for two hours during a mains power loss, specifically targeting small devices like Wi-Fi routers. This report details the technical architecture, component choices, and the problem solving process from my perspective.

System Architecture

The UPS design was modular, divided into four critical subsystems: Safe Charge, Safe Discharge, Battery Protection, and the Microcontroller System Driver.

I. Battery and Charging (Safe Charge)

The system relies on LiFePO₄ cells for their enhanced safety characteristics compared to Li-ion alternatives. A significant design challenge was implementing an efficient Constant Current / Constant Voltage (CCCV) charging circuit.

Initial Challenges and Evolution:

  • Linear Regulators: Early attempts utilizing linear regulators (like the LM317) and basic transistor circuits proved too inefficient, dissipating excessive power.
  • The Switch to DC-DC Buck: The final design transitioned to an efficient DC-DC buck CCCV converter to minimize power loss.
  • FET Selection Problem: During the circuit implementation, an N-channel FET (IRL530N) was initially used for switching. However, the measured gate-source voltage was too low (2.6V), preventing the FET from fully turning on and leading to excessive heat dissipation outside of its safe operating area.
  • The Solution: This issue was resolved by replacing the N-channel FET with a P-channel FET (IRF5305), which operated safely within its specifications, drastically reducing power loss.

Electronics Circuit Schematic CCCV Circuit of an UPS

II. Battery and Discharging (Safe Discharge)

UPS Project Cells

Safe discharge was crucial to protect the battery pack and maintain a stable output.

Current Limiting and Cutoff Voltage:

  • The raw minimum cell voltage for the LiFePO₄ cells is 2.5V (17.5V total for 7 cells). To guarantee stable delivery of the required 19V output (a planned upgrade feature), we made the engineering decision to raise the under-voltage cutoff to 2.9V per cell (a total of 20.3V). This sacrifices a part of total capacity for improved output stability.
  • The maximum discharge current was limited to 4A to protect the cells.
  • For the output stage, where a maximum of 3A at 19V (57W) was required, a buck converter with a controllable feedback pin was used to implement current limiting.

UPS DC-DC converter schematic

III. Battery Protection and Microcontroller

UPS Project, screen

To manage complexity and meet project deadlines, a dedicated Integrated Circuit (IC) was chosen for the Battery Management System (BMS).

BMS and Monitoring:

  • We selected the BQ76930 IC for its integrated capabilities, handling core functions: thermal protection, passive cell balancing, and discharge protection.
  • The IC communicates with the main system driver via I²C.
  • The chosen microcontroller is an ESP32, which manages the data monitoring, communicates with the BQ76930, and drives the display interface.

Microcontroller Software (Arduino-C):

  • The control software was developed in Arduino-C. A primary challenge was adapting an existing BQ76930 library, and debugging incorrect readings due to an incorrectly signed 16-bit integer for current readings.
  • Safety is managed by an if-statement loop executing every 250ms to check for overcurrent (> 4.05A), under-voltage (<= 19.6V), and over-temperature (> 45°C), triggering FET shutdowns and placing the BMS chip into shipmode for deep discharge protection.

IV. Final Result and Performance

UPS Project Complete

Despite significant delays caused by the need for multiple redesign cycles (e.g., for the charging circuit) and inconsistent documentation, all core UPS functions were successfully designed, built, and tested.

Key Performance Metrics (Measured on Final Prototype, on Net Power):

Output Load (Watt) Output Voltage Input Power (Watt) Efficiency (%)
12V DC-Jack ~29.5W 11.79V 33.6W ~87.7%
19V DC-Jack ~37.4W 18.68V 42.0W ~89.0%
USB-PD (12V) ~24.1W 12.04V 28.0W ~86.0%

The measured efficiencies were highly satisfactory, demonstrating the success of switching from inefficient linear regulators to buck converters in the final prototype.

Contingency/Future Features:

Features like the Web Interface, Solar charging, and full USB Power Delivery (which was partially addressed by using a pre-built module) were treated as contingency options due to time constraints, but the architecture is prepared for their eventual integration.

One Small Problem

There is one thing me and my project partner didn't manage to fix in time for the deadline.

The issue is, we did not separate the GND of the BMS from the general GND. Leading to a whole range of issues, including improper shutdown, and problems with the charging circuit.

UPS Project Patch

Try It Yourself!

Feel free to fix the circuit and take it for a spin yourself! We have the KICAD Files HERE

Back to blog

Leave a comment