How to Increase the battery backup of your Laptop under Ubuntu
Ubuntu and its derivatives form the major chunk of Linux on Desktop/Laptop. Ubuntu forms a very solid base for other distributions and that is why it is the most forked distro out there.If you want to start someone on Linux you would probably hand them over something like a Linux Mint or a Zorin OS. Linux has come a long way and it is not a difficult to use Linux on the Desktop/Laptop. The hardware compatibility has improved to a great extent. Most of the hardware these days supports Linux, The support for Graphics Cards has improved, Almost all hardware on all branded laptops and desktops supports Linux out of the box. Big names like Dell, HP and Lenovo are coming up with some systems with Linux preloaded, Even if Linux is not preloaded, there is a good Chance that you would get Linux to work on most of the Systems these companies make.
I am currently using a Lenovo, Z50-70 Laptop which came pre loaded with Windows 8.1. I installed Linux on it and everything worked out of the box with no problem what so ever, WIFI, Bluetooth, Touch pad, etc.. all worked well.
However there are two major problems with Linux on Laptops like mine, One is Hybrid Graphics and the other is battery Life. Battery life on Linux is generally very low in comparison with Windows, This could be a deal breaker at times.
With Bumblebee technology at our disposal, Hybrid Graphics can be managed and used with a great degree of success. I have written a couple of blogs around the same. You can read those in detail and the concepts are presented with respect to Ubuntu as a base distribution. The way it works is same across all distributions.
I have been struggling for some time with the battery backup. The machine I am referring to is a mid variant with Intel Ci5 processor and Nvidia GT 820 M for my games. Even with windows the machine does not give enough backup. It hardly lasts 2 -2.5 hours of regular use, Web surfing email, chat etc.
When I switched to Linux the battery backup was reduced by 45 Minutes. I would only get 1.45 hours to 2 hours at max. I began wondering if there was a way to get this equal to Windows. I kept searching all over the place and found that one could use laptop-mode-tools and it would get you almost at par with Windows as far as battery backup goes. However the options which you can tweak are not a lot in number. You could tweak it to some extent but not a lot.
Then I found TLP. I have been testing TLP across various versions of Ubuntu, Mint, Arch, Manjaro, OpenSuse etc... and I found the tool to be very effective, I got the same battery backup as I was getting with Windows and I could get it to extend more than 3 hours by tweaking a few parameters.
Without further delay, let me provide you steps to get TLP installed and configured properly under Ubuntu.
Assumption:- You have a laptop with Intel CPU. If not then you should rather use laptop-mode tools or just don't edit the TLP configuration.
1) Add the TLP Repository and Install TLP
sudo apt-add-repository ppa:linrunner/tlp
sudo apt-get update && sud apt-get install tlp tlp-rdw -y
2) Start TLP
sudo tlp start
The default configuration should work for most cases and should get your battery performance up to what you get under Windows.
Location of config file is /etc/default/tlp
However you could tweak a few more parameters to make it better. One could do that however the implications should be clearly understood before making changes
#Select a CPU frequency scaling governor:
This Option basically controls how the CPU on the machine responds to load conditions with respect to power conditions.
This is not enabled by default in the configuration. It gives a bit of an explanation around what it does. It has two states powersave and performance.
It is obvious that one would expect the best performance while connected to AC power, However when on battery power one would want some powersaving. Hence one needs to set the below.
By running sudo gedit /etc/defaut/tlp one can edit and setup these options.
Like the first Option, this is also not setup by default. This should be setup manually.
# Set the min/max frequency available for the scaling governor.
This is something that I would set up very carefully. Using these settings you control how the CPU cycles. Setting up too low values may cause degradation in performance beyond bearable limit. I have done some calculations and Here are my configured values.
My CPU is 1.7 GHZ with turbo boost up to 2.4. When on battery I don't play games or run any CPU intensive tasks, I mostly read and write , for my purpose it works great and I get great backup. I plug in the charger when I need it to do heavy lifting.
# Set Intel P-state performance: 0..100 (%)
This one is again related to CPU and it sets the maximum performance of the Intel Pstate driver on your Laptop
I have set it up as below.
On battery It goes up to only 30 % of the Max performance. I ab basically causing the CPU to under perform on Battery so that the battery life extends more.
This is related to turbo boost technology from Intel. If you have an Intel processor capable of turbo boost you need to set this up for saving battery life.
This means that on battery turbo boost feature stays disabled.
These are the only 4 Options In addition to what TLP sets up by default which can save you precious battery life.
Please bear in mind that by setting up these options there will be a performance hit to some extent however in exchange you will get more juice out of the battery.
Please exert caution while Implementing these or else just use the defaults.
I hope this will help many people.
Thanks for reading.