Skip to the content
PCBKitNew board
2 layers76 × 55.9 mmController, the printed circuit board in 3D

Controller

misch2/ups12v6

12V UPS

Size
76 × 55.9 mm
Copper layers
2
Thickness
1.6 mm
Parts
15
Nets
40
Pads
58
Tracks, vias
30, 9
Pours
3
Routed
Yes
KiCad
KiCad 8.0 (file 20240108)
Created
25 Feb 2024
Updated
7 Nov 2026

Overview

Controller is an open-source printed circuit board by misch2, from the misch2/ups12v repository on GitHub, published under the MIT licence. It is a 2-layer board of 76 × 55.9 mm with 15 parts on 40 nets, routed with 30 tracks and 9 vias.

Its parts include 2 resistors, 2 ICs and 1 connector. It belongs with the power boards and the ESP32 boards of this library.

README

README.md

Goal

A hobby project to create simple 12 V UPS to backup my router and mini PC. Both appliances use 12 volts on input. This UPS:

  • should be powered by 18650 batteries
  • does not need to run for a long time, 15 minutes is perfectly OK, 30 minutes is luxury
  • should allow some sort of monitoring, ideally with an HomeAssistant integration (for charts etc.)
  • should provide at least this amount of power
    • 1A (for router)
    • or 3A (for mini PC)
  • should run primarily from the main source and switch to the batteries only when the main voltage drops. This is to protect the batteries and charging circuit so that it doesn't need to constantly provide relatively high power for a device.
  • might allow powering off itself on request when running on batteries, to allow mini PC to automatically power on later after a shutdown.

Features

  • Can be controlled and monitored using HomeAssistant (ESP32C3 chip, ESPHome software)
  • 12 V / 3 A output
  • (optional) SW controllable output poweroff, can be used to power cycle the device attached to UPS
  • (optional) Battery calibration, i.e. one-off measuring of real available battery capacity.
  • (optional) UPS cut off on power loss and low battery, to allow for a full shutdown of both UPS and the attached device.

Inspiration

Version 1

Deployed to production, used for a backup of my Archer C6 router only. But it's mostly a proof of concept, with power limitations and without a proper PCB (components are just wired up together).

Schema: schema_v1.pdf

Some photos: photo1, photo2, photo3.

"boosterEnable" input is there not to save power but to prevent running the XL6009 booster in an undervoltage condition. This could have been implemented using a voltage comparator (LM311?) + schmitt trigger for hysteresis. I used software solution because tbne undervoltage condition doesn't occur "suddenly" but it's only a startup condition. And using software to control it allows me to use it for powering off the UPS when it runs on battery.

Development progress

Replaced AMS1117 with a buck converter due to a large voltage difference and therefore large heat dissipation with LDO.

Added XL6009 "EN" pin control (initial pull down + software control from ESP32).

Used Schottky diodes.

Added a diode between battery power line and XL6009 to prevent backpropagation of voltage when XL6009 is powered down.

The limitations were caused by:

  • BMS module for 18650 batteries can handle only 2A (FIXME?) of current. This is not enough for the mini PC.
  • INA219 module can handle only 3.2A of current. Again, this is not enough for the mini PC (especially not for the battery side of the UPS where the max current can easily be larger).
  • The specific XL6009 booster module doesn't have an undervoltage protection and it can produce more than 12 V on it's output when the input voltage is low. This is not good!

Anyway, this works well for the router. It can run for more than 2 hours from batteries because the router consumes only about 3 watts and the output current is therefore mostly below 300 mA. So I might call this a success ✅!

Version 1.5

I wanted to overcome the limitations of the first version and to make it handle larger current to power the mini PC which might need up to 3 A. This higher current would also require something better than the INA219.

I also added relays to allow the UPS to be powered off completely when running on batteries. This is to allow the mini PC to power on automatically after a power outage. And a 2nd relay allows to power cycle the UPS or to run calibration.

ACS712 sensors paired with an ADS1115 ADC are used for current and voltage monitoring. It can handle up to 20 A.

A pair of XL74610 ideal diodes is used instead of Schottky diodes in v1, to achieve a lower voltage drop and to allow for higher currents.

TP5100 charger module is used for charging the batteries, combined with BMS for 2S 8.4V/20A.

Alas, while everything looked good on the paper, reality was different ❌. The "better" booster module (LM2587 version) advertises up to 5A and 30W, but something might be wrong with it. I'm not able to pull more than 1 A from the UPS, the voltage drastically drops if I try to pull more.

Possible causes (investigating ⌛):

  • Batteries don't provide enough current? Not very probable, I'm using 3000 mAh cells from a reputable manufacturer.
  • BMS module can't handle the current? It should be able to handle 20 A but does it?
  • Booster module can't handle the current? It should be able to handle 5 A but does it?
  • Something else?

An idea: disconnect the LM2587 booster and attach an electronic load to the battery instead of it. Then try to pull whatever it takes to see if the batteries can provide the current. If they can, then the problem is with the booster. If they can't, then the problem is with the batteries or BMS.

Result: ⌛

FIXME TODO

Maybe this was a completely bad approach. Sticking to 2x 18650 doesn't make sense if I need to pull 3 A. I should have used 4S 18650 (13.6 V - 16.8 V) and eliminate the boost converter completely. When stepping down to 12 V, the current would be lower and the voltage drop would be lower. Also no need to stick with 12 V and a boost converter on input.

Version 2

Using BQ25798 battery charger IC from Texas Instruments. According to the datasheet it can handle up to 5 A on the output and 3A on the input and has a built-in buck-boost converter usable for either battery charging or for the UPS backup mode. It can also be controlled and monitored extensively using I2C.

Product info: https://www.ti.com/product/BQ25798

Most important features:

  • Buck-boost charger for 1-4 cell batteries
  • Narrow voltage DC (NVDC) power path
  • Backup Mode with Ultra-fast switchover to adjustable voltage
  • Flexible autonomous and I2C mode for optimal system performance
  • Intelligent current management to prevent source overload when charging batteries
  • Integrated 16-bit ADC for voltage, current, and temperature monitoring

It's essentially a battery charger capable of using boost converter to charge the batteries, but it can also detect a drop in input voltage and switch to the backup mode aka battery mode very fast. In the backup mode it works as buck converter and uses the batteries to power the load.

So, theoretically, with this IC I can eliminate all the former external circuitry because BQ25798 will take care of both charging the batteries and providing power to the load. And it has hundreds of I2C registers to set up and monitor the system.

Normal mode power path:

Backup mode power path:

Inductor selection

See page 133 of datasheet:

text
L = 2.2 µH (only two inductor values are available: 2.2 µH and 1 µH)

Isat >= MAX((Iin + Iripple/2), Ichg + Iripple/2)

Iripple_buck = Vsys / Vbus * (Vbus - Vsys) / (Fsw * L)
Iripple_boost = Vbus /Vsys * (Vsys - Vbus) / (Fsw * L)

For my purposes (12 V input, 12 V output, 4S Li-Ion battery pack, 3 A power source) the values are:

text
Iin = 3 A (input current)
Vbus = 12 V (input voltage)
Vsys = +16.8 V (battery voltage)

Iripple_buck = 12 V / 16.8 V * (16.8 V - 12 V) / (750 kHz * 2.2 uH) = 3.43 / 1.65 = 2.08 A
Iripple_boost = 16.8 V / 12 V * (12 V - 16.8 V) / (750 kHz * 2.2 uH) = -6.72 / 1.65 = -4.07 A

Isat >= MAX(5.08 A, 7.07 A) = 7.07 A
PROG resistor selection

See page 25 of datasheet:

2.2 uH inductor requires 750 kHz switching frequency. Therefore the PROG resistor = 27 kOhm which means:

  • Switching frequency = 750 kHz
  • Cell count: 4
  • ICHG: 1 A
  • VSYSMIN: 12 V
  • VREG: 16.8 V (range 14 V - 18.8 V)

Principle:

Forward (battery charge) mode:

In this mode PMID follows VBUS, i.e. it's not regulated. PMID is also the input to the buck-boost converter.

Battery backup mode:

The FETs between AC1 and VBUS provide reverse blocking (prevents battery voltage from being seen at VBUS). PMID is output of the buck/boost converter.

Parts

15
QtyValueFootprintReferences
4MountingHoleMountingHole:MountingHole_3.2mm_M3H1, H2, H3, H4
22k2Resistor_SMD:R_0805_2012MetricR1, R2
1G***kibuzzard-6810F0CDkibuzzard-6810F0CD
1G***kibuzzard-6810EFE9kibuzzard-6810EFE9
1G***kibuzzard-683D9CD5kibuzzard-683D9CD5
1G***kibuzzard-6810F0D5kibuzzard-6810F0D5
1G***kibuzzard-6810F0BFkibuzzard-6810F0BF
1G***kibuzzard-6810F062kibuzzard-6810F062
1I2C etc.Connector_JST:JST_XH_B6B-XH-A_1x06_P2.50mm_VerticalJ1
1Micro step down converterModules_MCU:Micro stepdown converterU2
1mini_esp32 MH-ET-LiveModules_MCU:ESP32_mini MH-ET-LIVEU1

Questions

How big is the Controller PCB?

It measures 76 × 55.9 mm and has 2 copper layers, 1.6 mm thick.

What parts does the Controller use?

15 parts. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the Controller KiCad files?

From the misch2/ups12v repository on GitHub, at the commit this page was made from: the board is hardware/v2-3/controller/controller.kicad_pcb and its schematic hardware/v2-3/bq25798_breakout_board/Controller.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Controller design in my own project?

Its repository publishes it under the MIT licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).

More from misch2/ups12v

3
  • 4 layers21.6 × 21.6 mmUps12v, the printed circuit board in 3D

    Ups12v

    misch2/ups12v

    12V UPS

    5 parts6MIT

Similar boards

  • 2 layers19 × 76 mmSub, the printed circuit board in 3D

    Sub

    google/mozc-devices

    Circuit diagrams and firmware source code for Gboard DIY keyboards

    15 parts3kApache-2.0
  • 2 layers26.7 × 62.2 mmDeniseadapter, the printed circuit board in 3D

    Deniseadapter

    hoglet67/RGBtoHDMI

    Bare-metal Raspberry Pi project that provides pixel-perfect sampling of Retro Computer RGB/YUV video and conversion to HDMI

    15 parts1kGPL-3.0
  • 2 layers100 × 44 mmVideoslot, the printed circuit board in 3D

    Videoslot

    mntmn/amiga2000-gfxcard

    MNT VA2000, an Open Source Amiga 2/3/4000 Graphics Card (Zorro II/III), written in Verilog

    15 parts1k
  • 2 layers91 × 51 mmBusinessCard, the printed circuit board in 3D

    BusinessCard

    hackclub/OnBoard

    💡 Join 1,000 teenagers and make your first PCB with a $100 grant!

    15 parts915
  • 2 layers24.3 × 57.9 mmFlosspods pro flex, the printed circuit board in 3D

    Flosspods pro flex

    kenp-io/not-for-airpods-repairs

    The content of this repository is licensed under the WTFPL License. Please have a close look at the terms before using this material.

    15 parts609WTFPL
  • 2 layers20.3 × 15.2 mmL0 Load, the printed circuit board in 3D

    L0 Load

    Luos-io/luos_engine

    Open-source and real-time orchestrator for cyber-physical-systems, to easily design, test and deploy embedded applications and digital twins.

    15 parts546MIT
  • 2 layers68 × 50 mmEleLab v2 PowerFeed, the printed circuit board in 3D

    EleLab v2 PowerFeed

    Chrismettal/EleLab_v2

    Cheap DIY lab system for hobbyists and the tinkering folk

    15 parts531GPL-3.0
  • 2 layers50.8 × 35.6 mmInterface, the printed circuit board in 3D

    Interface

    harbaum/I2C-Tiny-USB

    Cheap and simple I²C to USB interface

    15 parts454