maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Nokia N900 (https://talk.maemo.org/forumdisplay.php?f=44)
-   -   Guide to get detailed battery information (https://talk.maemo.org/showthread.php?t=36613)

Phantasm 2009-12-10 18:49

Guide to get detailed battery information
 
N900 allows one to check full detailed information about the battery.

The basic way to get everything is to open the X terminal and type "lshal|grep bat". There is also another way to get the information, but the output isn't well sorted. It is "hal-device bme" which is executed much faster and as such is used in the aliases later on.

Note. The commands don't show anything useful while charging.

You will get following output (numbers on front of lines have been added for easier explaining):
Code:

~ $ lshal|grep bat
1  battery.charge_level.capacity_state = 'ok'  (string)
2  battery.charge_level.current = 2  (0x2)  (int)
3  battery.charge_level.design = 8  (0x8)  (int)
4  battery.charge_level.last_full = 0  (0x0)  (int)
5  battery.charge_level.percentage = 12  (0xc)  (int)
6  battery.charge_level.unit = 'bars'  (string)
7  battery.is_rechargeable = true  (bool)
8  battery.present = true  (bool)
9  battery.rechargeable.is_charging = false  (bool)
10  battery.rechargeable.is_discharging = true  (bool)
11  battery.remaining_time = 0  (0x0)  (int)
12  battery.remaining_time.calculate_per_time = false  (bool)
13  battery.reporting.current = 160  (0xa0)  (int)
14  battery.reporting.design = 1248  (0x4e0)  (int)
15  battery.reporting.last_full = 0  (0x0)  (int)
16  battery.reporting.unit = 'mAh'  (string)
17  battery.type = 'pda'  (string)
18  battery.voltage.current = 3753  (0xea9)  (int)
19  battery.voltage.design = 4200  (0x1068)  (int)
20  battery.voltage.unit = 'mV'  (string)
21  info.capabilities = {'battery'} (string list)
22  info.category = 'battery'  (string)

1. Shows "full" at 8 bars. Possibly still full at 7 bars. "Low" at 1 bars or something and elsewhere "ok". Quite useless.
2. Remaining battery life in bars (number representation of the battery bar shown on top left of the screen just right of programs button).
3. Bar value of full charged new battery.
4. Bar value the battery had last time it was fully charged. Typically 8 for quite new battery. Seems to reset to 0 in a few minutes after taking off the charger.
5. Percentage of battery charge remaining. This is the most useful value for most users.
6-10. Self explanatory.
11. Very inaccurate time remaining on battery charge at current usage. Supposed to be in seconds (I recall reading that from somewhere) but is far from reality and updates very rarely.
12. Not sure what this should mean. Always shows false for me.
13. Current remaining battery charge in mAh.
14. Capacity of the current battery when it was manufactured.
15. Full charge mAh value from last full charge. Seems to reset to 0 in a few minutes after taking off the charger.
16-17. Self explanatory.
18. Current battery voltage. Depends on recent usage level and battery charge level. Only useful for advanced users.
19. Voltage of the battery when fully charged. The value is for when manufactured, but this does not change for old batteries.
20. Self explanatory
21-22. Useless.

So, all in all, the lines 5, 13, 14 and 18 are of more use. And the line 14 can be easily remembered approximately and as such is generally useless in long term.

The only useful value shown while charging, is the line 18 (voltage). After getting used to the voltage behavior of rechargeable Li-Ion battery, you can approximate the remaining charge time from the voltage value.

Here are some aliases premade for various people to ease the life. They are put into a file ".profile" in the home directory (the directory X terminal puts you on at start). A quick newbie quite for how to use vi (the only editor I found on the X terminal). Start editing the file with "vi .profile". Type "a" to enter editing mode. Edit the file normally (do not press anything strange such as keys with CTRL or ESC etc). If something strange happens, close the X terminal and start from beginning. Once ready, click ESC, type ":write" and type ":q". To get "|" symbol, use secondary function of CTRL-key on the keyboard.

Aliases work as such that the word before "=" does the command between parenthesis. You can easily customize the aliases to be done with other commands. Eg. following 2 aliases do same thing, except first is executed with foo and second with bar.
alias foo="echo test"
alias bar="echo test"

Some basic aliases to simplify the rest of the aliases. Grep is a command used to look for given pattern from the lines. Matching lines are left remaining. With -v parameter the behavior is reverse, thus only lines not matching are left remaining.
alias lg="hal-device bme|grep"
alias g="grep"
alias gv="grep -v"

Alias suited for most users showing only line 5 (charge percentage):
alias b="lg erc"
(or alias b="hal-device bme|grep erc" )

Alias giving a bit more info for more advanced users and for battery usage testing. Shows lines 5, 13 and 18 (charge percentage, mAh remaining and voltage):
alias ba="lg erc;lg rr|gv h"

Alias for same as above except with line 14 (design charge in mAh) as well:
alias bat="lg erc;lg g.des;lg rr|gv h"

Alias for generally everything at least somewhat useful (lines 1-5, 13-15 and 18-19):
alias battery="lg bat|gv nf|gv pr|gv yp|gv un|gv is|gv lc|gv im"

As for advanced info about how charge remaining in mAh and voltage vary depending on power usage. Voltage tends to drop somewhat below the normal level when you do something intensive. More than when the charge is lower. The remaining charge shouldn't raise, but it seems the logic used in determining battery charge is a bit simplified, and as such there are some differences there. After a period of intensive usage, the charge remaining may actually raise around 10-20 mAh while the device is at idle for 5-20 minutes. It is crucial to experiment around with this a bit for more accurate results on battery usage tests.


In case you have something to add (or perhaps found an error), feel free to comment. I will be updating this post to match latest information and answering all possible questions people might have.

msa 2009-12-10 19:31

Re: Guide to get detailed battery information
 
um... thanks?

is it possible to make a script or something like that which only outputs specific values?

(and then, consequently, create some kind of shortcut for the desktio so you can just click/push on it and get all intersting information for you output on the screen)

Phantasm 2009-12-10 19:41

Re: Guide to get detailed battery information
 
Quote:

Originally Posted by msa (Post 421416)
um... thanks?

is it possible to make a script or something like that which only outputs specific values?

(and then, consequently, create some kind of shortcut for the desktio so you can just click/push on it and get all intersting information for you output on the screen)

For the script, sure. Go ahead and experiment with grepping on the X terminal. Not sure about making such shortcut.

412b 2009-12-10 23:39

Re: Guide to get detailed battery information
 
A small hint: "hal-device" will give you the output much faster. As I still have no n900 I can propose "hal-device bme" ;)

Phantasm 2009-12-11 00:02

Re: Guide to get detailed battery information
 
Quote:

Originally Posted by 412b (Post 421853)
A small hint: "hal-device" will give you the output much faster. As I still have no n900 I can propose "hal-device bme" ;)

Ah yes. Seems to work just fine and is much faster, thanks. Though, the output isn't organized as well. Will update the first post accordingly.

adrianp 2009-12-11 13:16

Re: Guide to get detailed battery information
 
Quote:

Originally Posted by Phantasm (Post 421349)
Alias for same as above except with line 14 (design charge in mAh) as well:
alias bat="lg erc;lg g.des;lg rr|gv h;

Thanks for this - one tiny thing, missing " from end of this alias.

Phantasm 2009-12-11 15:27

Re: Guide to get detailed battery information
 
Quote:

Originally Posted by adrianp (Post 422717)
Thanks for this - one tiny thing, missing " from end of this alias.

Ops. Fixed and thanks for pointing it out. :)

M289 2009-12-11 16:37

Re: Guide to get detailed battery information
 
Wouldn't it be possible to create a widget with detailed battery info?

I have to admit I have yet to take a look at the sdk/docs etc. :)

Phantasm 2009-12-11 17:15

Re: Guide to get detailed battery information
 
Quote:

Originally Posted by M289 (Post 423096)
Wouldn't it be possible to create a widget with detailed battery info?

I have to admit I have yet to take a look at the sdk/docs etc. :)

I'm sure it is. Just takes some random Maemo coder 15 minutes or so prolly.

Would be neat to have a widget that replaces the normal battery bar with battery charge percentage number.

412b 2009-12-17 19:41

Re: Guide to get detailed battery information
 
Quote:

Originally Posted by Phantasm (Post 423166)
I'm sure it is. Just takes some random Maemo coder 15 minutes or so prolly.

LOL
Quote:

Originally Posted by Phantasm (Post 423166)
Would be neat to have a widget that replaces the normal battery bar with battery charge percentage number.

There is, but not for Maemo 5 at the moment ;) Porting is in progress ;)

Phantasm 2009-12-18 14:41

Re: Guide to get detailed battery information
 
Quote:

Originally Posted by 412b (Post 432336)
LOL

There is, but not for Maemo 5 at the moment ;) Porting is in progress ;)

Nice nice. Will have to get it once it is ready.

filbert 2009-12-21 11:06

Re: Guide to get detailed battery information
 
Thanks for the useful post...

Have you found anything that shows the charging current? I have been trying to compare the rate of charge of the supplied charger and various other chargers (using the supplied CA-146 adapter).

Rgrds

Peter

Phantasm 2009-12-21 20:17

Re: Guide to get detailed battery information
 
Quote:

Originally Posted by filbert (Post 436228)
Thanks for the useful post...

Have you found anything that shows the charging current? I have been trying to compare the rate of charge of the supplied charger and various other chargers (using the supplied CA-146 adapter).

Rgrds

Peter

"hal-device bme" shows charger type when the device is being charged. It might have some hints on the maximum charging current the device will try to draw.

Do note that Li-Ion batteries are charged with fixed current to 60-70 % charge and after that with fixed voltage to 100 %. The first stage on a fast charger is something like 40 minutes and the second stage will last somewhat over an hour. As such, a slower charger (or heavy usage while on fast charger) mainly affects the first stage only.

cgarvie 2009-12-22 13:29

Re: Guide to get detailed battery information
 
can any one explain why N900 says its battery says its full , the lahal batter charged level is only about 90%

Phantasm 2009-12-22 15:59

Re: Guide to get detailed battery information
 
Quote:

Originally Posted by cgarvie (Post 437478)
can any one explain why N900 says its battery says its full , the lahal batter charged level is only about 90%

Battery charge percentage is taken from current charge level divided by design charge level. Thus, the display is only 100 % when it is all new. With time and use, it will be lower and lower at fully charged state.

And the fully charged level may vary by at least 5 % between 2 sequential charges. As such, a single reading isn't too reliable. Thus, you might get 95 % next time you charge it.

jr1415us 2010-01-03 16:29

Re: Guide to get detailed battery information
 
I was successfully using the command "lshal grep | percentage", but now the terminal replies "-sh: percentage: not found"

What is going on here?

Thanks!

fnordianslip 2010-01-03 16:31

Re: Guide to get detailed battery information
 
Try: lshal | grep percentage

jr1415us 2010-01-03 17:18

Re: Guide to get detailed battery information
 
:o DOH! thanks

colnago 2010-01-03 21:24

Re: Guide to get detailed battery information
 
Is it possible to get a "battery usage application" like the one on the DROID? Where it shows which app/process is using % of drain:

http://affbook.com/wp-content/upload...tery-usage.png

krk969 2010-01-04 06:40

Re: Guide to get detailed battery information
 
Quote:

Originally Posted by Phantasm (Post 423166)
I'm sure it is. Just takes some random Maemo coder 15 minutes or so prolly.

Would be neat to have a widget that replaces the normal battery bar with battery charge percentage number.

been reading this thread and ive got some nice suggestions in this thread.

Anyways there is another threadHERE - a desktop widget to show the percentage of battery but its not yet integrated into the status bar, currently it resides on the home screen.

have taken some inputs from this thread will see if I can incorporate it.

cheers

jakiman 2010-01-04 06:46

Re: Guide to get detailed battery information
 
Look at this thread. Those info might be exactly what can be used with the widget I mentioned!!

Desktop Command Execution Widget
http://talk.maemo.org/showthread.php?t=39177

krk969 2010-01-04 06:46

Re: Guide to get detailed battery information
 
Quote:

Originally Posted by cgarvie (Post 437478)
can any one explain why N900 says its battery says its full , the lahal batter charged level is only about 90%

has been discussed in many threads.==> click here for reference
With a widget to show the percentage Ive noticed this every time. The battery never reaches 100%

is there already a bug raised ?

shadowjk 2010-01-04 06:51

Re: Guide to get detailed battery information
 
I'd prefer if it was left the way it is. Or possibly recalibrate the battery capacity making 98% the new 100% instead of just using the capacity supplied by the battery at bootttime, which seems to varry from boot to boot, probably due to temperature.

N8x0 always reports 100%, remaining millamphours = battery's original capacity, and the meter thus gets progressively worse as battery ages and loses capacity.

Phantasm 2010-01-05 01:25

Re: Guide to get detailed battery information
 
Quote:

Originally Posted by krk969 (Post 452151)
has been discussed in many threads.==> click here for reference
With a widget to show the percentage Ive noticed this every time. The battery never reaches 100%

is there already a bug raised ?

Yes a bug has been raised and it is not a bug... See https://bugs.maemo.org/show_bug.cgi?id=7636#c16

As a summary battery charge percentage is current capacity divided by DESIGN capacity. Thus it is a feature it never reaches 100 %. Instead, a new battery at 60 % will last as long as say a 2 years old battery that can only reach 60 % at full charge lasts from that.

krk969 2010-01-11 06:47

Re: Guide to get detailed battery information
 
Quote:

Originally Posted by Phantasm (Post 453391)
Yes a bug has been raised and it is not a bug... See https://bugs.maemo.org/show_bug.cgi?id=7636#c16

As a summary battery charge percentage is current capacity divided by DESIGN capacity. Thus it is a feature it never reaches 100 %. Instead, a new battery at 60 % will last as long as say a 2 years old battery that can only reach 60 % at full charge lasts from that.

yes I had raised that bug :rolleyes:
anyways, i wasnt fully convinced with that bug resolution, will be getting back on that with more info when I have to reopen.
Any *fairly new" phone on the market always reports 100% battery and I dont believe that other OS'es extrapolate the value to display 100%.
All facts stated abt a lithium battery in that bug holds good for even other phones not only the N900 so that explanation didnt convince me fully.

Phantasm 2010-01-11 15:14

Re: Guide to get detailed battery information
 
Quote:

Originally Posted by krk969 (Post 463409)
yes I had raised that bug :rolleyes:
anyways, i wasnt fully convinced with that bug resolution, will be getting back on that with more info when I have to reopen.
Any *fairly new" phone on the market always reports 100% battery and I dont believe that other OS'es extrapolate the value to display 100%.
All facts stated abt a lithium battery in that bug holds good for even other phones not only the N900 so that explanation didnt convince me fully.

Most devices (laptops and phones) calibrate the battery capacity again with every full cycle. And they are made to show the battery as 100 % when it is full, no matter what is the wear level of the battery. On laptops you can typically see the current fully charged capacity and design capacity. And thus see the wear of the battery. Still it is displayed as 100 % when fully charged no matter the wear.

N900 doesn't do it the same way. Yes, it calibrates the capacity every full cycle, but it doesn't use the capacity for calculating the percentage. It is only used in calculating the mAh of the current charge. Eg. on a full charge, you'll get the mAh of fully charged battery based on latest capacity calibration. Then the mAh the device sees you having will be divided by design capacity and you get current charge percentage.

It is a feature and not a bug and there is no way around it whatsoever.

If you have something regarding some people having problem with the new phone battery rarely having figures in the order of 70 % or even lower when fully charged, then that is case for another bug report regarding that problem. It is no use reopening the old bug report for a whole different problem, as the bug report only deals with the specific problem it is about.


All times are GMT. The time now is 12:53.

vBulletin® Version 3.8.8