yashsingh1/xdaforums huggingface dataset:
[Nexus One Android Development] schizophrenia:
3rd attempt.... failed

so i did make sure it was more than -200 when it hit Learn mode

I plugged in power

i tried closing all apps except they respawned and except i did not close battery calibrator, went to airplane mode and waited for 5 hours +

i woke it up, unplugged, rebooted

this time I waited long at the Nexus One logo and did not take out the battery and after say 5 min or so it finally rebooted successfully (CM7) and ....

Battery age 100% .. damn. and after 1 min or so, the battery went to 97% already.

So i will try your other suggestion, setting Age to 83% (at LearnPrep) tonight.

should I keep every step the same except I set the Age to 83%?

Thanks
[Nexus One Android Development] dvgrhl:
Yeah, admittedly it's a pain still - though thanks to the work that theloginwithnoname and RogerPodacter did with the battery driver, we at least have a method to calibrate at all. Prior to that we had to just live with the battery issues as they were. I'd really like for the app to be much more automated and user friendly, but the truth is I just don't have the time to make it happen as quickly as I'd like. I really only have the time to work on this on my bus ride to and from work during the week. And honestly, I've never even calibrated my own battery. I tried out hitting learn mode during testing several times to make sure that things were working, and the one time I went all the way I rebooted my phone before noting the true age of my battery. :/ I mostly just do this because it is fun for me and I wanted a way to give back to XDA since I've gotten so much from here.

Roger, theloginwithnoname, temasek, mtw4991, and chowlala all have a lot better understanding of the calibration process than me. I just try to write code to work with what they say is needed. :) Also, this is the first time I've ever written anything for Android so it's been a big learning process for me.

And I know you weren't complaining or anything, I'm just sure you're not the only one who has thought it was quite an ordeal to calibrate so I just wanted to give some info as to why things are that way. Everyone has been really awesome in how they've appreciated the app, and I really do want feedback on user experience for the app - whether you think it's great or have ideas for improvements, or even have it crashing on you. It all helps figure out what should be done to make the app better...eventually. :)
[Nexus One Android Development] Smokeaire:
When flashing new CM Nightlys, are the hex values kept or does it have to be inputed again? Sometimes I have to input my battery age.
[Nexus One Android Development] temasek:
Your battery age may be resetted due to various reasons. When it does, just input back your battery age will do. In most cases it will remember your battery age so you do not need to do anything.
[Nexus One Android Development] Smokeaire:
What about the hex values? Are those retained when flashing new roms? I might want to do a new learning procedure.
[Nexus One Android Development] temasek:
What hex values u referring? All battery registers are in hex values.
[Nexus One Android Development] Smokeaire:
These, on page three:

2. Navigate to sys>devices>platform>ds2784-battery>setreg>long press>open in text editor, then: a. set your aEvolts to 3201 (type 0x66 a4 in setreg & save/exit) b. set your stop charging current to <20mA (type 0x65 06 in setreg & save/exit) c. if mAh drops to near empty, prior to 3201mV being reached, the ACR will raise capacity by 200mAh so phone doesn't auto-shutdown prior to reaching 3201mV
[Nexus One Android Development] temasek:
No need to if u already set it once. These registers will not be forgotten. Only register may be forgotten is the battery age.
[Nexus One Android Development] Smokeaire:
Thanks. :)
[Nexus One Android Development] schizophrenia:
So after I set the Age to 83%, do I do the whole learning cycle like described?

Thanks

Edit: looks like after i set to 83%, the phone shuted itself off even before it hit 3201.... hmm.. please advise what I should do?
[Nexus One Android Development] Smokeaire:
I'm shooting in the dark here but I think you're supposed to turn the phone off and back on after learning...not reboot....at least that is what is in the instructions on page three of this thread.
[Nexus One Android Development] schizophrenia:
thanks for replying

coz by choosing rebooting, i observed the phone actually turned itself off and on again.

but since you brought that up, i will try one last time using 100% and turning on/off..

hope it works. it really took me a lot of time and then frustration..
[Nexus One Android Development] temasek:
After a learn cycle, some can just perform a reboot but others require power off/on to register the updated battery age.
[Nexus One Android Development] schizophrenia:
update:

after another try. full charge... turn off and on

stuck at the Nexus logo for 6 to 7 min at least, then the phone vibrated a bit and then a short while it entered into the CM7 loading scene.

after the phone is complete on and I looked into Battery Calibrator, the batt age is 85%... does that mean I have got it right this time?

Hope so... thanks
[Nexus One Android Development] dvgrhl:
Is your battery a year old or so? That seems like what you should expect. So it looks like it worked. Of course, real way to tell is charge to 100% and then let the battery drain down to 0% and see if you can go all the way down without the phone shutting itself off before it hits 0%.
[Nexus One Android Development] RogerPodacter:
Yeah sounds like you did a successful learn cycle. You did not manually set age to 85% right? If not then yes your true age is 85%. Pretty close to what we guessed.

If you guys have any suggestions for making the app more automated let us know any good ideas.

I know dvgrhl is working on other things and doesn't have tons of time for the app. But I can still work on it and push code to his repo regularly. It just takes me longer to do things and I'm not good with code. But if something comes up I can work on it if need be.
[Nexus One Android Development] tomsan84:
I copied this from cyanogenmod forum;

omg i read all this and it makes me feel like a retard. I cannot comprehend the 'battery calibrator' app

learn prep i put in values: 100 at age then save; under full40 i put in 1452 and save. the values disappear when i press save.

Then i go to learn mode. there is nothing on real time voltage nor on cur mA and capa mAh

all 'battery status register' buttons are on, I have no idea what they stand for.

under messages it says (and it always says the same, plugged in or not):

-to recalibrate your battery, turn on learn detect below and then drain your battery.

-CHGTF is set, battery is fully charged.

under this message is the 'detect learn mode' button.

first of all my battery is not fully charged, so why does it say so? is that already a bug or what?

then I press learn detect, within 2 sec a pop up message appears with the text: "PLUG IN NOW!! The learn flag is on!"

WTF it just said I had to drain the battery after i turned on learn detect... well what is it? do I have to plug in or drain? I cannot do both.

when I press oke a new message appears saying something in the line of; learn cycle in progress..complete when charged to full... then CHGTF is set... battery will be updated with new learned value.

under that sentence it says: CHGTF is set, battery is fully charged (which it isnt)

the message stays there for like 10 second, and no values are shown in the learn mode tab or the general tab, no values anywhere. the message resets after the 10 seconds to the first message.

nothing happens

what am I supposed to do? is my app buggy?

plz help

thx

edit; I am on 6.1.1
[Nexus One Android Development] RogerPodacter:
Ok this is very strange. The app is not buggy, but it seems like the battery values are not being read correctly, or at all. On the first tab, does it show actual numbers for all your parameters? Is this a stock battery or after market battery? It sounds like some after market one. I'm very interested in what's going on here with this one. I have no idea why the app could behave like that.
[Nexus One Android Development] schizophrenia:
yeah, almost exactly a year old. And yes, it is down to 6% now and I am already very happy about it so I supposed it is working. Thanks a lot.

Nope, i did not manually set it to 85%. I tried but the phone turned off itself before it asked me to start charging.

I heard the next feature is adding in the alert for "fully charged", which is very good so people dont have to guess when to unplug the charger.

Other than that, if a noob like me can do it, so can everyone else.

thanks a lot.

EDIT:

After I drained it down to 0% and restarted the phone, the battery age showed 94% again. Is it normal? Or something went wrong again?
[Nexus One Android Development] tomsan84:
it is a stock battery, an no values are given on the general tab, never.

i tried reinstalling, it doesnt help.

edit; maybe handy to say, that I DID not changed my setreg file. I cannot find that file using astro when navigating to sys>devices>platform>ds2784-battery>

but that should not be the reason that the whole app doesnt work right?

why can i not find the setreg file?
[Nexus One Android Development] temasek:
Remember this.

When your phone auto shutdown, upon next bootup your battery age will reset to 94%. You need to input back your actual battery age again. No need to redo learn cycle.

When you manually shutdown aka power off, upon next bootup your battery age will remain unchanged.

That's the difference. :)
[Nexus One Android Development] schizophrenia:
oh ok, thats something I was not aware of.

So.. I just charged my phone to full before manually setting the 85% real age, does that maen I have to do the whole learn cycle again? Or say you set I haev to input back the actual battery age, when should I do it? during the early charging process? Late stage? after charged and unplugged? Or it does not matter at all?

Sorry for all the questions. I just wanna get a more specific answer.
[Nexus One Android Development] temasek:
No need to redo learn cycle. Just set back your battery age and u are good. - irregardless of when u do it.

But remember once u set back your age. Upon next full charge u are then able to drain till 0%.
[Nexus One Android Development] McFroger3:
Ok since I don't feel like searching through tons of pages I'm just going to ask.

What exactly is "Battery Age?"

What does it mean?

Is a higher or lower value better?
[Nexus One Android Development] temasek:
Battery age can be considered as the condition of your battery.

100 = best condition (brand new)

80 = time for a replacement battery
[Nexus One Android Development] McFroger3:
Thank you, mines at 94%, so looks like its doing pretty good for being a year old.
[Nexus One Android Development] temasek:
Depends.

When 94% in most cases it meant

1. Your battery age was resetted due to various reasons. One of it is auto shutdown.

2. U performed a learn cycle and failed resulting to an age of 94%
[Nexus One Android Development] RogerPodacter:
all stock batteries show 94% as age. unless you have done the learn cycle, that value is just default and incorrect.
[Nexus One Android Development] RogerPodacter:
OK then my guess is the ROM you are using does not support the battery driver needed for the app to function correctly. the working ROM's are cyanogen, pershoot's kernel, etc. if you do not see the setreg file in the ds2784 battery folder, then the necessary edits are not present in your ROM.

very interesting how the app reacted to not reading the values though! how the heck would it act so crazy is interesting...
[Nexus One Android Development] tomsan84:
i am using cyanogen 6.1.1
[Nexus One Android Development] mtw4991:
I'm not sure, but I believe you need Root Explorer from the market. I don't think Astro(or the built in File Manager) will work for what we do with the registers.
[Nexus One Android Development] theloginwithnoname:
it will in new/upcoming version of driver, mtw ;)

sent via XDA app
[Nexus One Android Development] mtw4991:
Nice! save peoples the effort and $ of getting RE.
[Nexus One Android Development] rmc112:
ive done a ton of reading in this thread, but havent really found an answer to this:

I turned on ACR and my phone was still dying at around 3600mV. So i used terminal to echo the setreg file and gave it a few hundred more mAh. Eventually it got to 3201mV and the flag turned on and i plugged in the charger. when I plugged in the charger it still was at around 100 mAh and around 4%.

In past attempts I tried to just add 100 or 200 mAh when it was close to 3.6V before it died, so that it would hopefully be pretty close to 0mAh when it reached 3.201V. However, it would still die at around 3.4V, with 200 or so mAh that i gave it with terminal editor.

So, is it bad that it started charging/learning at 100mAh? I assume itll still stop at 2500mAh max, but when it drains again will it want to use up that extra 100mAh making it drop below 3.2V?
[Nexus One Android Development] mtw4991:
The extra 100mAh or so will get "absorbed" in the charge and not affect anything anymore. It is just a way to keep the phone from dying prior to reaching 3201mV(true empty).

It's not bad at all as long as you are doing a full learn cycle and when you reboot, your battery should be set with the new age, i.e. 87% or 97%, etc. If the battery age gets reset to 94% upon reboot or 100% unless the battery is brand new, then learn mode failed and you'll need to try again.

The goal is to get it to die at 0% with mV as close to 3201mV as possible. If you run out of mAh consistently while your mV is around 3600mV, then your age is probably set too low. Try manually raising age 1% until you reach close to

0%/3201mV.
[Nexus One Android Development] rmc112:
thanks for the fast response. you are awesome.

Good deal, hopefully this time the learn cycle will work!
[Nexus One Android Development] temasek:
Remember set age 100 b4 a learn cycle though.
[Nexus One Android Development] rmc112:
yep, sure did.
[Nexus One Android Development] temasek:
Last 2 sentenses not applicable.
[Nexus One Android Development] mtw4991:
Probably should have clarified more....when I first got my new 1600mAh battery, i got several different age values with the first few learn cycles, like 98%/96%/95%/97%. I found that if my mAh ran out while still have mV left, the age was limiting the charge capacity and increasing the age slightly brought them(mAh & aEv) back in line closer until learn was more consistent. Sorry if I was unclear.
[Nexus One Android Development] RogerPodacter:
then i have no clue what the problem is. the app is not working, you should be seeing numbers on the first tab. all i can think is you have upgraded from version to version of cyanogen, rather than flashing a clean install, and somehow the original ds2784 driver still exists on your phone, rather than the new one that is required for the app to work. i'm not sure that's even how upgrades work though...
[Nexus One Android Development] temasek:
I would perform it differently.

New batteries should have their batteries at age 100 even after a learn cycle. To achieve that we adjust the full40 by finding the max capacity thru a capacity test.

Why I say so?

Battery age is an indicator for the general condition of a battery. So if it starts from 100 and auto drop in age from 100, it will be a more realistic shelf life of a battery. When battery age says 80 then I will know time to buy new one.

Your approach is fine though. Just that I would do it differently. :)
[Nexus One Android Development] mtw4991:
I understand and agree completely, especially for people that just got a new battery. However, my new 1600mAh battery from HK was never able to achieve 100% and after 2 months it is spot on 96%. 1600x96%=1536, the most I can squeeze into it now. I could set full40 to 1540mAh and age 100 then the age factor would be more appropriate and after 2 1/2 months (at 1.7%/month aging factor) it would be 96%, but 96/1600 is the same to me. Also, I

JUST NOW (like 2 mins ago)

let it almost die and got it down to 3232mV at 12mAh, so I'd say it's calibrated nicely:D fyi, mine shuts down at 9mAh like clockwork, lol, never below.
[Nexus One Android Development] tomsan84:
Ok thx anyway
[Nexus One Android Development] mtw4991:
Tomsan84, try flashing pershoot's or wildmonk's latest kernel and see if that fixes your problem. It's the kernel, not the rom per se, that has the driver mods in it. CM7 nightly does as does WM, Pershoots and IR's I believe. maybe you just need to flash a new kernel. Also, I would get Root Explorer from the Market...best there is for $2
[Nexus One Android Development] dvgrhl:
Are you using the stock Cyanogen kernel, or another kernel? Is this a stock CM6.1.1 or a modded version?

The app is written on purpose to just not display any values if those files aren't there. This way I can run the app in the emulator for testing things before I ready to test them live on my phone.
[Nexus One Android Development] mempf:
I'm not sure if this has been brought up before but is there another way to tell a successful learn cycle if the actual age of the battery is 94%.

How would you determine if at some point it auto reset to 94% as opposed to being the learned 94% (I assume the reset to 94% will not decrease as the battery ages).

Success as currently defined means after a restart the battery age shows 100% (if new) or != 94%. How do you know if the age is 94%?

Thanks
[Nexus One Android Development] temasek:
There is always a possibility that your real battery age is 94%. Stock battery start age is 94%, After-market batteries start age

should

be at 100%.

So ask yourself if your battery is stock or aftermarket battery?

Now back to age 94%, I quote my own reply to user as follows:-

When 94% in most cases it meant

1. Your battery age was resetted due to various reasons. One of it is auto shutdown.

2. U performed a learn cycle and failed resulting to an age of 94%

3. You are having a stock battery and its brand new, so start age is 94%.
[Nexus One Android Development] mempf:
Interesting.... I got a new "stock" battery online, seems 100% legit. It currently reports an age of 96% after a learn cycle. The battery my nexus one came with is at 85%. Is the age of 96% on my new battery evidence that it is, in fact not a stock HTC battery?

This battery calibration stuff fascinates me. Do these learn modes exist in other phone batteries (ex. Galaxy S/Nexus S)? I am aware of course its all going to depend on the battery, but do other phones have these inconsistent power off issues like the N1 without calibration?
[Nexus One Android Development] temasek:
When we say stock battery, means the battery that comes with your phone when u purchase it. The one u bought off stores is not exactly the same, though I may be wrong. So your new battery may have a battery age > 94%.

The battery that comes with nexus one, both Roger & myself suspect is actually a cheap battery that doesn't even compare with those batteries that are sold off HTC stores or many other aftermarket batteries.

Many thanks to Roger & thelonginwithnoname, they came up with battery drivers that enable us, nexus one users to perform battery calibration.

Without Battery Calibration

- May auto shutdown anytime from 10% to over 20% battery level depending on battery condition.

- At 15% dialog box telling user to plug-in

With Battery Calibration

- At 15% dialog box telling user to plug-in

- At 10% red LED blinking warning users that battery is low. The blinking will continue till drained @ 0%

- Not necessary user will drain till 0% but users are assured that the battery can last till 0%. In fact no one will actually always uses their battery till 0%.

- The battery age after a proper learn cycle WILL auto drop its age and you will always be able to use battery till 0%.

Idk about other phone makes but it is actually rather interesting when I started doing it. And most important is, since there is such a feature, why not use it? :)
[Nexus One Android Development] dvgrhl:
Congrats guys, all your perseverance paid off it looks like. Does this mean you have successfully calibrated the battery manually?
[Nexus One Android Development] RogerPodacter:
now i got a fully working "setreg" file going, so its super easy to set any register. i'm still tweaking, but for now you echo the reg and value with a space between them, like so.

echo 0x14 80 > setreg - this would set address 0x14 (age scal) with a value of 0x80 or 128 or max.

to answer, i havent actually done the manual calibration yet since i'm still playing around. for now i have my age set to 100%. but i think my battery jumped at 1180 mAh, so i'd have to figure out what age that is and set accordingly. i'll do it soon i think.

still wanna figure out the "official" learn mode stuff, but i guess its not totally necessary if we do it manually.
[Nexus One Android Development] theloginwithnoname:
Just a quick update on this. Using and extending what RP did with setreg, I've added in Vae and statusreg so we can get and set those two values. Unfortunately, the value I set for statusreg only persists until next battery poll, so is fairly useless at the moment*.

I have created a "monitor" script similar to how they did in the Pre world (the idea is to see when the statusreg value changed to one of 17, 37, 57, or 77 and alert so you can plug in a charger).

I used Vae to set a lower value (3350, down from 3416) in the hope my shutdown would be delayed and therefore I could see via the monitor script when LEARN was set. Unfortunately, it ran out of battery capacity and shutdown anyway! mV values were around 3600 when it shutdown.

So I put a little charge (25mAh) in and set my Vae again (to 3650). With enough charge and two mV readings below the Vae, the battery went into learn mode! I slammed the charger in and set my battery age to 100% again (it seems to reset on boot/empty).

It's currently sitting there doing an on-charge, and hopefully when the battery tells the device it's finished charging/learning, I should know my true capacity and age.

Update you when I have more. Cross all your digits, ladies and gentlemen...

RP - email me when you have a bit of time to discuss via gtalk.

* though it may be useful if we were to shutdown before battery poll and do an off-charge straight away... to be tested.
[Nexus One Android Development] chowlala:
Awesome. Sounds like you've got a working prototype!! I've been testing some alternate methods to calibrating the battery. At one point, managed to even buff up at 1409 mAh. Weird, but the problem still stands with the phone dying off prematurely at 10~%.
[Nexus One Android Development] theloginwithnoname:
FULL40 = 1459. Thinking we need another "full capacity" value; will dig some more.
[Nexus One Android Development] theloginwithnoname:
update: did a full on-charge from around 6% and it went back to the calibrated value of 1185. it then tripped up on a TIMEOUT (odd), restarted itself and then finished at the same value.

Ran it right down to off (went down to 1% as it should). Off-charged overnight, turned it on this morning and it got to 1363 and the age has been reset to 121 (94.8%) - WTF!

??
[Nexus One Android Development] xghostyxjokerx:
um is this going to be an app of some sort or?? because my nexus one battery life sucks....:mad::confused:
[Nexus One Android Development] theloginwithnoname:
that was the idea when we started the thread. The problem we're having at the moment is we can't make the calibration stick!
[Nexus One Android Development] xghostyxjokerx:
o i see ..... okay well please keep us all posted...thanks!!!
[Nexus One Android Development] instigator008:
Don't want to hijack this thread, but is this why my extended battery (2400) lasts the same amount of time as my stock battery? No matter what I do I can't seem to get it to last longer. This is a replacement as I thought the original was defective.