Experimental high-current battery charger and programmable synchronous buck converter built around an STM32G474, HRTIM and an IR2113 gate driver.
Warning
This repository is an engineering snapshot of a hand-built prototype. The power stage and bring-up firmware work, but the battery charging algorithms are not finished or certified. The design uses a modified mains-powered ATX supply, high currents and lithium-capable output voltages. Do not connect a battery or mains power unless you understand the schematic, protections, isolation and measurement setup. Never charge lithium cells without a suitable BMS/balancer and supervision.
Hardware prototype: operational. Firmware: bring-up / experimental.
Verified on the assembled unit:
- complementary HRTIM PWM at approximately 50.8 kHz with measured dead time of about 200 ns;
- IR2113 high-side/low-side driver, MOSFET power stage, output inductor and battery relay;
- voltage ADC channels for input, auxiliary 12 V, buck output and battery;
- three parallel 10 mOhm current shunts, STM32 internal OPAMP and PWM-synchronous ADC sampling;
- DAC + COMP1 + HRTIM external-event hardware over-current shutdown path;
- reverse-polarity input and relay control;
- ST7735 160 x 128 display, rotary encoder and buttons;
- experimental CC/CV control loop;
- short bench operation up to 12.5 A without abnormal heating;
- approximately 20 mV p-p output ripple after adding two 1000 uF low-ESR output capacitors. This is a prototype measurement, not a guaranteed specification.
Still in progress:
- production-ready charge state machine and profile validation;
- Li-ion/LiFePO4, lead-acid and nickel charge termination algorithms;
- persistent calibration/settings;
- complete NTC-based thermal management and controlled fan logic;
- long-duration thermal, fault and battery tests;
- fabrication-ready PCB cleanup and a clean DRC result.
The current source is published so the implementation can be reviewed and improved. No ready-to-flash release binary is provided because the battery algorithms are not complete.
| Block | Current implementation |
|---|---|
| Controller | WeAct STM32G474CEU6 MiniCore, 104 MHz |
| Main input | Modified ATX supply, approximately 18.8-19 V |
| Converter | Synchronous buck, IRFB4110 MOSFET pair |
| Gate driver | IR2113, 12 V gate supply |
| PWM | HRTIM Timer A, complementary outputs, 5-95% test range |
| Current sense | 3 x 10 mOhm in parallel, Kelvin wiring, internal OPAMP PGA x2 |
| Fast protection | OPAMP output to PB1/COMP1, DAC threshold, HRTIM EEV6 shutdown |
| Voltage sense | Battery, buck output, 18.8 V input and auxiliary 12 V dividers |
| User interface | ST7735 160 x 128 TFT, encoder, START/MENU/RESET buttons |
| Output connection | 12 V automotive relay with reverse-polarity check |
| Path | Contents |
|---|---|
hardware/kicad/ |
KiCad 10 schematic, PCB, project and local libraries |
hardware/plots/ |
Schematic PDF and copper/silkscreen/edge PDF plots |
firmware/STM32G474_Charger/ |
STM32CubeIDE project and source |
docs/hardware-design-spec.md |
Detailed Russian engineering notes and design intent |
docs/firmware-architecture.md |
Firmware structure, pin map and bring-up history |
docs/status-and-validation.md |
Build, ERC/DRC and bench-test status |
docs/photos/ |
Full-resolution prototype photographs |
See hardware/README.md and firmware/README.md before opening or rebuilding the project.
The firmware was built successfully with STM32CubeIDE 1.18.0:
- Import
firmware/STM32G474_Chargeras an existing project. - Select the
Debugconfiguration. - Build the project.
Validation on 2026-07-19 completed with 0 compiler errors and 0 warnings. The resulting image size was 59,812 bytes of text, 120 bytes of data and 4,352 bytes of BSS.
The included KiCad project opens and exports with KiCad 10.0.1. Current checks:
- ERC: 0 errors, 3 warnings for symbols that differ from their library copies;
- DRC: 184 violations and 5 unconnected-item reports.
Many DRC messages are caused by local footprint copies, silkscreen overlap, manual overrides and the several physical board sections kept in one PCB file. There are also connection/edge-clearance items that require individual review. Do not send this PCB directly to fabrication. See docs/status-and-validation.md.
The complete set is in docs/photos and selected views are listed in docs/photo-gallery.md.
No project-wide open-source license has been selected for this first public snapshot. Project-specific hardware, firmware and documentation remain copyright Aleksei Subbotin. STMicroelectronics HAL/CMSIS files retain their upstream licenses. See LICENSE-NOTICE.md.
Это экспериментальное мощное зарядное устройство и регулируемый синхронный
buck-преобразователь на STM32G474 + HRTIM + IR2113.
Силовая часть собрана и работает: проверены ШИМ, dead-time около 200 нс,
драйвер и ключи, дроссель, реле, измерение напряжений и тока, синхронный опрос
АЦП, аппаратная защита через OPAMP -> COMP -> HRTIM, а также лабораторный
контур CC/CV. Кратковременно проверена нагрузка до 12,5 А. После установки двух
выходных конденсаторов 1000 мкФ low-ESR измеренная пульсация снизилась примерно
до 20 мВ пик-пик.
Но это ещё не готовая серийная зарядка. Полные алгоритмы заряда лития, свинца и никеля, завершение заряда, температурные защиты и длительные испытания ещё предстоит доделать. Исходники опубликованы как рабочий инженерный снимок для изучения и совместной доработки; готовую прошивку для безопасной зарядки аккумуляторов пока не выпускаем.
Схема, плата, исходники, инженерные заметки и фотографии находятся в соответствующих каталогах выше. Перед изготовлением новой платы обязательно надо разобрать текущие замечания DRC и сверить плату с фактически собранным экземпляром.


