LiPow - The USB C LiPo Battery Charger

USB Power Delivery based lithium polymer battery charger

Public Chat
Similar projects worth following
This project uses USB Type C with Power Delivery to charge Lithium Polymer batteries. It supports charging 1s-4s batteries and supports balancing for 2s-4s packs. The device supports charging up to 100W (16.8V at 6A).

Input is a USB Type C Port. Charging is done through an XT60 connector and has JST connectors for balancing 2s-4s packs.

The device will be pre-programmed with a fixed max current limit of 6A. Everything runs automatically and will charge up to the max capability of the connected USB PD power supply if the max current output limit exceeds the input power supply. Lower current limits can be programmed as well.

The only user feedback is through an RGB LED.

I got the idea for this project while on a vacation where I only took a single 65W USB C power supply from my Thinkpad to charge the laptop, Nintendo Switch, and cell phone. Having worked with hobby style lithium polymer batteries and bulky chargers, I thought it would be nice to have a small device that could charge LiPo batteries from a USB C power supply.

Input is a USB Type C Port. Charging is done through an XT60 connector and has JST connectors for balancing 2s-4s packs.

The device will be pre-programmed with a fixed max current limit up to 6A. Everything runs automatically and will charge up to the max capability of the connected USB PD power supply if the max current output limit exceeds the input power supply.

The only user feedback is through an RGB LED.

A STM32G0 microcontroller controls runs the system and handles USB PD communication. TI makes the perfect programmable buck boost regulator for this project with the BQ25703A. It accepts input voltage from 3.5V to 24V and the output is meant to charge lithium batteries up to 4s with a current limit of 6.35A. It is programmed through I2C.

A 3.3V linear regulator was needed to provide power for the electronics. The hardest part is that it needs to accept up to 20V on the input due to the power delivery specifications. The IFX25001 from Infineon accepts up to 45V and is a good fit for the project.

I chose to have balance ports for 2s-4s packs for balancing with charging done through an XT60 connector. Originally I was going to support charging through the balance ports, but the typical gauge of wire used for those connections would severely limit the charging current. I also had to design a circuit to automatically route the output from the regulator to the top cell depending on what type of pack was connected. I designed the circuit and thought it was pretty clever, but ultimately, made the decision to reduce complexity and support higher charging current by going with an XT60 connector.

Balancing is controlled by the STM32G0. It monitors the cell voltages using its ADC through voltage dividers to scale the voltage to safe levels. Open drain level shifters were needed to control the PFETs used for discharging. Because of this, it create a large VGS on the PFETs, up to the max of a 4s pack ~16.8V. I needed to find PFETs that could handle 20V VGS.

step - 5.58 MB - 12/17/2018 at 05:09



Updated schematic with the discrete USB PD Phy chip removed and the STM32F0 replaced with a STM32G0.

Adobe Portable Document Format - 859.29 kB - 12/17/2018 at 05:05


Adobe Portable Document Format - 878.21 kB - 11/14/2018 at 23:08


  • Status Update

    Alex Klimaj02/25/2019 at 06:03 0 comments

    It's been a while since I've posted an update for this project but I have been making progress on the firmware. Everything except for the USB PD code and a master state machine is finished. I successfully got it charging 4S batteries this last week. My plan is to try and get this to a state where I would be comfortable sending people beta units in the next couple of week.

  • Command Line Interface Up and Running

    Alex Klimaj02/02/2019 at 02:08 0 comments

    I have the FreeRTOS Command Line Interface up and running on the STM32G0 over the UART

    I plan on the stats command showing the entire state of the system. As well as an interface to modify the charging parameters on the fly.

    I only have the scaling done for the Battery and Cell One ADCs.

    Here is the current state of the CLI.

    Starting LiPow.
    Type Help to view a list of registered commands.
     Lists all the registered commands
     Displays a table showing the system stats
    [Press ENTER to execute the previous command again]
    Variable                Value
    Battery Voltage (V)     15.310484
    Cell One Voltage (V)    3.795976
    Cell Two Voltage (V)    0.000000
    Cell Three Voltage (V)  0.000000
    Cell Four Voltage (V)   0.000000
    MCU Temperature (C)     0.000000
    [Press ENTER to execute the previous command again]

  • ADC Up and Running!

    Alex Klimaj01/29/2019 at 06:58 0 comments

    The ADC is up and running on the STM32G0 using DMA! All raw values are being read. So far I have only taken measurements for the Battery Voltage calculation.

    The code can be found here.

    Here is where I am collecting the data for the ADC input calculations.

  • Blinky - FreeRTOS Up and Running!

    Alex Klimaj01/09/2019 at 01:38 0 comments

  • PCBs Have Arrived!

    Alex Klimaj01/04/2019 at 22:27 0 comments

    PCBs arrived from China last week. I spent lastnight building up one complete board. Powered it up with 5V from a bench supply and everything is looking good. No smoke and it appears the STM32G0 is happy. Next step will be to flash some firmware and blink the LED. I'm still not sure that state of the USB PD library from ST for the G0 series. I will need to do some research.

  • Rev 2.0 Posted!

    Alex Klimaj12/17/2018 at 05:18 0 comments

    I ended up never ordering Rev 1.0 of this project. ST just released the new STM32G0 series of microcontrollers that have a USB PD phy built in. I replaced the STM32F0 with a STM32G0 and removed the discrete phy IC. Overall this should save on the BOM cost.

    I will be ordering PCB's for this version and hand building a few units for initial bring up and firmware development before ordering a larger quantity fully assembled.

  • Layout finished! Sending out for Prototypes

    Alex Klimaj12/02/2018 at 02:12 0 comments

    I have finished the layout for the charger. I initially started the layout realizing that I needed to change the placement of the programmable regulator. Overall, I am happy with the overall placement and layout. The high power path is very short and clean from the USB C connector, through the fuse, to the regulator, then from the regulator to the output FET and XT60 connector.

    The overall size ended up being 59mm x 47mm. Eventually I will need to design and 3d print a case.

    I have sent the outputs to a few different places for prototypes. Next step will be ordering PCBAs and writing firmware. I purchased a couple of STM32F0 dev boards to get going before the boards show up.

  • V1.0 Schematic Uploaded

    Alex Klimaj11/09/2018 at 05:52 0 comments

    I have uploaded a "finalized" V1.0 of the schematic and done most of the placement. It is looking like it will fit in 60mm x 55mm of board. Possibly smaller.

    I decided to remove the 1s connector and replaced it with a right angle XT60 connector to support higher current charging. Not charging through the balance ports allowed me to get rid of the circuitry that automatically routed the power to the top cell.

    I discovered that I had overlooked the high Vgs on the mosfets of the balance circuit. The original part I specced had a max Vgs of +-8V. Well below the 16.8V max that it will see with the open drain driver to ground and a pullup to the cell voltage. I have swapped the mosfet for one with a +-30V max Vgs rating.

    I've also added a cover sheet with a block diagram of the system.

  • Schematic Almost Done

    Alex Klimaj11/04/2018 at 04:52 0 comments

    I have uploaded V0.2 of the schematic. Here is everything that has changed from V0.1.

    • Added ESD diodes on USB C CC nets.
    • Added single use fuse on VBUS. I wanted to use a re-settable fuse, but finding one that works up to 20V 5A that is small and cheap is tough. So I went with a one time fuse.
    • Added balancing circuity.
    • Switched to a slightly larger version of the STM32 to support all the IO needed. I initially underestimated the amount of GPIO's needed for the project.
    • Added voltage divider networks for the ADC inputs to the STM32 for reading individual cell voltages.
    • Added RGB LED for debugging and user feedback.
    • Added UART from the STM32 for debugging. I may still add a UART to USB bridge for programming through the USB C port.
    • Added 3.3V linear regulator. Needed to support up to 20V from Vbus and be a low drop out when VBUS is 5V.
    • Added circuit to automatically steer the output of the adjustable regulator depending on what type of battery is connected (1s-4s).

    I still need to add the supporting components around the adjustable regulator.

  • Very early schematic uploaded

    Alex Klimaj10/25/2018 at 04:19 0 comments

    I have uploaded a very early schematic. All the major building blocks are there but a lot of little things still need to be added.

    I have gone with JST XH connectors for the Lipo Balance connections. I will need to decide how the output of the regulator gets used for charging the highest cell in each balance connection. If I assume users will never try and plug in more than one battery at a time, everything should be okay. Some protection mechanism might be worth designing.

    I will also need to add a some mosfets and resistors to use for discharging and balancing the cells.

View all 12 project logs

Enjoy this project?



Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates