
Introduction
Recently, I discovered a project on GitHub that is an open-source embedded hardware and software project — a fast charging solution for lithium batteries based on STM32G0, powered by a Type C interface charger, implemented with STM32G0, supporting charging for 1s – 4s lithium battery packs, and also supporting 2s-4s balance charging functionality. At the end of this article, there is a download link for the complete materials.

Currently, this project has been mass-produced and is available for sale at a price of 60 dollars.

Basic Functions
The main features include:
- Single lithium battery and 2s-4s lithium battery pack balance charging
- Supports USB PD power, charging up to 60W
- Supports non-USB PD power (limited to 2.5W – 5V, 0.5A)
- Automatically reduces charging power as device temperature increases
- Provides user feedback via RGB LED
- Open-source schematics, BOM, and firmware
UART command line interface for debugging and runtime information

Currently, tested with the following models of USB PD fast charging power supplies:
- Lenovo Thinkpad 65W Charger
- Lenovo Thinkpad X1 Carbon USB C Port
- Anker PowerPort Atom PD 1 30W
- Aukey PA-Y8 27W Turbo Charger
- Nintendo Switch Power Supply
- Generic 2.5W USB A Wall Wart

Knowledge Points Involved
- Lithium battery balance charging circuit and its microcontroller control logic
- Using STM32G0 official USB PD fast charging protocol middleware
- Running FreeRTOS, with interactive CLI commands
- Using Makefile or TrueStudio for compilation
- Basic peripherals usage of STM32G071CBT6 GPIO/ADC/UART/IIC/TIMER/DMA
- Using BQ25703ARSNR lithium battery charging management chip

Hardware Circuit
The schematic is quite simple, only 3 pages. The hardware block diagram of the entire project is as follows:

The main control part uses the STM32G071, which is an MCU with a Cortex-M0+ core launched by ST at the end of 2018, with an I/O utilization rate of over 93%. The biggest feature is that it supports USB-C Power Delivery, and many power banks are based on this chip.

The charging circuit uses the TI lithium battery charging management chip BQ25703ARSNR for single lithium battery charging schemes.

The multi-cell lithium battery balance charging is achieved using a MOS switch regulation circuit, with a resistor divider method to monitor the battery voltage status in real-time, and the battery voltage is used as feedback to achieve balance charging functionality.

Software Implementation
On the software side, the development environment used is TrueStudio, with CubeMX generating the basic driver code, porting FreeRTOS, using STM32G0’s GPIO, ADC, IIC, TIMER, DMA, UART basic peripherals, and the STM32G0 USB C driver library, along with exception protection logic and charging management logic. The charging status can be monitored in real-time via the serial terminal:
Data Download
Whether you attempt to make one yourself or not, the principles behind the lithium battery charging circuit and the use of the STM32G0 fast charging library are worth learning and referencing. The complete materials includeschematics, PCB, BOM, STL case files, etc.
- Software
github.com/AlexKlimaj/LiPow-Firmware - Hardware
github.com/AlexKlimaj/LiPow-Hardware
Author: wcc149
Source: Electronic Circuit Development Learning
‧‧‧‧‧‧‧‧‧‧‧‧‧‧‧‧ Benefits ‧‧‧‧‧‧‧‧‧‧‧‧‧‧‧‧
Recently, the Breadboard Community is holding a trial activity, where one of the portable electric soldering irons with a Type C interface is quite good. As long as you write a detailed evaluation plan, you can get it for free. Click the bottom left Read the original text to enter the application address.
