Close
0%
0%

LiPow - The USB C LiPo Battery Charger

USB Power Delivery Based Lithium Polymer Battery Charger

Public Chat
Similar projects worth following
Starting from
$200.00
aklimaj has 73 orders / 3reviews
Ships from United States of America
This project uses USB Type C with Power Delivery to charge Lithium Polymer batteries. It supports charging and balancing for 2s-4s packs. The device supports charging up to 60W.

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

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.

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.

  • More testing, firmware, and increasing accuracy

    Alex Klimaj06/29/2019 at 05:24 2 comments

    I've spent some more time testing and have implemented a calibration step to the firmware that makes the ADC cell voltage measurements accurate to within about +-20mV. It is currently in the bug fixes branch on github. I'm going to spend some more time testing before I push to master.

    Once you flash this firmware, you will need to run the calibration. It gets saved into one time programmable memory, so you will only have to do it once.

    Hook up a DC power supply set to 3V-4V to the balance connection cells 1-4 and to the positive of the XT60 connector. Measure the input voltage with a multimeter, then in the LiPow command line, run "cal" followed by the voltage input in mV. It is a float and my meter is 5 digit so I've been entering something like "3849.3". It will take that input voltage and calculate the ADC scalars to compensate for the 1% resistor voltage dividers. You can check the output by running the "stats" command and checking that the voltages all are close to your input voltage. If you are happy with the calibration, you can save it to one time programmable flash with the "write_otp" command. You can run that command up to ~30 times and it will always use the latest saved calibration. You should only need to do it once though if you get a good calibration the first time. You can reflash the firmware without erasing the calibration once it is in the one time programmable memory.

    Here is the branch.
    https://github.com/AlexKlimaj/LiPow-Firmware/tree/bug_fixes

  • First Complete Units Have Arrived!

    Alex Klimaj06/10/2019 at 23:13 0 comments

    The first batch of units off the line have arrived and are available on Tindie!

  • Bare PCBs are Available!

    Alex Klimaj05/30/2019 at 00:20 0 comments

    I have posted some Bare PCBs for sale on Tindie.

    https://www.tindie.com/products/arkelectronics/lipow-the-usb-c-lipo-battery-charger-bare-pcb/

    Complete PCBAs should be available in a few weeks.

  • More Power!

    Alex Klimaj05/10/2019 at 20:00 0 comments

    I have spent more time testing and fixing bugs today. It can now push 60W of power into a 4s pack. I've also added a case to handle non USB PD chargers. That is limited to 5V 500mA.

    For fun, I tried charging off of my Thinkpad. It transmits a capability of 5V 3A and works flawlessly! I envision people carrying Lipow out in the field combined with a large USB PD power pack to charge batteries on the go.

  • Firmware MVP!

    Alex Klimaj05/10/2019 at 05:39 0 comments

    I have completed a firmware MVP today. All features are functional. Battery cell number detection, cell voltage readings, balancing, USB PD discovery, auto selection of PD voltage for highest efficiency, auto calculation and setting of max charge voltage, and a basic command line interface for debugging.

    I have tagged the release as v0.1-alpha.

    https://github.com/AlexKlimaj/LiPow-Firmware/releases/tag/v0.1-alpha

    In other news, I have placed the first order of production boards. They are Rev 3.0 and I'm calling this run a beta. They will go up for sale on Tindie. I plan on creating a machined aluminum case that will also serve as the heatsink. I will eventually put it up for sale as a finished product.

  • USB PD Working!

    Alex Klimaj05/05/2019 at 20:12 0 comments

    https://github.com/AlexKlimaj/LiPow-Firmware/pull/13


    I have finally got the ST USB PD middleware basics working on the STM32G0. It reads in the capabilities from the source supply and can request the supply to change it's power profile.  I still need to implement algorithm to a select power profile from source based on connected battery type to provide highest efficiency for the bq25703a regulator.

  • Rev 3.0 Ready for Beta

    Alex Klimaj04/30/2019 at 23:07 1 comment

    I have Rev 3 of the design ready for beta and I am in the process of getting quotes!

    Still working on getting the USB PD middleware working without bugs.

  • Almost ready for beta

    Alex Klimaj04/24/2019 at 19:46 0 comments

    I have been working the last couple of weeks trying to get the USB PD Middleware from ST up and running but have not been having much success. Once I get this working, I can do some more testing and order beta units. Does anyone have advice on getting this running?

  • Charging and Balancing Functional!

    Alex Klimaj04/05/2019 at 05:59 0 comments

    I finally got some time to work on this project again. Picked up where I left off and got 2s and 3s charging tested. It is now automatically charging and balancing 2s, 3s, and 4s batteries!

    I set my bench supply to 20V and was able to get it to charge a 4s battery at 45W! It was also balancing and the temperature of the MCU did rise to 44C at room temperature. So heat may be an issue in the future.

  • 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.
    https://github.com/AlexKlimaj/LiPow-Firmware

View all 21 project logs

Enjoy this project?

Share

Discussions

Dustin wrote 09/13/2021 at 13:12 point

Does this support discharging while charging? Thanks!

  Are you sure? yes | no

Cory wrote 04/01/2021 at 19:15 point

I received my order today and it charged up a 3s 2200mAh LiPo as expected.  I am a bit puzzled why this micro has USB PD, but no USB peripheral.  I was thinking about QC3.0 since I have more of those than USB-PD right now.  Have you thought about a 6s capable version?  That is predominantly where most of my batteries are.

  Are you sure? yes | no

natjwest wrote 03/03/2020 at 16:35 point

Interested in this device for an on-board charger for a Bluetooth speaker. But I’m wondering if I can leave it “always on”. Balancer and power leads would be always connected to lipo. USB-C line would be plugged in when battery needed charging. That’s out of order from your description so I’m wondering if my intended use will work. If USB-C is plugged in while my speaker is running, and the battery voltage is declining, will this device resume charging when voltage drops to some level? Will it disconnect and reconnect charging depending on battery voltage? 

  Are you sure? yes | no

repkid wrote 01/02/2020 at 06:14 point

I've bought one (different account though so I can't leave a review) and it works perfectly, charges my 3s and 4s packs with no problem and no hassle. Am looking to integrate the design in one my projects.

  Are you sure? yes | no

Geo B wrote 10/20/2019 at 08:55 point

you can buy usb-c Li-ion chargers for less than $1. The micro usb ones are 10 for $4. USB-c are more expensive, but cheap in bulk. They charge CC-CV, like proper chargers.

https://www.ebay.com/itm/3-7V-Li-Ion-Lithium-Charger-Module-1A-Charge-3A-Output-Protection-USB-C/264334303561

  Are you sure? yes | no

floony wrote 11/27/2019 at 09:54 point

They arent USB PD, so there is not nearly as much power and charging takes forever with a big battery. Alos, they are only 1S

  Are you sure? yes | no

Richard Osterloh wrote 05/10/2019 at 08:15 point

Awesome project Alex! You've done a great job on the firmware too. I was wondering why you decided to regulate the VBUS to power the STM rather than using the Secondary Bus from the USB-C connector?

  Are you sure? yes | no

Alex Klimaj wrote 05/10/2019 at 16:13 point

Richard, thanks! I'm reading through the USB C specification and don't see any mention that there is power on the secondary bus pins. The 3.3V regulator I chose can support the whole range of USB PD voltages.

  Are you sure? yes | no

Richard Osterloh wrote 05/11/2019 at 11:50 point

Looking at it again it was VConn that I was meaning. You'll always get 5V out of there but I guess you can't rely on it always being there.

  Are you sure? yes | no

Charles wrote 04/27/2019 at 23:06 point

Awesome job! USB-C is definitely the future and I'm so excited about it! Really nice project!! I will follow your tests 

  Are you sure? yes | no

Albert Phan wrote 04/26/2019 at 20:17 point

Great Idea. I like seeing having a more standardized charging with usb C. I would definitely be interested in beta units. I would use this to charge my quad batteries. Features I would like to see are storage charge and easily settable low current charging, of course that would essentially making a full featured lipo charger and I dont think that's what you are going for. Just being able to charge with usb c is nice and simple.

  Are you sure? yes | no

Alex Klimaj wrote 04/28/2019 at 15:28 point

Yeah, it can do all those things, but you would need to change some #defines and reflash the firmware.

  Are you sure? yes | no

patrick wrote 04/26/2019 at 15:45 point

Great! Would b interested to source a beta version already and test it.

  Are you sure? yes | no

patrick wrote 04/26/2019 at 05:36 point

This is really cool. Have the same drive to reduce all my power components to just usb-c. Also using the anywatt and pd-buddy (also through hack a day) to achieve that.

Have a remote controlled car with 2s lipos I take along and would be great if I could charge those through usb-c. If you need to a an extra tester let me know. Would also be interested once you have Something available through tindie

  Are you sure? yes | no

Alex Klimaj wrote 04/26/2019 at 15:01 point

I should have beta units ready pretty soon. I plan on selling those at cost to early adopters. I plan on having a production version after the beta.

  Are you sure? yes | no

jwalser90 wrote 04/08/2019 at 23:56 point

This is so sick! If you've got another board and components, please pm me and I'd love to receive one and give you some feedback!

  Are you sure? yes | no

Alex Klimaj wrote 04/12/2019 at 20:17 point

I do have more bare PCBs and components. I think the hardware needs a revision to add input protection and level shifting to the CC signals to the STM32G0.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

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