Themes / Apps / Mods [MOD/magisk/root] Set charging limit to 80/85/90/95% v2

Search This thread

Sohip

Senior Member
May 23, 2008
159
56
Google Pixel 7 Pro
I just wanna report that this Magisk Mod (P6n_charginglimit_80.zip) is working perfectly fine on my rooted Pixel 7 Pro (Stock Kernel and Rom).

Last time I checked I got about ~5hrs20mins Screen time (Battery usage was from %80 to %10) and I'm also using an app called HEBF Optimizer that helped improve the battery life a little more.

CustomKernel might improve battery life even further but I haven't done that yet.
 

BetaPix

Senior Member
Nov 15, 2014
56
13
Redmi K20 Pro
I just wanna report that this Magisk Mod (P6n_charginglimit_80.zip) is working perfectly fine on my rooted Pixel 7 Pro (Stock Kernel and Rom).

Last time I checked I got about ~5hrs20mins Screen time (Battery usage was from %80 to %10) and I'm also using an app called HEBF Optimizer that helped improve the battery life a little more.

CustomKernel might improve battery life even further but I haven't done that yet.
I can also confirm this works on my Pixel 7, so I didn't bother setting up ACC :)
Thank you for your work OP!
 
  • Like
Reactions: 73sydney

fernoct

Senior Member
Apr 14, 2012
524
141
Colombo
Google Pixel 6
Just a quick question, everyone: let's say I download the 90% module, but charging is stuck at 90% even though it still displays as charging. Has the phone's complete disregard for input power been proven?
 

73sydney

Senior Member
Just a quick question, everyone: let's say I download the 90% module, but charging is stuck at 90% even though it still displays as charging. Has the phone's complete disregard for input power been proven?

Not sure what youre asking

Are you asking if if the limit is set to 90 and its at 90 is it still charging?

try from terminal:

Code:
su

cat /sys/devices/platform/google,battery/power_supply/battery/status

this will tell you if its charging, probably other ways via terminal...this is just the first i found...
 
  • Love
Reactions: fernoct

LeoPeink

Member
Jan 12, 2023
10
1
Google Pixel 7
I'm gathering information about the Pixel 7 battery management inner workings to write a small app to limit max charge, save presets etc.
Help me get it straight: charge_stop_level (default 100) is the SoC% at which the phone stops charging (=maintains SoC without it dropping down), at least that's how I see it working on my Px7. Editing it to 85% works as expected.
I can't figure out charge_start_level: it is 0 by default, and from what OP said earlier, leaving it at 0 should mean that the phone won't charge until dead, but if I plug it in with 60%SoC it regularly charges up to 85. Please correct me if I'm wrong, I want to learn!
 

73sydney

Senior Member
This works great on my P6P, any ideas if it would work on my old P3xl? running 12.1 stock

EDIT... Tried but doesn't work on Pixel 3xl :(

All the relevant switches to set limits will be different for older Pixels....i cant rememebr what it is on the Pixel 2XL anymore even...

the ones being used here are (look in modules's service.sh file)

/sys/devices/platform/google,charger/charge_start_level
/sys/devices/platform/google,charger/charge_stop_level

a bit of searching (literally 2 minutes) using search terms "battery charge limit pixel 3" would have found you this thread:


i suggest reading the last post on the page, unzipping this module, editing and substituting the part between the first and last /'s in that line for the lines in the service.sh of the module, rezipping it and renaming it for pixel 3 so you know which device its for...and flashing it to test
 
Last edited:
  • Love
Reactions: jcp2

jcp2

Senior Member
All the relevant switches to set limits will be different for older Pixels....i cant rememebr what it is on the Pixel 2XL anymore even...
the ones being used here are (look in modules's service.sh file)

/sys/devices/platform/google,charger/charge_start_level
/sys/devices/platform/google,charger/charge_stop_level

a bit of searching (literally 2 minutes) using search terms "battery charge limit pixel 3" would have found you this thread:


i suggest reading the last post on the page, unzipping this module, editing and substituting the part between the first and last /'s in that line for the lines in the service.sh of the module, rezipping it and renaming it for pixel 3 so you know which device its for...and flashing it to test
Thanks for the helpful information. I changed the wording in the module and flashed it on the 3xl I passed on to my Mom. Now I don't have to worry about overcharging my 6 Pro or her 3xl :)
 
  • Like
Reactions: 73sydney

kylechen

Senior Member
Feb 13, 2009
112
51
I'm gathering information about the Pixel 7 battery management inner workings to write a small app to limit max charge, save presets etc.
Help me get it straight: charge_stop_level (default 100) is the SoC% at which the phone stops charging (=maintains SoC without it dropping down), at least that's how I see it working on my Px7. Editing it to 85% works as expected.
I can't figure out charge_start_level: it is 0 by default, and from what OP said earlier, leaving it at 0 should mean that the phone won't charge until dead, but if I plug it in with 60%SoC it regularly charges up to 85. Please correct me if I'm wrong, I want to learn!
From what I have tested so far, it is something like this:

The charge_stop_level is the trigger, it starts the "no-charge mode".
Once it starts, the charge_start_level is the "reset" of it.

except:

If the charge_stop_level is at default, the whole thing seems to be ignored.
Besides the charge_start_level, there are some other "reset" mechanisms, like reboot/plug-unplug cable multiple times, etc. etc. I randomly found.

It is a blackbox atm until someone read google's source code and explain it.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    This works great on my P6P, any ideas if it would work on my old P3xl? running 12.1 stock

    EDIT... Tried but doesn't work on Pixel 3xl :(

    All the relevant switches to set limits will be different for older Pixels....i cant rememebr what it is on the Pixel 2XL anymore even...

    the ones being used here are (look in modules's service.sh file)

    /sys/devices/platform/google,charger/charge_start_level
    /sys/devices/platform/google,charger/charge_stop_level

    a bit of searching (literally 2 minutes) using search terms "battery charge limit pixel 3" would have found you this thread:


    i suggest reading the last post on the page, unzipping this module, editing and substituting the part between the first and last /'s in that line for the lines in the service.sh of the module, rezipping it and renaming it for pixel 3 so you know which device its for...and flashing it to test
    1
    All the relevant switches to set limits will be different for older Pixels....i cant rememebr what it is on the Pixel 2XL anymore even...
    the ones being used here are (look in modules's service.sh file)

    /sys/devices/platform/google,charger/charge_start_level
    /sys/devices/platform/google,charger/charge_stop_level

    a bit of searching (literally 2 minutes) using search terms "battery charge limit pixel 3" would have found you this thread:


    i suggest reading the last post on the page, unzipping this module, editing and substituting the part between the first and last /'s in that line for the lines in the service.sh of the module, rezipping it and renaming it for pixel 3 so you know which device its for...and flashing it to test
    Thanks for the helpful information. I changed the wording in the module and flashed it on the 3xl I passed on to my Mom. Now I don't have to worry about overcharging my 6 Pro or her 3xl :)
    1
    Are you setting your triggers with the akp? Care to share your settings? In my instance acc is a hit or miss affair - at times it charges to 100%.
    Thanks
    Ok, this is the export config output from AccA.

    [{"profile":{"uid":4,"profileName":"Daily (80-85)","accConfig":{"configCapacity":{"shutdown":2,"resume":80,"pause":85},"configVoltage":{},"configTemperature":{"coolDownTemperature":35,"maxTemperature":45,"pause":90},"configResetUnplugged":false,"configResetBsOnPause":false,"configChargeSwitch":"/sys/devices/platform/google,charger/charge_stop_level 100 5","configIsAutomaticSwitchingEnabled":false,"prioritizeBatteryIdleMode":true}},"mIsChecked":true}]

    ACC version is V2022.7.30-dev (the latest), and I'm not using djs. Just the daemon running.
    It works 100% of the times, even with Wireless Charging.
    Although with slow chargers, like 500ma ones (5W old bricks) it does not work well, but i use a 5V 2A Xiaomi charger and a 12W Samsung Wireless Pad and it stops every time at 85%, to resume at 80%.
  • 15
    After some readings on: https://forum.xda-developers.com/t/limit-charge.4355851/
    and https://forum.xda-developers.com/t/mod-magisk-root-set-charging-limit-to-90.4363477/
    ( Credits to @rickysidhu_ and @foobar66 )

    There is a thing I found and tested:
    "charge_stop_level" must be used together with "charge_start_level"
    If set start @40 / stop @60, the phone will begin charging when (and only when) the battery drops to 40%, and stops charging @ 60%.
    (it defines a range, and the first time the user hit the range boundary activates this range function)
    If set stop @90 without setting a start, the phone will refuse the 2nd time charging until the battery drops to default 0 (or the battery service/phone has been restarted)

    (This explained many "phone not charging" reports in the above links posts)


    I like @foobar66's magisk mod solution. It is simple and safe.
    It has only 1 line of working script in the zip.

    So I "clone" it with some different values (added the fix, so 2 lines of script code in each zip now, that's all it does)

    These are for the lazy people who don't want to deal with advanced settings, and who want a 10-second trouble-free simple solution for battery health.


    The 4 clones:

    • P6n_charginglimit_95.zip (charging limit to 95%, it should give you an extra ~30% battery life span in lab-tested theory)
    • P6n_charginglimit_90.zip (charging to 90%, an extra ~60% battery life span)
    • P6n_charginglimit_85.zip (charging to 85%, double the battery life span, recommended for joe and johns)
    • P6n_charginglimit_80.zip (charging to 80%, should give more than double the battery life span)

    Those numbers are the best estimates from other battery research papers, no guarantee.

    To install, pick the one you want and flash it in Magisk.
    To uninstall, simply disable or remove it in Magisk.

    A12.1 tested. It should work on A13.
    Edit: A13 is also confirmed working.
    Reply problems if you find any.
    6
    I use advanced charging controller, I stop charging at 81% and I can regulate voltage as well. Temperature triggers etc it's great.
    I use ACC plus Tasker to keep the battery entering idle mode at around 50% while plugged. I got my pixel 6 last November, now the battery gets 82 cycles so far.
    The thing is, ACC monitors/controls too many components in the system that I don't fully get, and I am not sure if it conflicts with built-in "smart charging" or other circuit controllers or not, and have to combine a Magisk backend module and a root-access frontend APP to make it work with so many details settings to setup....... It is just......too heavy?
    (or I am too old to tinkering those things.....my sad middle-age life)

    These .zips are the "10-second solution" for lazy folks.
    It does only 1 thing, It is transparent and super snappy (only 2 lines of script, no binary), and it can hardly go wrong.....it just works.


    How does it increase battery life by 30%?
    Or you mean battery health ?
    You are right Shakespeare, "life span" to be precise, sorry for my English ahahahah.
    4
    The thing is, ACC monitors/controls too many components in the system that I don't fully get, and I am not sure if it conflicts with built-in "smart charging" or other circuit controllers or not, and have to combine a Magisk backend module and a root-access frontend APP to make it work with so many details settings to setup....... It is just......too heavy?
    (or I am too old to tinkering those things.....my sad middle-age life)

    These .zips are the "10-second solution" for lazy folks.
    It does only 1 thing, It is transparent and super snappy (only 2 lines of script, no binary), and it can hardly go wrong.....it just works.



    You are right Shakespeare, "life span" to be precise, sorry for my English ahahahah.
    I strongly agree, just not worth having to deal with acc, getting idle mode to work, debugging, getting it to work again and hoping it still works. If I get the time to do so might write a module that integrates a slider in settings or as a quick setting to set to what percentage it should charge and executing those lines of code with that percentage.
    3
    Hi, does anyone know if this will also work for the Pixel 7 pro?
    Works perfectly fine on 7 pro
    2
    How does it increase battery life by 30%?
    Or you mean battery health ?