How can I limit battery charging to 60% capacity?

5,681

I have written a short python script to make switching the thresholds easier on my ROG laptop. (ROG STRIX G731GU).

Please run the script as admin. (e.g. sudo python3 scriptname.py)

power_cfg = open("/sys/class/power_supply/BAT0/charge_control_end_threshold", "r")
print("Current Charge Threshold:")

print(power_cfg.read())
power_cfg = open("/sys/class/power_supply/BAT0/charge_control_end_threshold", "w")
change_opt = input("Change? y/n: ")

if(change_opt == "y"):
    ch_val = input("Enter New Value: ");
power_cfg.write(ch_val);

Please let me know if this works on your machine.

Share:
5,681

Related videos on Youtube

Terrarium
Author by

Terrarium

Updated on September 18, 2022

Comments

  • Terrarium
    Terrarium over 1 year

    I have an Asus ROG GL503 laptop, which came pre-installed with Asus Battery Health Charging software. This software gives me the option to limit my battery charging level to 60% to prolong the overall battery lifespan. Whenever I boot using Ubuntu(18.04), my battery keeps charging until it reaches 100%. Is there any method by which I can limit my battery charging up to a certain level?

    • Rinzwind
      Rinzwind about 4 years
      Sorry but if it is a LI-ON that is the WORST advice EVER. LI-ON batteries have a limited amount of charges. Oh and you need kernel support for this. AFAIK only Thinkpads have that askubuntu.com/questions/34452/…
    • Rinzwind
      Rinzwind about 4 years
      You are better of taking out the battery when on the mains OR have it discharge to near 0 and then charge back to 100 once every so often,
    • vanadium
      vanadium about 4 years
      @Rinzwind, not sure this is true for modern batteries without memory effects. Charging while near zero or near full causes more strain to the battery (high currents versus high potentials in these extreme zones), which decreases life time compared to where a battery is kept between 20 - 80%.
    • Vinícius M
      Vinícius M almost 4 years
      You can indeed prolong moderns Li-Ion batteries lifespan by keeping them at a lower charge. If you never ever use it disconnected, you should keep it at 40%. E.g. Uber driver cellphone always-on in travels. However for daily light usage, 60% is considered the 'sweet spot' for practicality, and 80% gives you more freedom. 100% is when the battery is at its peak 'stress' level, and thus wear faster. Charge-Discharge cycles also impact wear rates. Same for temperature, where higher usually = worse, except when you get close to freezing temps or below, where weird things happen.