[UTILITY] Battery calibration tools

Search This thread

xp24002000

Member
Apr 16, 2007
37
7
not working for me

tried over and over, i reached 3201mV, popup flag appear, plug in charger cord quickly, red led confirm charging, and then after 10-15 sec of charging, phone shutdown each time, tried even turning lcd off, the same after 10-15 sec of charging with lcd off screen popup with airplane mode and sense lock screen, shutdown dialog box appear and phone automaticaly power off.
 
Last edited:

klaydze

Senior Member
Feb 5, 2010
254
21
Manila
2. In the Learn Prep tab:
a. set your aEvolts to 3201 (type on each line: Register:0x 66 Value: a4 and press save)
b. set your stop charging current to <20mA (Register:0x 65 Value: 06 and press save)
c. if Capacity/mAh drops to near empty prior to 3201mV being reached, the app will automatically raise capacity by 200mAh so phone doesn't auto-shutdown prior to reaching 3201mV

Where can i actually set the "aEvolts" and "Stop Charging Current" under LearnPrep tab?
The only input field that i can see is the "Register: 0x" and "Value:"

"Advance Options" in the Settings is already ticked but then, there still no "aEvolts" and "Stop Charging Current" input field.

Thanks

----------------------

Darn! My phone dies before reaching 3201mV (3250mV to be exact). How do i calibrate that if that's the behaviour of my battery.
 
Last edited:

St4hli

Senior Member
Sep 19, 2010
81
43
Where can i actually set the "aEvolts" and "Stop Charging Current" under LearnPrep tab?
The only input field that i can see is the "Register: 0x" and "Value:"

"Advance Options" in the Settings is already ticked but then, there still no "aEvolts" and "Stop Charging Current" input field.

Thanks

----------------------

Darn! My phone dies before reaching 3201mV (3250mV to be exact). How do i calibrate that if that's the behaviour of my battery.

You just have to do what's described in the brackets ;)

Sent from my HTC Desire using XDA
 
S

Soldier-2Point0

Guest
Hi guys, just wondering if you could make this work on the Motorola Atrix 4G. We are having problems with the battery percentage not reaching 100%. A lot of people would appreciate it.

Sent from my MB860 CM7 RC1 37p Radio
 

RogerPodacter

Senior Member
Apr 12, 2010
5,654
425
Los Angeles, CA
Hi guys, just wondering if you could make this work on the Motorola Atrix 4G. We are having problems with the battery percentage not reaching 100%. A lot of people would appreciate it.

Sent from my MB860 CM7 RC1 37p Radio

I already tried to edit the atrix driver last year when I owned that phone, its just not possible unfortunately. Motorola is using some generic fuel gauge we don't know which, and they hide some of the kernel code for battery. Sorry.
 
S

Soldier-2Point0

Guest
I already tried to edit the atrix driver last year when I owned that phone, its just not possible unfortunately. Motorola is using some generic fuel gauge we don't know which, and they hide some of the kernel code for battery. Sorry.

N00b question : how can I edit a /sys text file and make the change stick?

Sent from my MB860 CM7 RC1 37p Radio
 

RogerPodacter

Senior Member
Apr 12, 2010
5,654
425
Los Angeles, CA
N00b question : how can I edit a /sys text file and make the change stick?

Sent from my MB860 CM7 RC1 37p Radio

Two ways I can think of. Either change in the kernel code whatever value is making it default to that value. But sometimes that value comes from the hardware that defaults upon boot, so you can't change it.

Or write a boot script or init d type script to set it manually each boot up.

It really depends on which hardware or sysfs file you're looking at.
 
  • Like
Reactions: temasek

temasek

Senior Member
Feb 2, 2010
23,624
85,271
Singapore
Two ways I can think of. Either change in the kernel code whatever value is making it default to that value. But sometimes that value comes from the hardware that defaults upon boot, so you can't change it.

Or write a boot script or init d type script to set it manually each boot up.

It really depends on which hardware or sysfs file you're looking at.

Nice to see that father of N1 battery calibration is still active here. :)
 

ahac85

Senior Member
Aug 7, 2010
1,583
246
hi just want to know im understanding this write, after battery age is dedicted we just update our FULL40 value thats it?

we leave aged capacity as 1393, or do we have to update that aswell?
 

hgmichna

Senior Member
Aug 28, 2010
982
402
Munich
michna.com
Simplest method

What is the simplest method to recalibrate the phone/battery combo? Since the phones are usually already designed to recalibrate themselves, what do you have to do to trigger that procedure and let it run its course?

I see different recommendations, charge from totally empty to full with phone on, phone in airplane mode, phone off. Discharge first with phone on, restart after discharging and wait for shutdown two times, three times, hold the power button for 10 seconds, plug in the charger while the phone is shutting down, etc. Not everybody seems to know what he's talking about. Most of it is bound to be nonsense, but where is the truth?
 

RogerPodacter

Senior Member
Apr 12, 2010
5,654
425
Los Angeles, CA
What is the simplest method to recalibrate the phone/battery combo? Since the phones are usually already designed to recalibrate themselves, what do you have to do to trigger that procedure and let it run its course?

I see different recommendations, charge from totally empty to full with phone on, phone in airplane mode, phone off. Discharge first with phone on, restart after discharging and wait for shutdown two times, three times, hold the power button for 10 seconds, plug in the charger while the phone is shutting down, etc. Not everybody seems to know what he's talking about. Most of it is bound to be nonsense, but where is the truth?

This thread answered that question precisely, but only for the nexus one with its fuel gauge and battery. It all depends on the phone. Each uses a different fuel gauge chip, so you have to learn that info first. But after I studied for this project and read up on all the fuel gauges in use out there I'll give you my insight.

Basically there is nothing you can do typically. Charge then discharge, charge phone off, plug in for 8 hours, it all has zero effect. The voltage points are hard coded and nothing you do will change it or re learn or calibrate it. Its like a dumb chip, it doesn't know or care.

However this isn't always true. In the case of this thread we discovered this battery chip has a learn mode, and we had to root to enable it.

Many htc phones use similar chips so its possible you could do something similar. Depends on the model.

Most Samsung phones use the "dumber" chips and are unchangeable, nothing you do during charge will have any impact. Day 1 will act like day 300 from the battery perspective.

However the new sgs3 looks like it may use a more smart fuel gauge and could possibly have calibration functions. Root needed first of course.

That's basically it. Nothing you can do. The battery doesn't know if its day 1 brand new or a year old. That's how I use it anyway, I just plug and go. No top off charge, no full cycle first, no drain to empty, etc. None of it, cause we learned that it really makes no difference.
 

hgmichna

Senior Member
Aug 28, 2010
982
402
Munich
michna.com
Thanks for the good information! Let me try to put things in perspective.

The Nexus One has a learn mode and can be calibrated, but the calibration becomes necessary only because it is already misdesigned and does not learn automatically.

Learning automatically should be almost trivial with the simple assumption that a Li-Ion battery is full around 4.1 to 4.2 V and empty around 3.2 to 3.4 V. If the phone can measure the battery current, determining the battery's capacity during a continuous empty-to-full load cycle is, indeed, trivial.

Let me ask a slightly different question: How can a normal user recalibrate his unrooted Nexus One?

Additional questions:

Does the unrooted N1 also go into learn mode as the battery goes empty? What is the best way to make sure it is in learn mode?

Why are people recommending to attach the charger quickly after the battery has gone empty? This does not seem to make sense. Is it the consequence of yet another misdesign?
 

theloginwithnoname

Senior Member
Mar 19, 2010
669
48
Samsung Galaxy Note 10+
Let me ask a slightly different question: How can a normal user recalibrate his unrooted Nexus One?

Does the unrooted N1 also go into learn mode as the battery goes empty? What is the best way to make sure it is in learn mode?
As Rog says, it has been answered already (here).

Why are people recommending to attach the charger quickly after the battery has gone empty? This does not seem to make sense. Is it the consequence of yet another misdesign?
Couldn't tell you, only that it works but is temporary.

Good luck.
 

hgmichna

Senior Member
Aug 28, 2010
982
402
Munich
michna.com
As Rog says, it has been answered already (here).

That posting did not say whether the N1 would have to be rooted or not. I take it that the procedure works on unrooted Nexus One phones as well.

As to the requirement of plugging in the charger during the few seconds while the phone shuts down on its own, this does not only sound strange, it also conjures the image of thousands of N1 users worldwide, staring at their phones while holding the phone in one hand and the already connected charge cable in the other, waiting subserviently for the phone to shut down. Perhaps the person who invented this rule now has his fun while thinking about all those stupid users following his new cargo cult.

More seriously, if anybody finds that beginning to charge the phone much later, long after it has shut itself down, also leads to learn mode and works just as well, please let us all know. Or perhaps one can restart the phone much later and then wait only one minute for it to shut down again. Would that work? Or you could recharge it for just a minute, then let it go down again, which also would not take very long. I think, if any of these procedures worked, it would be a big improvement over having to put matches between your eyelids while waiting an eternity for the shutdown. :)
 

theGanymedes

Senior Member
Oct 3, 2010
474
253
Let me try to add up what I know here too, as a guy who fiddled with the battery driver as well :)

As @hgmichna told, normally the chip is supposed to calibrate the battery accordingly with the usage. However, I've seen that due to a driver bug (or actually it's not a bug but rather a "wrong assumption") the Sense battery drivers overwrite the calibration data after each charging to full level; thus making the chip useless about the calibration.

Another issue is about the phones: even though the bug is "fixed", the chip still (I really don't know why) runs on "offline" mode when the device is on but not charging. This makes the chip run on bare minimum configuration; thus not running some algorithms like "calibration algorithm". Even though it's possible with a hack to make chip run on "online mode", the effects (side or desired) are unknown yet - someone should test the effect in a long time usage and it's not me :).

Thus, making the calibration yourself seems to be most "feasible" solution that yields the results in shorter time span. After all, calibration is not that frequently needed: one calibration per year is fairly enough most of the time.
 

theloginwithnoname

Senior Member
Mar 19, 2010
669
48
Samsung Galaxy Note 10+
calibration is not that frequently needed: one calibration per year is fairly enough most of the time.
every 100 battery cycles ("charge to full battery") is best ;) remember, to keep it you need to charge the device ON - i reverted to airplane and silent modes instead of turning the device off, such was my need/wish to know my battery remaining was accurate to 0%
 

hgmichna

Senior Member
Aug 28, 2010
982
402
Munich
michna.com
every 100 battery cycles ("charge to full battery") is best ;) remember, to keep it you need to charge the device ON - i reverted to airplane and silent modes instead of turning the device off, such was my need/wish to know my battery remaining was accurate to 0%

I have also successfully recalibrated my Nexus One, charging in Airplane mode, but this contradicts the very explicit advice given in the very first message of this long thread.

Has anybody successfully calibrated, while charging it powered down? I mean, run it until it shuts down on its own, plug in the charger and let it charge without restarting it?

I am also getting curious about other phones. Any knowledge there? How do they usually calibrate their battery meters?
 

theGanymedes

Senior Member
Oct 3, 2010
474
253
I have also successfully recalibrated my Nexus One, charging in Airplane mode, but this contradicts the very explicit advice given in the very first message of this long thread.

Has anybody successfully calibrated, while charging it powered down? I mean, run it until it shuts down on its own, plug in the charger and let it charge without restarting it?

I am also getting curious about other phones. Any knowledge there? How do they usually calibrate their battery meters?

I already described the steps needed in order to be able to charge off... It's a few pages behind ;)
 

RogerPodacter

Senior Member
Apr 12, 2010
5,654
425
Los Angeles, CA
That posting did not say whether the N1 would have to be rooted or not. I take it that the procedure works on unrooted Nexus One phones as well.

As to the requirement of plugging in the charger during the few seconds while the phone shuts down on its own, this does not only sound strange, it also conjures the image of thousands of N1 users worldwide, staring at their phones while holding the phone in one hand and the already connected charge cable in the other, waiting subserviently for the phone to shut down. Perhaps the person who invented this rule now has his fun while thinking about all those stupid users following his new cargo cult.

More seriously, if anybody finds that beginning to charge the phone much later, long after it has shut itself down, also leads to learn mode and works just as well, please let us all know. Or perhaps one can restart the phone much later and then wait only one minute for it to shut down again. Would that work? Or you could recharge it for just a minute, then let it go down again, which also would not take very long. I think, if any of these procedures worked, it would be a big improvement over having to put matches between your eyelids while waiting an eternity for the shutdown. :)

The reason you have to plug in quickly right before empty is because that's the only time the learn flag is activated, but this is also what shuts down the OS. So you only have a few second window.

And yes non rooted could still activate this learn mode, I did it once only. Its extremely difficult. You won't know when the learn flag flips until the phone already begins shutting down. That's why I had to modify the driver. But yes you could also just leave the phone off and charge, but you won't be seeing if the learn flag is actually on. And subsequent boot up sometimes clears the status register thus wiping your learn and new age value since this chip is so fussy.
 
  • Like
Reactions: hgmichna and ai6908

Top Liked Posts

  • There are no posts matching your filters.
  • 35
    I'm using the latest app with Pershoot's latest kernel. found no issue so far, the apps works very well :D
    on "Learn Prep" page this time I'm able to set both age to max and Full40 value, before the release I could only set age to max.

    by the way, may I ask a question please :)
    I'm using Nexus One OEM battery, what Full40 value would you suggest to use?
    Also, recently my phone powers off before learn flag goes on, voltage was at around 3.42v, is this normal?

    How to calibrate your battery using the Battery Calibrator App....
    1. Use the battery calibrator app v.1.3.0 to do the following:
    a. Open the app and go to menu>settings and check all boxes. Auto-on airplane mode is optional
    b. set your age to 100 using the battery app under the Learn Prep tab and press Save
    c. set your full40 to 1452mAh in the same tab if using the stock capacity OEM battery and press Save
    NOTE: set your full40 to 1650mAh or higher if using an aftermarket battery and save

    2. In the Learn Prep tab:
    a. set your aEvolts to 3201 (type on each line: Register:0x 66 Value: a4 and press save)
    b. set your stop charging current to <20mA (Register:0x 65 Value: 06 and press save)
    c. if Capacity/mAh drops to near empty prior to 3201mV being reached, the app will automatically raise capacity by 200mAh so phone doesn't auto-shutdown prior to reaching 3201mV

    3. Achieving Learn Mode with the app:
    a. turn learn mode on in Learn Mode tab
    NOTE: to hit learn mode you must keep your current mA above -200mA draw at the empty point! The app will automatically enable GPS polling to keep you above the required minimum current draw.
    b. wait for mV to drop to 3201mV (the learn mode pop-up box will appear & learnf button will light up)
    c. insert charger IMMEDIATELY! (You will see a pop-up message saying Learn Mode is active.)
    d. turn off and close any open apps you have running, but leave Battery Calibrator open.
    e. put phone into airplane mode so that you don’t get unexpected current draw near the full point.
    f. set SetCPU profile to disable overclocking. (set min/max to the same value, ie. 998\998max)
    g. charge for a full 4 hrs with stock battery and screen off, 5 hrs for larger capacity batterys.
    NOTE: if you want to, you can actually use your phone until the charge reaches 80-90%, then use airplane mode and DO NOT touch the phone, peek, turn on the screen....DO NOTHING but walk away til time is up.
    h. unplug and reboot, your new age should be set automatically. Learn is now complete and your phone should now charge to 100% and die at 0-1%. Also, some have reported having to manually power down/power up with the new app to have age reset by the application. If age isn’t change upon reboot, try power off/power on.

    4. Learn Failure:
    If your new age shows 94% upon rebooting, then learn mode failed and you need to do it again, paying close attention as charging nears 80% and above. This is where learn mode can be lost by rogue apps, auto-updates, calls, etc pulling the current down below the minimum prematurely.

    Note1: As current gets close to <50-60mA don't touch the phone or you may artifically increase the current draw pulling it below 20mA and it will end the learn cycle prematurely. Airplane mode helps prevent that.

    Note2: Learn mode cannot be achieve with the phone off. Leave the phone on until learn is complete and the battery status register shows 0x81. Done!

    How to perform a Capacity Test for your battery. Credit goes to the infamous Temasek!

    Prepare for another learn cycle
    This time we will do what I call a capacity test.
    Perform another learn cycle.
    Once cycle completed do not reboot. Check your battery log using an app like OS Monitor. See your highest achieved capacity at 99-100% before it completed its charge. The capacity should drop below your full40. Read the log properly. The highest achieved capacity before it drop below your full40 will be your new full40 value.
    With your new full40 value, perform yet another learn cycle.
    Enjoy your new calibrated battery!

    Congrats to Roger, Login and Jon...the app is FREE in the Market now!!!
    13
    progress status and useable findings

    status

    we have made mods to the kernel code (based on 2.6.35.x) to
    • make any register writable
    • make the following registers readable: AGE, Vae (ACTIVE_EMPTY_VOLT), and Status Reg (STS)
    • allow read/write of these registers via virtual files
    • remove pseudo-extended battery charging
    • edit 2010/11/17: created a "dumpreg" file to show all registers and their current values
    edit 2010/11/17:
    work is being done on a GUI app with the following initial functionality:

    • show when learn mode is hit
    • save age when learn mode is complete
    the following functionality may be in:

    • option to restore age when app launched


    HOW-TO

    mtw4991 said:
    How to calibrate your battery using the Battery Calibrator App....
    (original text: http://xdaforums.com/showpost.php?p=9583271&postcount=340)

    1. Use the battery calibrator app v.1.3.0 to do the following:
    a. Open the app and go to menu>settings and check all boxes. Auto-on airplane mode is optional
    b. set your age to 100 using the battery app under the Learn Prep tab and press Save
    c. set your full40 to 1452mAh in the same tab if using the stock capacity OEM battery and press Save
    NOTE: set your full40 to 1650mAh or higher if using an aftermarket battery and save

    2. In the Learn Prep tab:
    a. set your aEvolts to 3201 (type on each line: Register:0x 66 Value: a4 and press save)
    b. set your stop charging current to <20mA (Register:0x 65 Value: 06 and press save)
    c. if Capacity/mAh drops to near empty prior to 3201mV being reached, the app will automatically raise capacity by 200mAh so phone doesn't auto-shutdown prior to reaching 3201mV

    3. Achieving Learn Mode with the app:
    a. turn learn mode on in Learn Mode tab
    NOTE: to hit learn mode you must keep your current mA above -200mA draw at the empty point! The app will automatically enable GPS polling to keep you above the required minimum current draw.
    b. wait for mV to drop to 3201mV (the learn mode pop-up box will appear & learnf button will light up)
    c. insert charger IMMEDIATELY! (You will see a pop-up message saying Learn Mode is active.)
    d. turn off and close any open apps you have running, but leave Battery Calibrator open.
    e. put phone into airplane mode so that you don’t get unexpected current draw near the full point.
    f. set SetCPU profile to disable overclocking. (set min/max to the same value, ie. 998\998max)
    g. charge for a full 4 hrs with stock battery and screen off, 5 hrs for larger capacity batterys.
    NOTE: if you want to, you can actually use your phone until the charge reaches 80-90%, then use airplane mode and DO NOT touch the phone, peek, turn on the screen....DO NOTHING but walk away til time is up.
    h. unplug and reboot, your new age should be set automatically. Learn is now complete and your phone should now charge to 100% and die at 0-1%. Also, some have reported having to manually power down/power up with the new app to have age reset by the application. If age isn’t change upon reboot, try power off/power on.

    4. Learn Failure:
    If your new age shows 94% upon rebooting, then learn mode failed and you need to do it again, paying close attention as charging nears 80% and above. This is where learn mode can be lost by rogue apps, auto-updates, calls, etc pulling the current down below the minimum prematurely.

    Note1: As current gets close to <50-60mA don't touch the phone or you may artifically increase the current draw pulling it below 20mA and it will end the learn cycle prematurely. Airplane mode helps prevent that.

    Note2: Learn mode cannot be achieve with the phone off. Leave the phone on until learn is complete and the battery status register shows 0x81. Done!

    How to perform a Capacity Test for your battery. Credit goes to the infamous Temasek!

    Prepare for another learn cycle
    This time we will do what I call a capacity test.
    Perform another learn cycle.
    Once cycle completed do not reboot. Check your battery log using an app like OS Monitor. See your highest achieved capacity at 99-100% before it completed its charge. The capacity should drop below your full40. Read the log properly. The highest achieved capacity before it drop below your full40 will be your new full40 value.
    With your new full40 value, perform yet another learn cycle.
    Enjoy your new calibrated battery!

    HOW-TO2:
    http://xdaforums.com/showpost.php?p=24599586&postcount=284 (as requested by St4hli)
    6
    reference material

    battery manufacturer technical info
    1. DS2784 data sheet - http://datasheets.maxim-ic.com/en/ds/DS2784.pdf
    2. Storing Fuel Gauge Parameters in the DS2784 - http://pdfserv.maxim-ic.com/en/an/AN4043.pdf
    3. Lithium-Ion Cell Fuel Gauging with Maxim Battery Monitor ICs - http://pdfserv.maxim-ic.com/en/an/AN131.pdf
    code


    app availability


    reference info


    related apps


    specific code references
    (with reference to the manufacturer battery info above)
    • 1 - CONTROL REGISTER FORMAT - page 12 - UVEN—Undervoltage Enable
    • 1 - CAPACITY ESTIMATION ALGORITHM - page 21 - Figure 3: Top-Level Algorithm Diagram
    • 1 - page 24
      • from Active Empty Voltage (VAE) - includes Aging Capacity (AC) and Age Scalar (AS)
      • CAPACITY ESTIMATION OPERATION - Learn Function ("A continuous charge from empty to full results in a learn cycle." then "First, the active empty point must be detected."!!)
    • 1 - page 25 - STATUS REGISTER FORMAT
    • (to be completed)


    with thanks to RogerPodacter for his help in compiling this list
    4
    This thread is for those following the battery calibration thread that would like to help build tools to read and set some advanced battery values, and ultimately recalibrate in learning mode.

    It takes its inspiration from this forum thread over at precentral :

    http://forums.precentral.net/palm-pre/256967-find-out-how-good-bad-your-battery.html

    See HOW-TO in post 3 below, or in-thread post from mtw4991, for instructions on using app to calibrate
    4
    So basically ,
    after the first calibration, We just need to set full40 = 1180,
    Register : 0x 65 , value HEX
    0x66: value HEX
    Is that how it should be done?
    Thanks for your help =)

    1180 is my example - you can find this out by copying the Capacity (mAh) value at the first page of the app, after the calibration is completed.

    Another thing, don't set Full40 to 1180 (capacity value), but set it to 1180 / 0.94 - it should be slightly higher. (if your cap. is 1200; you should set it to 1200/0.94 = 1276.5 --> 1276)

    You don't need to reset 65 and 66 again, but maybe 62 and 63 - the values to write there is [ Capacity * 15 / 6.25 ]. You should convert this to hex and write to 62 and 63.

    Example:

    Say, I have 1452 mAh battery. I've calibrated it (exactly like described) and turned out my battery age is 75%.

    Now, my actual capacity, then, turns out to be 1452 * 0.75 = 1089.

    My new Full40 value becomes: 1089 / 0.94 = 1158.5 ~ 1159.

    Now, we're setting the age back to 94% - it's because the phone does this when charged off anyway.

    Now, setting Full40 value to our new Full40 -> 1159.

    ---- Note: I've seen that following part is actually not necessary, but if you want to give it a shot, go ahead: -----------------

    Now, the hard part, we must set "Aged capacity" because this value is used when you charge your phone off (Correction: I thought this way but it wasn't the case). First, we find the value to write, then convert it to HEX.

    1- Calculate the value to write: 1089 * 15 / 6.25 = 2613.6 --> 2613
    2- Convert it to Hex: 2613 ---> 0A35
    3- Write it to registers (from the second page of application):
    a) Register 0x62 -> 0A -> press Save
    b) Register 0x63 -> 35 -> press Save

    DONE! Now you have permanently set your calibration!