[REQ] Battery calibration tool... - Android Software Development

http://forum.cyanogenmod.com/index.php?/topic/2354-request-seidio-extended-battery-level-fix/
The state-of-charge of all non-oem batteries are registered incorrectly, resulting in soft shut-downs when the android os assumes the battery state-of-charge to be low, when in fact it is not.
By some educated guesswork, it is assumed that the moto droid uses a hall effect sensor to detect current, and then integrates to find the current state-of-charge. This calculation requires a calibration, which is obviously set for the stock battery.
Is it possible to find where this calibration value is, and change it manually, to allow the droid to register the correct state-of-charge for extended life batteries?

Is the following of any relevance? AmonRa's series of Recovery Roms include the option: Wipe the battery stats in /data. This post claims: It's thought that if you fully charge, delete the battery data file, use your phone completely, recharge fully that your phone's battery stats are changed and helps battery life.

Related

battery metter unreliable

i have noticed that the battery metter is completely unreliable
for example it shows 28% left (btw, i installed FInixNOverBattery for percentage indication) and after a soft reset it shows 41%
or it shows 50% and after soft reset it shows 31%
in this way i can never estimate how long the battery will last
does anybody faced this issue? any solution fot it? (i also tryed to calibrate by completely drain the battery followed by complete charge withe the device turned off)
thank you in advance!
noris08,
it is completey normal to experience big jumps in % after a reboot. The battery % is just a representation of the actual voltage of the LiPoly battery, which usually recovers (rises) quite a bit when there is no load on the battery (even for a short time).
maybe what you say it is true, but i never experienced this behaviour with any of my previous phones. and i had a few, including wm for a few years
and variations of 10-15% - i find them too big
I noticed the same thing. Any explanation for this? Or it is just that FInixNOverBattery is not reliable/compatible/accurate ?
Voltage may vary/jump around due to environmental changes and power consumption or voltage sensor may be insufficiently accurate to provide reliable voltage readings for 1% steps. This is one of the reasons why many battery drivers in WM only provide remaining charge percentage in 10% steps.
In this light, voltage on its own is not a sufficient indicator of remaining charge percentage. Other parameters, such as voltage deviation and other factors, such as power consumption and temperature may need to be taken into account to obtain a more accurate evaluation.

Draining out battery full - will it work?

This video : http://www.youtube.com/watch?v=DqdHFmKq57c
Says if you drain your htc hd 2 battery full out. And then charge it full. It will work longer.
Is this right? And some pp says its bad for your battery.
106 views... no replies ;(
well.. the idea originated from laptop battery tricks and some facts about the technical side of the problem.
If i try to simply put it, a laptop battery contains (beside the actual battery) a small pcb that has a charge/discharge controller and a eeprom memory chip (among others). The point of having these is also pretty simple. The battery actively communicates with the laptop via a i2c interface, so that the laptop always knows the state of the plugged in battery. The laptop itself can't measure the current or voltage of the battery and doesn't know it's capacity or composition. Instead the chips inside the battery does all this work and reports it to the laptop. That's how the laptop knows when you plug a different capacity battery or other things. The percentage of power remaining is measured by the chip inside the battery and stored in a volatile memory also contained on the small pcm inside. This memory can be accesed by the laptop and from there, it will display you the remaining power left (in percents %). This is updated as long as there is any notable difference from what the chip measures from the battery cells and what was the last measurement made. So.. what would happen if you would charge the battery to 100% full, then disassemble it, remove the 100% charged cells and replace them with 50% charged ones.
When you would start the laptop next time, it will STILL display 100% charge, the last measurement, and will assume this state is valid for the cells. When the physical batteries will drop the charge level with 1% the laptop would display 99%. So around 50% displayed the batteries will actually be empty. When you charge them back, the laptop would start from 50% and go back to 100%. The actual batteries would get only 50% energy, so they won't get fully charged, therefore you get less battery life.
Of course, this is a very exagerated scenario, but in practice, sometimes small errors can occur, when the physical level of the batteries is a bit different to what the battery controller recorded. In this case, a full discharge then recharge can help to correct this issues (but only if you're talking about couple percents - not more).
But... when we're talking about phones, things are quite different. The communication algorithm between the battery and phone is more simpler and the battery itself doesn't know it's charge state. The phone will actively probe the battery in order to update it's status. So, if i remove the battery and drain it somehow, the phone will display it's correct physical charge next time i plug it in. This is possible because a phone battery and the phone itself is simpler by design then a laptop for example.
So why laptops used such complicated charge algorithms? Mainly because 2 reasons. One because laptop batteries are dangerous things. If improperly charged or damaged they CAN explode. If the cells are damaged, overcharged or the temperature is high, the controller chip will change the state of the eeprom memory so that the laptop and it's OS to see that the battery was damaged/empty and shutdown at once. The other reasons is quite commercial based. The charge controller counts each charge cycle and stores it in that eeprom memory. So if the manufacturer specified a specific number for the charge cycles, when this number is reached, the controller will simply rewrite the eeprom and state that the battery is "dead". So.. go get a new one.
I disassembled many batteries and among "dead" ones, i found many cases where the cells were actually in pretty good shape and functional. I measured cells with more then half the original design capacity still available, but the battery pack was reported as being "dead".
So back to hd2. As i've stated, phones use simpler charge/discharge algorithms. The better part is that they are more simplistic and efficient at measuring the actual physical state of the battery. So, a calibration isn't required like on some laptops.
However, sometimes is good to have a full discharge/recharge cycle. This being because of the chemistry of such a battery. It won't do miracles, it won't make the battery last longer on a charge but it could prolong overall battery life. Lithium is a very reactive element, a deep discharge about once a month will help reduce the effects of naturally occuring oxidation of such materials in an electrolytic compound.

[Q] Isn't a battery still a battery, regardless of OS?

I was just wondering about the whole deal with wiping the battery stats. To me it seems as if the point of this is strictly to get the OS to report and understand the battery more so than anything to do with the battery itself. I mean, the OS can't actually change the physics of the battery, right?
But the OS needs to understand what a full charge is and what an empty charge is, so that it knows when to shut down and when to stop charging and all that sort of stuff.
What I'm thinking is that if you wipe the stats and it's not at 100%, it will think that the discharge from that point to an actual low level is the full breadth of charging and adjust accordingly.
Is any of this remotely accurate? Or am I just making wild assertions?
Actually...it's the software that can make or break battery life...take for example background notifications. Wifi uses battery power and if you have different programs all polling for updates at x amount of times per hour..even when asleep..it will eat up battery juice...another example is the cm bug that kept the speaker on all the time and the nook never really went to sleep...it used tremendous amount of juice for not doing anything...another example..screen brightness..does not the software control how dim or bright you want it...and say you could not adjust the settings..your right..a battery is just a battery but how the kernel, drivers and loaded programs determine how fast or slow the battery power is to be used. Clearing the stats gives more accurate measurements for the kernel and hence will power down(power saver mode ) or other items for the kernel depending on what type of governor is on the nook..software wise.
I think you misunderstood what I was saying. What I'm trying to say is that the OS can't change the physics of the battery. Drain is drain, no matter what software is running. In other words, say you have two perfectly identical systems, both running the exact same software. The battery capacity is exactly the same on both and they both have the same drain. The battery doesn't actually drain faster on one vs the other, but the OS can *think* it's draining faster. That's why we have all these battery stats and such...right? Or am I wrong?
Oh Ok...you are right in the fact that it cannot and the software..depending on what it's state(charge level) is will determine how to run..it just makes it more accurate.
Wiping the Battery Stats tells the OS to start learning what the new High and Low are.
It doesn't matter what level of charge the battery has when you do this....
- As the battery gets lower the stat keeps updating the level as the new low.
- As you charge the battery it continuously updates the stat as the new High.
Once you have taken the battery to both of these extremes then, in theory, the OS will have accurate info on your battery.
At a certain point in time the battery stats stop updating which is exactly why it is important to do this.

CM10 Green Lens battery issues

Hello! I flashed CM10 on my green lens defy quite some time ago (2 months) and I had no problems at first. Then after flashing a new nightly (can't remember which one exactly, probably the 0904 one) I noticed that my battery is draining much faster than usual. Then two battery drops appeared - from 69% to 50% and 35% to 19%. My Defy shut down automatically once and I connected the charger to it ... the phone booted itself to the screen where it shows that it charges the battery and it showed 49%. Then I booted my Defy as usual and the battery icon showed only 4%. Hope I was clear and you guys can understand me! Is there a fix to that? Thanks in advance!
P.S. Forgot to mention I'm using Quarx's ROMs, if that's of any help.
Sent from my MB525 using xda app-developers app
u have to use battery fix search in forum ,u can find it
Thanks, I tried using red lens battery fix with no success. I tried wipe data and flashing the latest Quarx CM10 nightly and again - no success. I tried to use CM7 Kernel instead of Epsy's Kernel - NO success.
I have the same problem..help someone!!!
"Recently many users of the Motorola Defy phone have encountered sudden drops in battery charge after installing a new ROM. Such as, drops from 67% to 49%, from 34% to 19%, from 7% to 4%, etc.
I also have encountered such problem when installed CM7.2 after being used stock Froyo ROM for more than an year. I had searched forums for possible fix, but no method has helped.
Finally, I have made some tests with my phone and found interesting points about Defy battery that explain battery percentage drops.
Our Defy have very simple battery controller (it is referred as cpcap by Motorola). The controller does not calculate and provide battery percentage. It provides only a battery voltage and a current. The battd daemon do the battery percentage estimation. It seems some overcomplicated estimation algorithm is used to do that (I've seen the Coulomb counter technique is mentioned in the battd sources).
There are several battery percentage checkpoints at 5%, 20%, 50%, 80%, 100%. It seems the battd daemon have a voltage-percentage mapping table for these checkpoints. When a battery voltage reaches a checkpoint value then the percentage is immediately set to a corresponding value. All other intermediate percentage values are estimated by the battd daemon. The estimation is based on a battery capacity (requested from the battery itself) and the active current. A stock battery reports 1500 capacity. A 1700mAh Chinese battery, I also have, reports only 1200 capacity battd stores the last calculated battery percentage and voltage in the /data/battd/cc_data file. Data from the /data/battd/cc_data file is read on start-up and the percentage from this file is used as base and reported to the system. When battery is drained, the percentage is decremented. When you delete the cc_data and reboot, battd uses the current voltage and looks for the nearest checkpoint voltage value and sets the percentage accordingly.
How have I found the checkpoint values above?
Assume we have a brand new original Defy battery and it shows 25% of charge.
If you delete the cc_data file and then reboot the phone, battd will recreate the file and request the battery controller(?) for the current battery status. The controller will return 50% and battd show 49% to you (not 49% not 50%, due to rounding to the lowest integer). But the real charge is 25%! Now let the battery discharge. It will show to you 48%, 47%, 46%, etc. Great! But at 40-44% you get the instant drop to 19%, since the battery controller had reported real 20% charge at that point and battd has been forced to sync its estimated charge value to the real charge value.
When a battery is wearing its actual capacity is decreased. For example, it may be 1300 mAh after an year of usage. But battery still reports it have 1500 capacity and battd uses this capacity for its calculations. battd should decrement percentage a bit faster for this worn battery, but it still use the same decrement speed as for a new 1500 battery. When battery voltage reaches a check point value, battd updates percentage to corresponding checkpoint value and you register a drop.
battd has some battery information and correction data in the /pds/public/battd folder. This data helps battd to estimate battery charge more correctly. This folder contain 3 files:
Code:
batt_offset_data
batt_phasing_data
batt_tuning_data
Without this correction data you may encounter slight drops even on a new stock battery,
For Defy there at least 2 versions of battd. (Defy+ uses a different battd) Let's name them as old and new ones. To find out which version you have, check the size of the /data/battd/cc_data file.
cc_data = 16 bytes - old battd,
cc_data = 24 bytes - new battd.
Early stock Froyo ROMs have the old battd, newer stock ROMs have the new battd. CM7.2 is bundled with the new battd.
Is the battd version makes any difference in the battery readings? YES. The difference is in a user account which is used to run a battd daemon.
The old battd uses the mot_accy user account, The new battd uses the system account. The corresponding owner and group should be set for the /pds/public/battd folder and files inside it. Otherwise battd will not be able to read battery data from the /pds/public/battd folder and defaults will be used, which cause inaccurate estimations.
If you have used stock old Froyo ROM or old custom ROM, you had the old battd. The /pds/public/battd folder has permissions for the mot_accy user account only.
You install the CM7.2 ROM with the new battd and it can not read battery data from the /pds/public/battd folder, since battd is run under the system user account. You have inaccurate battery estimation and percentage drops even on a brand new battery.
That's why installing the old battd (and its companion lib libbattd.so) on CM7.2 resolves battery drops issue for some users.
If you are using CM7.2 or any newer CM you can just change the owner and group for the /pds/public/battd folder and files inside it. Set both owner and group to system and the new battd will be able to read battery data files.
If you still have battery drops then your battery is worn to some degree and battd can not estimate its charge properly between checkpoints.
Is it possible to correct this? Probably yes.
I was able to adjust checkpoint voltage values and eliminate drops on checkpoints. BUT the discharging speed is still the same and I have good discharge without drops from 100% to 10% and phone is turned off on 10% since a battery reaches critical voltage of 3.050V.
To adjust checkpoints it is needed to change the /pds/public/battd/batt_offset_data file. I have changed the last 3 bytes to 0xA0. It offsets voltage value for checkpoints on 50%, 20% and 5%.
The batt_phasing_data file have not helped at all in my tests. It contains correction values for displayed voltage, temperature, current.
The batt_tuning_data file is total mystery atm.
So the goal is to find a way to force battd to decrement percents faster for worn batteries. The simplest way is to patch the battd with hardcoded capacity value (e.g. 1300) instead of reading this value from the battery.
The other (better) option is to create a custom battery driver and use a very simple mapping from current voltage to percentage. Such method is used to display battery status in touch boot menu. Also Quarx started a custom battery driver some time ago in his git repository.
Important:
The battery calibration is a myth! The /data/system/batterystats.bin file is not related to battery charge/life/status (exactly as Google devs stated earlier).
In case of our Defy, charge the battery to 100% and keep charging for few hours after that. Then disconnect it battd will display correct 99%. That's all you need when changing ROMs or batteries! Do not waste your time on "battery calibration"!
Conclusion:
Find out which version of battd you are using.
Check owner and permissions for the /pds/public/battd folder and files inside it. Correct owner/permissions if needed.
Charge your battery to 100% and keep charging for few hours more.
If you still have battery percentage drops after that, your battery is worn to some degree. The sum of dropped percents indicates how bad is your battery (-10%, -15% etc, compared to a new battery). There is no way to magically increase real life for this battery. Drops just a display issue due to crappy cheap battery controller in our Defy and weak battd estimation logic. That's why stock ROMs have 10% steps for battery charge - to hide such issues."
Here from this thread: http://forum.xda-developers.com/showthread.php?t=1778492&highlight=battery

[Guide] Battery calibration for s3 mini

Some say battery calibration is a myth, I'm quite sure it works!
You can give that a try after flashing a new rom to improve your battery life! :victory:
(the guide is tested but still i'm not responsible for any demage to your phone)
1. you need a recovery to access a specific file
twrp works
2. you need the xposed app: disable low battery warning (or a likely name)
(for that you can fully dischage your phone)
3. you need a battery discharger app this one: Fast discharge
(for that you can faster discharge)
4. you activate the xposed app and discharge your battery with the app (set the app to discharge to 0%)
(i wouldn't activate the light or the vibration since i don't know if they can overheat for discharging the battery)
5. set the governor to performance to have a faster discharge
6. your phone will kind of be fully discharged and just turn off at maybe 5% battery or later
7. charge your phone just plug it in until it's 100%
(i couldn't boot like that to the system so i had to reconnect after 100% charging which isn't the right way to calibrate battery)
(so if you can then boot whilst charging or plug back in after booting on 100% quickly)
8. enter the recovery and search for this file:
> /data/system/ batterystats.bin
then reboot
thats all!
More info about the myth here. I only calibrate my bat when I feel it needs to be calibrated, even being a myth:laugh:
P.S: or you can download a battery calibration app from Playstore.
The myth of "calibrating the battery makes it last longer" was dispelled by Google's own engineers. All calibrating the battery does is wipe the battery statistics file that keeps the usage history you see in settings. This is something that happens when the device nears 100% charge anyway so its pretty much useless to do it.
As for "the right" way to calibrate the battery, the OP clearly has no idea what he's talking about... its the battery usage history file, there are 2 ways to delete it - manually or just charge the battery to 100%, neither of those does any harm to the device and neither is better than the other seeing as this whole thing of calibrating the battery is utter nonsense.
To which end I don't really see a reason or need for this thread.

Categories

Resources