tutorial, linux,

How To Enable Asus Battery Health Charging for Ubuntu / Linux

Debashish D. Dev Debashish D. Dev Follow Dec 25, 2021 · 3 mins read
How To Enable Asus Battery Health Charging for Ubuntu / Linux
Share this

Few days ago I have bought ASUS UX425JA Laptop. The laptop is really cool and comes with a lots of cool features. But it comes with Windows Home Pre installed and Asus Own’s Features like Link to my Asus, Battery Health Charging ETC does work only on Windows. But I dont use windows at all. I was really missing those features. Most importantly the Asus Battery Health Charging which is really helpfull for the battery of the laptop. I have found a way to enable Battery Health Charging. So let’s get started .

What is Asus Battery Health Charging on Ubuntu?

Some ASUS laptop support a kernel level way to limit the maximum battery charge. It has two level.

  • Maximum 60% Charge Maximum Lifespan Mode
  • Maximum 80% Charge Balanced Lifespan Mode

Enable Asus Battery Health Charging On Ubuntu Linx

Does My Laptop Support Asus Battery Health Charging Mode?

Lets find out if your laptop support ASUS Battery Health Charging. Newer ASUS laptops and Notebook added support for charge threshold limit with Linux 5.4 Kernel. Lets assume you have Linux Kernel 5.4 or newer. There is a limit too, too have Battery Health Charging you need to have BAT0 or BAT1.

To find out if you have BAT0, run this command on terminal

ls /sys/class/power_supply

You will find a output with your battery Name. If the output contains BAT0 or BAT1, than you can set battery charge limit on your Ubuntu Linux Laptop.

So, Now your laptop support battery health charging. Lets move to the next step.

you can run this command on terminal to set the battery charge limit . But this is manual and you have to run this code every time you boot your laptop.

echo 60 | sudo tee /sys/class/power_supply/BAT0/charge_control_end_threshold

Remember to replace BAT0 with your battery name. For me its BAT0. It will ask for your root password. If your battery charge is more than 60% , the battery will stop charging. You can replace the echo 60 with echo 80 if you want balanced mode.

Let’s assume you have successfully ran this code and want to make this permanent.

We need to create a systemd service to make the system automatic so that we won’t have to run the code everytime we boot our laptop.

We need to create a file called battery-charge-threshold.service _** in **/etc/systemd/system ._ We can simply do it with gedit. Run this command on terminal

sudo editor /etc/systemd/system/battery-charge-threshold.service

It will open your text file editor. Paste this code and save.

[Unit]

Description=Set the battery charge threshold After=multi-user.target

StartLimitBurst=0 [Service] Type=oneshot Restart=on-failure

ExecStart=/bin/bash -c ‘echo 60 > /sys/class/power_supply/BAT0/charge_control_end_threshold’ [Install] WantedBy=multi-user.target

Don’t forget to change BAT0 with your Battery name and Echo 60 with 80 if you want Balanced Mode.

Now we need to enable this service on boot. To do this run the code on terminal.

sudo systemctl enable battery-charge-threshold.service

That’s All :D Hope your laptop battery will have a longer lifespan now.

Join Newsletter
Get the latest news right in your inbox. We never spam!
Debashish D. Dev
Written by Debashish D. Dev Follow
My love for all the folk artists across the world