Preface
Recently discovered an embedded software and hardware in making and open source project - based on STM32G0 lithium battery quick charging scheme, using the Type C interface of charging power supply, based on STM32G0 implementation, support for 1 s - 4 s lithium batteries, and support the 2 s to 4 s balance charge function,
At present, the project has been listed as a product production, in the hackaday mall sells for $60,
P.s. At the end of the article is a portable Type C power supply the soldering iron to try to apply for welfare!
The basic function
Basically has the following functions:
Single section lithium battery and 2 s to 4 s lithium battery charging balance
Support USB PD power source, charging up to 60 w
Support the USB PD power (limited to 2.5 W - 5 v, 0.5 A)
Temperature rise as device automatically reduce charging power
Through the RGB LED to provide user feedback
Open source schematic, BOM and firmware
Used for debugging and runtime information of UART command line interface
Currently has the following types of USB PD fast charging source test:
Lenovo Thinkpad 65 w Charger
Lenovo Thinkpad X1 Carbon USB Port C
Anker PowerPort Atom PD 30 w 1
Aukey PA - 27 w Y8 Turbo Charger
Nintendo Switch Power Supply
Generic USB 2.5 W A Wall Wart
Involves the knowledge
Lithium battery charge balance circuit, and MCU control logic
STM32G0 official USB PD quick charge agreement middleware use
Run FreeRTOS, can interact through the CLI command line
Use a Makefile or compile TrueStudio
STM32G071CBT6 GPIO/ADC/basic peripherals using UART/IIC/TIMER/DMA
BQ25703ARSNR lithium battery management chip using
Hardware circuit
Principle diagram is also very simple, only three pages, the hardware diagram of the whole project is as follows:
Main control part adopts STM32G071, this is ST at the end of 2018 launched one of MCU + kernel architecture (M0, IO mouth utilization rate more than 93%, one of the biggest characteristic is to support the USB - C Power Delivery, many charging treasure are implemented based on the chip,
Charging part of the circuit, single section of lithium battery charging scheme USES is TI lithium battery management chip BQ25703ARSNR,
Multiple class lithium battery charge balance is the MOS switch control circuit, the resistance partial pressure to real-time monitor the battery voltage state, the battery voltage as a feedback, so as to realize balanced filling function,
Software implementation
Software, the development environment using TrueStudio, use CubeMX basic driver code, generate FreeRTOS transplantation, STM32G0 GPIO, ADC, IIC, TIMER, DMA, the use of basic UART peripherals, STM32G0 the use of USB drive C library, abnormalities in the protection logic and charge control logic, can charge the battery via a serial port terminal real-time monitoring the status of: