Jump to content

Conservative battery charging with AXP209


Recommended Posts

Does anybody have a solution how to charge battery with more conservative voltage range?


I'm using battery backup for my CubieTruck boards to survive power outages for several years. And as one of the batteries recently blew up (and also killed the backup HDD next to it) I try to find a way to charge the battery in a range that preserves health of it. When searching for a long-term-save voltage range of LiPo batteries you get something like: use only half of capacity, much below 4V, never deep charge, ...

Default setting for the AXP209 charge controller is to charge to 4,2V, and emergency shutdown is at 2,9V. These ranges are much too broad and may damage the battery over the years.


Deep discharge protection is quite easy, just use a script to regularly check current voltage and issue a shutdown when too low (no clue, why this is not already handled by the OS):

if [ $(cat /sys/class/power_supply/axp20x-battery/status) = Discharging ]; then
  if [ $(cat /sys/class/power_supply/axp20x-battery/voltage_now) -lt 3200000 ]; then
    # prevent undervoltage
    shutdown -h


But target voltage for the charge controller is not that easy to change, as AXP209 only supports 4,1V / 4,15V / 4,2V / 4,36V:

echo 4100000 > /sys/class/power_supply/axp20x-battery/voltage_max_design

I tried to reduce the charge current with rising voltage to stop charging at some point:

echo 300000 > /sys/class/power_supply/axp20x-battery/constant_charge_current_max

But the minimum supported value is 300mA, which is still charging and increasing the voltage.

Also the charge current can not be increased again after setting a lower value.


Does anybody have an idea how to stop charging at some voltage and to resume if it has dropped again below a second threshold?



Link to comment
Share on other sites

5 hours ago, EtlARM said:

LiPo batteries you get something like: use only half of capacity,

I also operate my mobile between 20-80% in which it is said to feel comfortable.


Did you already search the forum to solve your interest?


Link to comment
Share on other sites

Yes, I had seen these posts some time ago. They contain some really useful links.
But as I forgot to bookmark it, is is very good you dig it out again.


When I find some spare time, I will try to modify the AXP209 registers directly.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines