Sunday, January 17, 2010

Create your own battery monitor in Ubuntu with IBAM

If you use Ubuntu on a laptop, you may have noticed that its battery monitor applet is not the most believeable nor reliable application in the world. In my experience, I have seen the estimated remaining usage of my battery go from 2 to 3 hours, and then back, then to an hour and a half, etc. Obviously, I was surprised to see such behavior because I was using the same energy saving settings, not doing anything that could explain such random adjustments.

In fact, I am typing these lines from a dual setup laptop, running Windows XP and Ubuntu 9.10. It is even more noticeable with such setup, as I have seen quite significant differences from the estimations displayed on one OS and then the other one. I have to admit the Windows battery monitor seems to be more solid and reliable (although it should also be noted that the hardware it uses was built with Windows and Windows controlers in mind).

Anyways, I was trying to get myself a more reliable battery life estimation source, and I found it in IBAM. IBAM stands for Intelligent BAttery Monitor. Note that IBAM requires some time after it is installed before it can provide actual reliable information. This is because its estimations are based on statistical information, which it gathers over some time.

Anyways, let's see how to install IBAM:

IBAM is available from the Ubuntu repositories, so simply install it as you would with any package. If you choose to do it from the command line, type the following:

sudo apt-get install ibam

Now, let's see it in action. Open your terminal and run IBAM by typing:

ibam

In doing so, you will display IBAM with its default option, which simply shows the current system estimation and the adaptative estimation. As I mentioned before, the initial runs of this command may not be that accurate, so allow a few minutes for IBAM to do its profiling. If you want to see IBAM display all of the information it can provide, run it as follows:

ibam -a

This is interesting information; you can see if your BIOS clock is off and how far from the actual estimation.

However, I have to admit that having to open the terminal to check what's remaining of my battery life is a bit of a throw-off. I thought I'd quickly put together a very simple script to show this info straight from the UI. Here's how it looks like:



Cool stuff, huh? OK, here's how to do it, very simple.

1.- Create a new text file and edit it. I named mine "battery", and created it under my home directory:

gedit battery

2.- Enter the following text on the file and save it:

zenity --info --text "$(ibam -a)" &

3.- Setup a launcher so you can run this command with a simple click. This is down to personal preferences, so I won't cover how to do it. As you could see from the screenshot above, I added mine to Cairo Dock, but you could do so on the desktop, upper or lower pannel, etc.

That should do it, now you can see all of the interesting info displayed by IBAM with just a click!

Hope you found this useful!

3 comments:

  1. A good battery will do your computer work without any problem. Time ago i had too much problem with my laptop and after suffer this bad moment finally i found a great battery and now it work very well. Actually i saw a site by internet called costa rica investment opportunities i think it is very interesting i want to share it for you.

    ReplyDelete
  2. No apm data available

    doesnt work for me

    ReplyDelete
  3. same - no apm data available.

    ReplyDelete