What does "Battery Charge %" Mean?
Originally Posted by nitu12345
That means my battery's working fine..na??
Can u suggest me a gud free app to scan battery's performance?
Hws BetterBatteryStats_xdaedition_188.8.131.52 ?
And thanks a lot for clearing my doubts
U r bst
- I don't use battery monitoring apps. I'm not really sure what value they have except in deciding whether or not your battery is sort of "normal". Some of them try to "estimate" current rather than actually take measurements from hardware (which depends on the availability of both system hardware and kernel software, so it makes sense why a generic Android battery app might not even look at current measurements even when they are available on a particular handset/tablet) , so: garbage-in = garbage-out. Basically though, I can't make a recommendation as I haven't used them.
TL;DR - see attached plots at end of post.
I want to take this opportunity to show some more data that I measured in the hopes that it can add to folk's understanding. I made a bunch of measurements of my tablet under both discharge and charging conditions, Originally I was going to make a big long post, but it was simply too much effort to do a good job of it with all the data I had. So here is a mini-report about charging. In particular, it asks and answers the question:
"What exactly does charge percentage mean"?
Is it the measurement of Amp-hours pumped into the battery?
Or is it somehow proportional to battery voltage?
Before I begin I should point out just a few key observations. The 2012 N7 has a TI (Texas Instruments) chip - the BQ27541 (iirc), that has the sole purpose of observing the battery - the amount of current going into or out of the battery, and the battery voltage. It does NOT CONTROL ANYTHING - it is just an observer. For that reason, TI calls it a "fuel gauge" chip. It is connected to the processor via an I^2C bus, and the N7's kernel reads the "% charge" directly from this chip. There is no system "battery software" or "calibration software" which alters this number in the N7 - it comes directly from that BQ27541 chip
. No doubt there is a tiny amount of firmware in that chip, and the datasheet for that chip indicates it can be factory programmed with different battery curves. But for our purposes it is a black box that we can't easily change - the kernel interface on the N7 does none of that "factory programming", it just reads values from the "black box".
From that chip several things can be read - "% charge", "battery current", "voltage", etc.
Attached at the bottom of this post you will find a curious graph. It shows the behavior of five measurements versus time. "Potential", "Charge", "Current", "Energy", and "Percent". The reason that I said "curious" is that all the raw data were re-scaled so that the min-to-max range of each variable are "normalized" to the range 0.0 to 1.0 (except for the "Percent" variable, since charging here started at 6%).
for any given variable this is done by subtracting the minimum value from the dataset, and then dividing by (max - min), as in:
x' = [ x - min(x) ] / [ max(x) - min(x) ]
Why do things this way? Well, for one, so that all the different variables may be plotted on a single graph running from 0.0 to 1.0.
But more importantly, observing the "shape" of each curve in comparison to others gives you very good physical insight into what is happening under the hood.
A little background in physics:
I Current == Charge/second
Q Charge == Integrate[Current(t), dt] (note this is effectively the same thing as "Amp-hours")
P Power == Voltage*Current
E Energy == Integrate[Power(t), dt]
V Potential (= Battery Voltage)
So from measurements of I(t) and V(t) only - current and voltage, we can use numerical integration to figure out approximate values of Q (charge), and E (energy, or "work" that we put into the battery), starting from only the I(t) and V(t) measurements.
So finally - look at the first JPG image carefully. ("nexus7-2012-Normalized_ChargeCurrentVoltageEnergyPct_vs_Time.j pg")
What you will notice is that three variables: Charge (Q), Energy (E), and Percent all rise quite smoothly in a nearly straight line from 6% to 90% charge state, (or from 0 secs to 9000 secs). So this says that - even though the battery voltage is not smoothly increasing, nor is the current into the battery smoothly decreasing - the charging discipline enforced by the other
important chip in the N7 (the SMB347 USB Interface Chip) tries to perform a "constant power input" charging scheme.
A quick diversion: why is the shape of the Energy (E) curve almost identical to the Charge (Q) (or Amp-Hours) curve? It is because of the (apparent) "constant power input" scheme the charger uses: as the battery voltage rises, the amount of current used for charging is adjusted downward. Notice in the graph that even though the "Percent" variable is steadily rising in a straight line, neither the current nor voltage are behaving that way - they are almost inverses of each other so that I(t) * V(t) = Constant.
So - the conclusion, specifically for the N7 hardware - is that "battery percentage" is supposed to represent either Amp-hours input to the battery (charge), or Energy dumped into the battery during charging. For this specific device with it's specific hardware, they happen to be equivalent because of the constant power charging scheme.
Note there are a couple of other interesting tidbits in this graph. The charging cycle spends nearly 25% of the total time charging in the final 90-100% charging range. So if you are carefully watching your tablet charge, it will seem to "slow down" dramatically during that last 10% of charging. (I should also point out that my tablet charges quite a bit faster under normal circumstances - about 2.5 hours instead of 3.5 hours; I believe the script I used prevented the tablet from ever entering deep sleep during charging. A N7 tablet that isn't being held awake with wakelocks should charge in a little over 2.5 hours)
You will also notice that the battery is continuing to charge for about 20 minutes after it reached the "100%" charge state. That's because "100%" doesn't really mean that the battery has stopped charging. In this particular observation, the SMB347 chip was still pushing ~400 mA into the battery after the 100% mark had been reached.
Phew. Finally, I have attached another image ("nexus7-2012-BatteryVoltage_vs_ChargePct.jpg") that shows a display of battery voltage versus percentage charge for two charging cycles and one discharge cycle. Note that when the SMB chip needs to force current into the battery to charge it, it must raise the voltage in order to do that. So it is clear that battery voltage alone can not be used as a proxy for "charge percent", nor can you figure out what the charge is by only looking at battery voltage alone. Not only that, but look at the shape of the curve - it is not a straight line. There is very rapid voltage changes going on at the low end of "% charged" range during charging, very little voltage change occurring in the 90-100% range, and during discharge (red curve) there are are at least 3 different ranges where the slope of the battery voltages change relative to the "% charge" data that the TI chip emits. This is why I suspect that battery apps that only observe voltages probably are not capable of accurately predicting anything other than the ageing algorithms of the BQ27541 chip, and are probably absolutely useless for telling you anything from day to day.
OK, a couple more trivia observations:
- That BQ27541 chip is squirrelly (or perhaps it is the kernel interface, dunno.) There were many sampled data points where the "% charge" reading from the chip suddenly dropped from wherever it had been to *ZERO*. I was sampling the value once every 60 seconds for the data displayed here, but I have also sampled the sysfs (kernel interface) for that chip at much higher speeds, and it frequently produces garbage data
. Additionally, the same chip would frequently report *zero current* during discharge condtion - an impossibility. On their website, TI says "Not recommended for new designs". (Usually that is weasel-words that mean "we are aware of some buggy behavior that we are not going to tell you about") Note for instance in the second graph that the battery percentage values 26, 47, 58, 69, 79, and 84% never appear in ANY data set. That means that a battery app - or even an OS "low battery emergency shutdown" trap - could exhibit odd, buggy behavior if they do not use defensive techniques that assume that the data they are getting is partly corrupted. (multiple sample averaging and outlier detection).
- I believe the "sudden steps" in current that I observed during charging (prior post) were real - the tablet had it's WiFi shut off, and the tablet was not in use at all. So while it is certainly possible that random app behavior could have caused some fluctuation in current available to the battery, that would have been much more short lived. Is it possible that the SMB347 chip also has some bugs?
OK, here's the graphs folks. Have fun and good luck with your tablet.
"I'm gonna start coding placebo apps. That way I will be sure that the complaints are real and the praises hollow."