[go: up one dir, main page]

DEV Community

Cover image for Limit battery charging on Asus & Ubuntu
vaclavhodek
vaclavhodek

Posted on • Originally published at vaclavhodek.com

Limit battery charging on Asus & Ubuntu

I'm a fan of old-school desktop computers, and for my normal work, I use two of them. However, to be able to work on the go, I also need a decent laptop.

I've got myself Asus ExpertBook B9450, a powerful yet small and light one. What I love about it the most is that it can run, according to ASUS, for 24-hours on a battery. It was even tested to play full HD videos for 30 hours without charging.

For me, it's like a miracle, and even with my workflow (several Dockers, several IntelliJ instances, etc.), it survives on the battery for about 14 hours under high load. That makes it really a mobile device.

I'm running the latest LTS Kubuntu distro, and while it runs great on it, there are several known issues:

  • The fingerprint reader doesn't work. I don't care. And it seems that there is some work in progress.
  • Numpad integrated inside the touchpad doesn't work. Well, I was a bit sad about it initially, but after testing it on Windows, I've not got used to it. I'm not missing it.
  • This laptop and some Asus ZenBook laptops come with a limiting battery charging to 80% to protect it.

The last point was something I missed the most as since it's mobile and only mobile device for me, I want it to have the battery in perfect shape.

Fortunately, this one is really easy to fix. Just run sudo crontab -e and add this line to the end of the file:

@reboot echo 80 > /sys/class/power_supply/BAT0/charge_control_end_threshold

You can either reboot the laptop or run the same command with sudo to set it for the current session.

And that's it. This single line is executed when the computer is booted up and set the charge control to limit the battery charging to 80% of its capacity (which is better for Lithium-ion batteries than charging it to 100%).

Top comments (1)

Collapse
 
suongphengan profile image
suong-phengan

hello, what if I want to set 30% start charge again?