yashsingh1/xdaforums huggingface dataset:
[Nexus One Android Development] seanyzf:
ic.. now that i have it calibrated and it switches off @ 0-1%. I notice that once the batt went flat and doesn't power up, the batt age will change to 94% once I plug in the charger and turn it on.
[Nexus One Android Development] theGanymedes:
on two posts above, I've described how you can go around that problem.
[Nexus One Android Development] dunstan92:
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 =)
[Nexus One Android Development] theGanymedes:
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!
[Nexus One Android Development] dunstan92:
I see . Thank you for the explanation.

Am using a htc desire with driodzone's latest kernel for this battfix that you had posted in desire thread.

My phone keep shutting down after the flag is alerted and the charger is plugged in.

Managed to see that there is a warning saying unable to charge before the phone is fully turned off. So i have yet to calibrate the battery.
[Nexus One Android Development] theGanymedes:
That might be because the Sense kernels do use a different power supply drivers, and these drivers don't update values so often as chip does. Try writing manually the value of "04" to register 0x10 when your battery reaches to 10% or so.
[Nexus One Android Development] dunstan92:
Alright. Thanks. Now i have to find out how to convert the value to HEX.
[Nexus One Android Development] RogerPodacter:
For that particular command you dont have to convert. Just send 04 to reg 0x10. But the other reg yes converting is needed.

Note: the above i'm assuming you guys are trying to avoid missing the learn flag due to shut down etc.
[Nexus One Android Development] dunstan92:
Yeap, i know that for that part it doesnt need converting.

What i'm saying on converting is for this part

"Now, the hard part, we must set "Aged capacity" because this value is used when you charge your phone off. 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 "

I have no prior knowledge on hex so i do appreciate any help on converting or any guide for it. :)
[Nexus One Android Development] theloginwithnoname:
EXCELLENT work TG - that's exactly the kinda spirit we like to see!
[Nexus One Android Development] theGanymedes:
If you're using linux: run the calculator (Accessories -> Calculator), select Programming mode (Mode -> Programming) and then write the value you want to compute and press Enter when "Decimal" is selected on the left. Once you switch the left selector to "Hexadecimal", voila! (You can apply the process inversely to convert Hex to decimal).

Under windows, the calculator modes are in the first menu (I can't recall the name of the menu) and the same stuff works there.

If you can't reach to any of this, you have no chance but to divide the value to 16 repeatedly, then read the last division result as the highest bit, then read the remainders of the other divisions from newest calculation to latest, as the other bits.

Example: Value of 1345 at hex:

1345 / 16 = 84 (remainder

1

) / 16 =

5

(remainder

4

) --> stop here, cos can't divide more!

My hex value then:

541

Converting back to decimal is easier: 1 + (4 * (16) ) + (5 * (16^2)) ....

With this method, you can also calculate any base - you can find binary representation, for instance, if you use 2 (instead of 16 here).
[Nexus One Android Development] dunstan92:
Thanks for your help. Btw, I'm using windows and the calculator is able to convert the decimals to hex. Just entered the value of 04 to register 0x10.
[Nexus One Android Development] erklat:
Use app from this post.
[Nexus One Android Development] Wylker:
Thanks for the advice but I have changed to the sense app and have the same issue.
[Nexus One Android Development] theGanymedes:
Your kernel is unsupported. If you're using AOSP ROM, use Tiamat's or Thalamus's kernels, or if you're using Sense ROM, use mine or Droidzone's kernels.

If you use my kernel, my batt-fix thread has the modified app you must use (link was given above by erklat - thanks).
[Nexus One Android Development] tarroyo:
I'm currently using a new htc oem EVO 4G Design 1520 mah battery, my previous battery was a htc oem 1300 mah. I wiped the battery stats once, being that I'm now using a different battery.

Would I have to wait for my battery to age before trying to calibrate it? Or can I try these steps w/o any issues??? My device is a Desire Z/Vision running CM7

Reason I ask is, I tried using the tweak from this guide http://xdaforums.com/showthread.php?t=1226016 on my 1300 mah battery and it worked fine, With my 1520 mah battery that guide no longer works.
[Nexus One Android Development] theGanymedes:
First of all: don't believe into any document that talks about "batterystats.bin" file. I examined the code, and also read in Google Dev Talk that this file is just a dump file - it has no role but the log the output about usages of the battery by the applications. That file is cleaned in every full charge anyway.

Second: If you don't live any issues with battery, don't calibrate - you don't need it. By issues, I mean, weird percentage drops or shutdowns at high percentages. If you do think you battery is showing wrong percentage; first try this method:

- Use your phone till it shuts down itself.

- Once it has shut down, charge your phone when it's off.

- Once it's completely charged (green light is on), turn on and use it.

Another common misconception is about green light: when phone off, green light is shown only when charging is over. However, when phone is on; green light and capacity to stop is dependent of driver's behaviour. It's why we charge when device is off.

Once you do this, your battery is ready to use with every capacity it has. Till you start having issues, you can postpone calibration.

I recommend calibrating once in every 6 months - it should be enough.

NOTE: You can run those steps without any issue; but let me tell you: it's a little bit time consuming :)
[Nexus One Android Development] tarroyo:
Thanks for the quick reply, I'll try the power off and fully charge method then the steps in this thread.
[Nexus One Android Development] skhell:
What is the best battery percentage to activate the "Detect Learn Mode", or is this indifferent?

I have calibrated the battery of my Desire twice and still turns of at about 10/15%. In both times, I activated the ""Detect Learn Mode" with low percentage values, so I don't wait too long to put it to charge.

I will calibrate it again, and then, manually adjust the full40 and Aged capacity as previously stated.

Now, should I activate the "Detect Learn Mode" with an almost empty battery, or should I charge it first?
[Nexus One Android Development] tarroyo:
Read the post above mine, He explained the steps.
[Nexus One Android Development] skhell:
Are you talking about this one?:

http://xdaforums.com/showpost.php?p=23664987&postcount=2133

That refers to the method of charging it while the phone is off.

What I want to know is what is the best time to activate the "Detect Learn Mode" in the Battery Calibrator.
[Nexus One Android Development] theGanymedes:
You should not wait for some specific percentage: percentage is deceptive, because application automatically rises it whenever your empty voltage (3201 in the guide) is not reached yet.

If calibrating under Sense, however, you have to tweak it a little bit: if your voltage level is high (say 3500~) but your percentage is low; in order to do overcome this you must (say) write 05 to register 10 - this will make your current capacity approx 500 mA - which is something about 30%. We do this, just to assist the calibration, and only for Sense.

When your voltage drops to 3200 ~, the LEARNF flag will be lit and application will ask you to plug in - don't plug in earlier than that.

Once learning process is going on, current level should never go to negative - this happens when there is an battery-hungry application is running especially in percentages 80+. Because of this, we recommend you to leave your phone to itself in airplane mode and don't even touch it! The calibration is successfully done only when current levels drops below 20mA (must be positive though) for the last two readings.

I actually did see that, in order to see the calibration working, you don't need to restart! Just wait a little bit, and the age value in the "General" tab of the application does actually change in about one minute. If it stays at 100% (assuming you wrote this before you started calibration) - bad news: you have to re-calibrate because your attempt failed.

Once you completed those steps, you can follow my posts about making it permanent. BUT NEVER, I say, NEVER go on to next step (permanent step) until you're sure your battery is calibrated. AND NEVER plug in your charger when your device off, until you made calibration permanent.

I hope this will be the final time I make this explanation :)
[Nexus One Android Development] skhell:
Thanks for the reply!

I am running CM7.1, so don't have the problem of Sense. Will calibrate it again, see how it goes :)
[Nexus One Android Development] Necroaly:
"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)"

I don't have this options (a. b.) in battery calibrator app v.1.3.0..... under learn prep it is only "set your age"; "set your full40"

the one aEvolts is not there. or b. ........ wheher I found, or what I do?
[Nexus One Android Development] skhell:
I had the same problem. You should go to Settings and activate the Advanced Options. Then scroll down in the LearnPrep tab and you should have the options to write those values.
[Nexus One Android Development] theGanymedes:
Go to Settings and enable "Advanced (something something)" On.
[Nexus One Android Development] Necroaly:
is have all on in setting, but under learnprep on bottom i see "send a value to setreg. this value is not cheched for safely, do so at your own risk". now i have 2 tabs: register:0x and value:

i dont have avoltage or other. i can only make one, a or b because i have one tab with register and value........

ok, i finish to calibrate (without a an b under 2.), reboot and now I see the battery age is 83%, it is ok?
[Nexus One Android Development] skhell:
The idea is to use those fields twice, one for each register:

Register:0x 66 Value: a4

Register:0x 65 Value: 06
[Nexus One Android Development] Necroaly:
I follow this thread I installed battery calibrator, I make everything, and my phone just shut down it self on 12%........ on batt age tell me is 100%....
[Nexus One Android Development] theGanymedes:
It means your calibration was unsuccessful; you must do it again.
[Nexus One Android Development] Necroaly:
i do it again and now is show 87%... is ok??
[Nexus One Android Development] theGanymedes:
seems like.. now you can follow the steps in previous page (one or two) in order to make this calibration permanent (i.e. works even when phone is charged shut down).
[Nexus One Android Development] island3r:
So, what happens if the phone shuts down and you cannot start learn mode?
[Nexus One Android Development] k3vink3vin:
make sure you have ACR Adjustment enabled under Settings and try a few times more ;)
[Nexus One Android Development] island3r:
It is enabled, and I already tried 3 times :o

Maybe raising the minimum empty voltage limit a bit?
[Nexus One Android Development] serverxeon:
my battery died before it reached 3201!

how should i calibrate eh?!
[Nexus One Android Development] Necroaly:
i don't understud how make the hex.... but i try it and here is my result:

the new age bat show :87%

1452*0.87=

1263

1263*0.94=

1188

1263*15/6.25=

3031

3031/16=189 (remaind=

7

) /16=

11

(reamind=

13

)

With calculator hex i recive: BD

Now, what value i have??? 0BD7 ???

pls help me...! ty.
[Nexus One Android Development] bookerok:
wtf, my desire all time power off when battery drops to >=3600mAh (last death was on 3480:confused:) but battery shows 0%

which register can to moved 3201mAh?
[Nexus One Android Development] niksha89:
if i read correctly, you dont need to calculate the hex, just set full40 to "fake" value. link to the post

also, you did your calculation wrong - you are supposed to divide by 0.94, not multiply, so correct values are:

1452*0.87 = 1263

1263/0.94 = 1343
[Nexus One Android Development] St4hli:
Hey guys, i combined a few sources to ONE BIG battery calibration TUTORIAL:

http://xdaforums.com/showpost.php?p=24599586&postcount=284

Maybe it helps someone! :)
[Nexus One Android Development] mitch_55:
I need your help.

I am on a sense ROM with a droidzone kernel.

I can't do the calibration. Indeed, when the batterie comes to 3201 mV, I get the flag, I plug in the phone. But, some seconds later, my phone shuts down : then the calibration can't be done.

What I do wrong?
[Nexus One Android Development] St4hli:
I can refer to this page 30 of that Thread, someone has got the same problem.

Furthermore you can check the information I have collected in my tutorial, maybe you find something that can help you (especially the part "didn't work?")

This might be useful for you:
[Nexus One Android Development] mitch_55:
Here what I have done : I changed ROM and tried with CM ROM. My phone didn't shut down.

But Now the values in battery calibrator are :

Batt Age : 84 %

Capacity : 1200 (when battery is charged at 100%)

Aged Capa : 1393

I have to do an other calibration but with which values?
[Nexus One Android Development] St4hli:
Hey, that seems to be right! Battery age just means that your battery is getting older and therefore it HAS to be 80 % or so, not 100%! Also, the capacity when charged should be less than 1450, because when the battery ages, the capacity is shrinking.

So the calibration seemed towork for you,your phone shlould now turn off at 0-1% But please read carefully the part 4 of my tutorial that i posted, because otherwise the calibration is NOT permanent!
[Nexus One Android Development] mitch_55:
ok.

For the 4th part and if I've understood : I have to indicate :

Batt Age : 94 %

Full40 : 1297 (1452 x 0.84 /0.94)

Am I right?

In fact, this calibration doesn't "repair" our batteries? This is just made to our phones shut down at 1%?

And for my case, the capacity of my battery is now, in reality, 1219 mV (1452 x 0.84), not 1452 mV ?
[Nexus One Android Development] St4hli:
Yes these are the right values for you. But I'd make 1298 for the full40 value (rounding up is better)

And yes, the calibration only makes your phone shut down at 0%, it's no wonder procedure that doubles your battery life (unfortunately) :P

Capacity is not given in mV, but in mAh. But you're right, the capacity is less with an older battery.
[Nexus One Android Development] mitch_55:
Oups ;)

And what will happen if I uninstall "Battery calibrator? Or if I change ROM?

Maybe this calibration changes register values.

And an other question ( :) ) : Why the calibration uses as the full42 1452, whereas the original capacity of my battery is 1400 mAh?
[Nexus One Android Development] St4hli:
Uninstalling the app should be no problem. What happens when you change rom, I cant tell you. Don't know if ALL these values are saved in the battery chip and not in the phone storage. Just try it out!

Why the full40 value, and not the actual aged capacity is used, I also don't know exactly. (The tutorial is not originally from me, I only collected and combined information about making the calibration permanent)
[Nexus One Android Development] RogerPodacter:
Yes all these values are stored in the chip inside the battery, so they should stay between roms. However sometimes changing roms resets the entire chip losing all your custom values.

And the full40 value is set to 1452 by HTC so that's they capacity they are claiming. But I think its less personally.
[Nexus One Android Development] mitch_55:
Yet, genuine batteries for Bravo/Desire (with the reference 35H00132) have a capacity of 1400 mAh (not 1452 mAh). Look, for example

Edit : For more informations about questions I asked, look here
[Nexus One Android Development] Looloup:
Battery Calibration with ICS ??

I am currently running Sandvolds ICS ROM v.0.5.4 with Tiamat kernal.

I saw the instructions on the following thread: http://xdaforums.com/showpost.php?p=24599586 ... and even though it does say for GB, I thought I would have a go.

On starting the app - all figures showed up - so I thought that I may be OK.

Battery running down nicely - got the standard warning at 14% - still no detection of learning mode ...saw battery drop to 13% ... still nothing - then my phone suddenly turned off.

Maybe different register settings GB vs ICS, meaning it won't auto detect learning mode.

After plugging phone in and rebooting - then battery now shows 0%.

Trying to run the Battery cal tool - will not detect learning mode, and can select it via the button - but it deselects after a few seconds.

Phone now quite unstable - will not recognise SIM card.

Will let it charge for a while and then boot it back up again.
[Nexus One Android Development] RogerPodacter:
This situation is pretty standard, its sometimes difficult to get the learn flag to pop up when it shuts down early. That's the whole point why you need to do a learn cycle at this point.

After reboot you will now be at zero, charge for only a few min then unplug and try again. Turn on acr adjust in the app settings.

Your instability and sim issue must be coincidental as it should have no effect on those. The registers are identical between gb and ics and since there are values showing in your app that means my driver edits were indeed ported to the ics kernel you're using.
[Nexus One Android Development] Looloup:
Thanks for your quick response, I feel reassured - I will try again over the weekend.

I think the instability might just be due to running at 1-2% - charging probably slow as I was trying to do so from USB/laptop
[Nexus One Android Development] terminator1983:
Can i use this battery calibrator app with Motorola Atrix to change the total mah of the battery.The problem is that the phone is recognizing the battery only 500 mah which in actual is 1880 mah that's why my phone stays on 1% most of time.

If yes what values should i enter in the setreg values
[Nexus One Android Development] uoY_redruM:
Once you achieve learn mode and it pops up and tells you to plug it in, you plug it in (airplane mode activated) and just let it charge about an hour past green light right?
[Nexus One Android Development] RogerPodacter:
No won't work with the atrix.

---------- Post added at 11:06 AM ---------- Previous post was at 11:05 AM ----------

You got it, that's basically it.
[Nexus One Android Development] uoY_redruM:
After charging you just unplug and go right? Nothing else needed?
[Nexus One Android Development] RogerPodacter:
Yes that's it. You do however want to check your age value afterwards to ensure the learn cycle was successful. Then remember that age value just for future reference. It shouldn't show 94% or 100%. If either of those show then it didn't work.
[Nexus One Android Development] Sillik:
About the charging phase, is it OK to leave it plugged more than the required 3-4H?

For example, if I do this at night and leave it plugged until the next morning, it will stay plugged for 8H for example.

Will it have any impact?

Thank you.
[Nexus One Android Development] Looloup:
I have tried this again a couple of times .... I still do not get to achieve 'Learn Mode' as the phone dies just before that ....

I tried changing reg 10 as suggested....

Phone however is dying showing about 3300mV (did get down to 3244mV once).... so around 2%... so not too bad ... I am probably not going to gain a lot from trying to calibrate any more ... am I ?
[Nexus One Android Development] 1991stonecold:
I have the exact same problem.

Shall the battery be fully charged before starting calibration?
[Nexus One Android Development] theGanymedes:
It's OK - you can do that.

---------- Post added at 09:29 PM ---------- Previous post was at 09:29 PM ----------

No, there is no such requirement.

---------- Post added at 09:31 PM ---------- Previous post was at 09:29 PM ----------

You're going to get that 2% - nothing more, most likely..

If you couldn't get it below 3300 mV anyhow; just try assigning 3300 mV to Vmin value ( with registers 62 and 63 ) - you have to read the spec. sheet though, cos process requires some transformations.
[Nexus One Android Development] JeepFreak:
I've been dealing with this battery problem for months now and just finally found this app/thread (when you search the market for "battery calibration", the app doesn't come up in the first ~15 listings, but comes right up at the top of the list when you search for "battery calibrator"... maybe add in "calibration" as a keyword?).

Anyway, I finally have this issue resolved and I just wanted to say, "THANK YOU! THANK YOU! THANK YOU!"

Have a great day!

Billy
[Nexus One Android Development] RogerPodacter:
No prob this us the fun of xda. Enjoy:).
[Nexus One Android Development] j3di:
Great work to all those involved. I'm currently charging after setting the learn flag on my first go with your app.

I was glued to my N1 for the last 20min until the batt dropped enough for the learn flag to set:- Is there anyway you could force the screen to stay on when you select "Detect learn Mode"? Also an audible alarm to accompany the message to commence charging would also help?

Thanks again

edit: Looks like I need to try again, got upto 75% charge but the Learn Flag is no longer set!
[Nexus One Android Development] dvgrhl:
This is just being beta (alpha really) tested out right now, but when Roger gets back from the holiday break I think we'll work on a proper write up for how to use the app.

Those are great ideas and are things Roger and I would like to include. I'll work on adding that for the next version.

As for losing the learn flag, I think if you use the phone at all while it is charging it can cause it to lose the learn flag. Roger or noname could better answer about that, but I think it's something they're aware of and Roger might have a few ideas on how we can get around that if I recall correctly.