How do I set battery charging thresholds

21,633

Please stop messing around with kernel modules by hand and stay away from way outdated instructions for Hardy. All things needed are available as packages from either the Ubuntu repos (15.10) or the TLP PPA.

Install TLP as described here. You may omit the tp-smapi-dkms package as tp-smapi is incompatible with the X250.

Modify TLP's configuration to include your desired charge thresholds, Example here. Don't forget to remove the leading #'s from these lines.

To activate the thresholds use

sudo tlp start

Show the output of

sudo tlp-stat -s -c -b 
Share:
21,633

Related videos on Youtube

dunya
Author by

dunya

Updated on September 18, 2022

Comments

  • dunya
    dunya over 1 year

    I am new to Ubuntu and I don't speak computerese. I really don't! I have read the various threads on the topic and still can't work it out.

    I have recently purchased a Lenovo Thinkpad x250 and I want to set my battery management to have charging thresholds and whatever other settings are ideal for prolonging the battery life.

    I have looked into tlp and tp-smapi. I also found tpacti-bat. Unfortunately, I don't understand what it says on this website at all.

    I installed tlp, which apparently has to be managed entirely from the terminal. I haven't found any descriptions I understand on how to do this and I have no idea how I can see the settings and change them.

    So I deleted it again.

    For tp_smapi I found these instructions:

    Installation on Ubuntu: Ubuntu ships tp_smapi in their linux-ubuntu-modules-* package for Hardy, so you don't have to build it yourself. Please note that they have renamed tp_smapi's modified hdaps module to hdaps_ec so that the two can coexist. You should load hdaps_ec, not hdaps.

    What on earth does this mean?

    Is there any program which is user-friendly to people whose computer knowledge is very basic and which can be run as a program on Ubuntu where I can easily see and alter the settings?

    Or is there an easy-to-follow guide to use for the tlp program?

    This was too long for a comment: Now I have tried it out for a few days and there are three options: 1. It isn't working, 2. The information I see in the power statistics (when I click the battery icon in the upper right corner of my screen) is all wrong, 3. I am unable to read mentioned information. Here is what is shown in the power statistics: the percentage of the battery power stays the same all day, as do the "minutes to charge". It changes slightly in between suspend modes. Two days ago, it was on 46% the whole time, then after I'd had the system suspended for some time, it was on 44 %. Also the minutes changed. Today it has shown 52 % and 17 minutes, then after some time in suspend mode it now shows 51 % and 25 minutes, not changing. What is shown changes if I unplug the pc and plug it back in. When I click the power statistics details, the main battery (BATT0) tells me 0 seconds time to full and 0 seconds time to empty, the BATT1 says the minutes shown in the corner as its time to full. This information changes in between I suspend / shut down / unplug the computer. For both of the batteries it always says "charging" when plugged in. In short, it seems all wrong. Please help? Thank you.

    • Wilf
      Wilf over 8 years
      Don't be scared of building things and terminal, sometimes it easier than some other methods. The github page you found I think may be too old, but what thresholds do you want to set? (and are you dual-booting with Windowz)?
    • Edward Torvalds
      Edward Torvalds over 8 years
      please show the contents of /etc/default/tlp in question
  • dunya
    dunya over 8 years
    For 15.10 (my version) the only thing it says on linrunner is "TLP and ThinkPad-related packages below are available via the official Ubuntu repository." which i searched for. Is this where I should go: launchpad.net/ubuntu/+source/tlp ? And should I then click 0.8-1 to download the package for 15.10? Thank you.
  • linrunner
    linrunner over 8 years
    Open a Terminal and enter the command sudo apt-get install tlp tlp-rdw acpi-call-dkms
  • dunya
    dunya over 8 years
    Thank you. It is installed and I can see the output in the terminal. But how do I change the thresholds? And how do I set tlp to switch between batteries? What I want to do is discharge my removable 6-cell to 10%, then switch over to the internal 3-cell and discharge that one also to 10% before starting the cycles over again. Also, how do I see which battery is currently being charged/discharged? And finally, when I have it all set up, does this just run automatically? Can I simply leave my pc plugged in and each battery will only charge when it's supposed to?
  • dunya
    dunya over 8 years
    I have tried entering this: START_CHARGE_THRESH_BAT0=10 STOP_CHARGE_THRESH_BAT0=90 which is what I found on linrunner.de/en/tlp/docs/… under "Thinkpads only". Nothing happens.
  • linrunner
    linrunner over 8 years
    These are not commands but config lines. It's explained at the top of the configuration page: 1. fire up the editor gksudo gedit /etc/default/tlp, 2. scroll down until you see the first relevant line START_CHARGE_THRESH_BAT0, 3. edit the four lines to your wishes, 4. don't forget to remove the leading #'s, 5. save the file, 6. issue the terminal command sudo tlp start and you're done
  • dunya
    dunya over 8 years
    I still need more help. I have edited my initial question to add my current ones.
  • linrunner
    linrunner over 8 years
    To help you further i definitely need the output of the terminal comamnd sudo tlp-stat -s -c -b (as said above). I suggest you use pastebin.com to do this.
  • dunya
    dunya over 8 years
  • linrunner
    linrunner over 8 years
    Congrats, your configuration is now correct and charge thresholds work as designed. BUT maybe you misunderstood the start charge threshold. The current setting of START_CHARGE_THRESH_BATx=10 means that neither battery will begin to charge before it gets discharged below 10% by your ThinkPad running on battery power. I reckon this is not what you intended. If you need for example 70% of your batteries full capacity on the road you should choose START_CHARGE_THRESH_BATx=70 STOP_CHARGE_THRESH_BATx=90.
  • linrunner
    linrunner over 8 years
    Please refer to the FAQ for more explanations on the subject. Also be warned that all existing panel applets do not show the battery charge state correctly as soon as charge thresholds intervene.
  • mLstudent33
    mLstudent33 over 3 years
    I can do everything except edit /etc/default/tlp as I do not seem to have this file. Do I need the PPA to get this file or where else could it be? Lenovo T420, Ubuntu 20.04