yashsingh1/xdaforums huggingface dataset:
[Nexus One Android Development] zdiamant:
OK.. Success. Looks like I get 3275mAh out of my 3200mAh battery. (~2.3% increase).

Biggest point of interest is that it seems that all of these batteries (tested 3 so far) come to the consumer out of calibration. Just charging them as directed by the instructions will not give you the correct calibration. (maybe that's why they say performance will improve after 5-6 charges) I firmly believe that this battery will "perform" after this one charge!!!

Thank you to Roger and crew for all your hard work and effort put into this wonderful app!

For some reason, the screen shot of the dmesg did not capture the point of "learning", and now it is erased, but you can see the result from the app.
[Nexus One Android Development] RogerPodacter:
awesome stuff man. nice work. the only thing i would say about the "recommended" advice is that no parameters get changed just using the battery, so what will actually do the calibration knowing what we know now.

yeah dmesg log sometimes wipes early data before you can get to it. glad you like the app, we are hopeing to make it even better.
[Nexus One Android Development] RogerPodacter:
Also I was experimenting with getting down as low as possible to voltage of 3.429 to see the stat reg change. But I think to do that we will need an update of 10 seconds of actually polling the battery. It's just too sensitive, otherwise we just miss it. Though we might be passed that point anyway if we're now able to do a learn cycle at will.
[Nexus One Android Development] RogerPodacter:
We can even do more than that. The data sheet tells us the aging algorithm reduces "2.4% per 100 full discharge cycles, and also to 88% after 500 cycles". Well I've had my phone since march, and I at least charge twice a day. But for sake of conservative argument let's say one charge per day. That's 6 months or 180 days, so 180 charges. So yeah its possible we haven't hit the count down point yet of 95%. Although my understanding was age was supposed to count down immediately from whatever number its initially set to. So either road we take it still seems like something doesn't add up.
[Nexus One Android Development] theloginwithnoname:
Excellent work RP. I'll start back-filling the spreadsheet.

Unfortunately it doesn't work quite like that. It seems ARM/cross-compilation can only deal with "simple" types, as it spits an optimiser error if I try and use floats!

I am guessing this is expected behaviour and is why HTC and AOSP store values as integers, then use division by 100, 1000 to shift the decimal place when they are output to the log. Weird but I can deal with it.

That's the idea, old boy! :D We can then execute, sleep for 0.5/1 sec, execute, sleep, etc...
[Nexus One Android Development] theloginwithnoname:
Maybe not then. 2.4% per *100* *full discharge* cycles. I doubt whether, in the 240-odd days of owning my N1, I've fully discharged 100 times.

Me too, but I'd read that 2.4% per 100 as "per 100 charges" not "full discharges" - perhaps it *is* right?
[Nexus One Android Development] theloginwithnoname:
as we discussed on gtalk, the zImage I distributed has a 9 second poll on it - taking it to 4 or 5 may have bad consequences for the device but say the word if you want one compiling for you to test!
[Nexus One Android Development] RogerPodacter:
well it actually counts the aging on the discharge rather than the charge up, which is somewhat trivial. the very next sentence does say:

i just know for me i use the hell out of my phone and mostly charge probably 3 times a day, typically from 50% back up again.

anyway we DO see palm guys when they get a brand new battery it reads 100%. we'll find out soon enough hopefully when we get registers going.
[Nexus One Android Development] RogerPodacter:
you're right, i thought it was stuck at 20 second polling for some reason cause i thought i saw double readings of voltage each time. but actually its truly updating. i think our only solution is to raise VAE by just one increment (19.5mV) and see if that helps.
[Nexus One Android Development] RogerPodacter:
yeah i have no clue about that stuff, i was just half guessing lol. i'll take your word for it!

what do you mean "execute, sleep for 0.5/1 sec" etc. am i being thick again?

btw the extra AE13 we added to the last zimage, i actually gave you the wrong bit shift number! we'll probably just ignore that anyway but i just wanted to let you know...
[Nexus One Android Development] RogerPodacter:
wow i just finally opened up the HTC version of the battery driver and its gonna take me a bit to digest what their doing. i should have done this a week ago, my bad!

edit: actually this driver looks like it would have been much better to use than google's nexus one driver (not for this calibration app, but for the nexus one phone in general). EDIT: actually i take that back, it seems like HTC does so many things the hard way. or maybe its just google's driver is much more up to date.

now i see the u8 stuff and at least somewhat see what's going on. feel totally out of the damn loop!

EDIT 2: interesting, i think the conversion table i'm adding earlier might be a good idea. if i take the HTC code and calculate for example full_40 with HTC's numbers, because of rounding, i get 1459 mAh. however the raw output calculated with the exact equation yields 1452 mAh (which is the true correct number). minor issue, but seems like a big enough discrepancy to make a difference.
[Nexus One Android Development] RogerPodacter:
so i looked at the palm pre driver, and it turns out its somewhat straightforward with how they get their "getage" and "getfull40" files. their driver spits those files out as device attribute (DEVICE_ATTR) files. so it should be possible to do the same. the psuedo code could be:

static ssize_t show_age_scalar(struct device *dev, struct device_attribute *attr, char *buf)
{
int ret
int age_scalar;

age_scalar=raw[DS2784_REG_AGE_SCALAR];

ret = sprintf(buf, "%d\n", age_scalar);

return ret;

}

static DEVICE_ATTR(getage, S_IRUGO, show_age_scalar, NULL);

int device_create_file(&device->dev, &dev_attr_getage);

and then later maybe something like (work in progress):

static ssize_t show_set_register(struct device *dev, struct device_attribute *attr, char *buf)
{
w1_write_8(sl->master, W1_DS2784_READ_DATA);
w1_write_8(sl->master, addr);
}

static ssize_t store_set_register(......)
{
w1_write_8(sl->master, W1_DS2784_WRITE_DATA);
w1_write_8(sl->master, addr);
w1_write_block(sl->master, buf, count);
}

static DEVICE_ATTR(setreg, , show_set_register,
store_set_register);

when you read or write to those files, it calls the function from the driver. we have the same thing for example in our i2c driver. if i go to terminal and type

echo 1 > /sys/devices/i2c-0/0-0066/leds/blue blink

it turns on my blue battery light and makes it blink. echo 0 and turns it off. you just read or write the value of the "blink" file. its the same exact thing that the palm driver is doing if you look at their code, including "dumpreg" and "setreg".

it seems like most everyone has lost enthusiasm/given up on this thread heh. i'm close to that point as well, but may give it one last shot. maybe an expert with DEVICE_ATTR will pop up...
[Nexus One Android Development] mtw4991:
No, we haven't given up on you guys...you're just much more advanced than most of us are. I keep up as I think it's fascinating what you're doing. FYI, I still haven't been able to hit a learning point I don't think. What I have been doing is let it die, then reboot into recovery and wipe batt stats, then wall charge til full which is usually around 1384mAh/416xmV then bump charge to around 4197mV and 1458mAh. It seems 1458mAh is the max I can get into it, which correlates previous readings.
[Nexus One Android Development] chowlala:
Someone go drag pershoot back into this. Haha.

I'm not a coder. Don't know enough bout numbers and all that. We might wanna drop by the irc chan on cm to drop off our thoughts and stuff. Would be a good place to hit up some ideas and get some help though.

Other than that, I've been calibrated for a while, just still thinking of ways to make the battery better.
[Nexus One Android Development] RogerPodacter:
I give up on Learn Mode

learn mode finally defeated me over the weekend. i literally got it 8 times in a row, each time boot up showed it activated then lost it. that first time way back in the beginning was the only time i've ever had it stick, and i just cant re-create it.

i got to the point where i kept repeating one after another where i charged for 1 min, boot up, hover at 3.45 volts and slowly watch it drop to 3.429 volts, then shut off shortly after. but the status bit never changed until after the shut down/boot up. hell i even got to the point where (using the 10 second zimage) once i saw 3.429 volts i counted in my head to 7 seconds and actually plug in at the EXACT instant the shut down message appeared. i nailed it exactly multiple times. yet still the status bit never changed.

and after 8 times in row of booting up seeing learn mode had activated, the very last attempt i left the phone charge off for the next 3 hours cause there's no doubt learn activated on shut down. yet the off charge still did not work, same numbers and same full point. i've tried the off charge learn mode attempt about 4 times now.

so i'm officially giving up. i'm gonna switch directions and make one last attempt at maybe getting a working "setreg" equivalent file like the pre. the things i want to try:

1. raise empty voltage slightly to give a few extra seconds to see status change and/or hit learn mode.

2. lower terminating current from 80mA to 20 or 10mA. this gives us a bump charge but with the phone turned on and would make the "battery full" point to correctly include the full capacity of our battery, rather than missing that top portion as we do now.

3. raise the terminating voltage to 4.19 volts, which is what we see when doing a bump charge. this again could give us a bump charge with the phone on.

4. and finally, experiment setting age scalar to 100%, and then other values such as 98% which would then get rid of the jump to 1360mAh and instead it would read the full 1452mAh at full charge. this will now make the percentage meter adjust itself and include all that top extra capacity into the 0-100% meter. of course this isnt actually giving more usable capacity, but i'd like to experiment and see. eventually i'd use learn mode to set age scalar to the proper percentage for what my battery can hold. age scalar updated would also now include the extra capacity we get from lowering the <80mA and incorporate that extra capa into the percentage meter.

so that's about it. i'm pretty much defeated. setreg is the last thing i'm trying and then throwing in the towel. besides my new battery works much better so far. if numbers 1-4 above are successful on my old battery, i'd love to do the same for my new battery which would really get the maximum amount out of it:D.
[Nexus One Android Development] theloginwithnoname:
This is pretty much what I've wanted to do all along (hence this thread ;)), as being able to set the age and capacity we should be able to "artificially", or rather manually, calibrate our batteries.

The problem I have is, although I can kang the source code into a new module, I have no idea how to compile against already-compiled .o files (such as ds2784) so I can call the functions in the .o file, or compile using the header files ds2784 uses etc etc.

So any dev'rs able to create a shell to call the read function in ds2784 and compile it, please write instructions here so we can crack on! :D
[Nexus One Android Development] theloginwithnoname:
One thing I haven't tried, and I don't think you have either RP, is doing what they do with setreg file - we seem to have forgotten about this :o

Doubt it will work but worth a shot?
[Nexus One Android Development] RogerPodacter:
That's my next plan, but we don't yet have a working setreg file. I put together a test file with age scalar to compile so if that works we could just do the same thing for setreg file and have it working. But A) it needs to be compiled to see if it works, B) its very crude anyway and I suck at code so no guarantee it'll even work in first place, and C) even if it does work, the next try with setreg will be significantly more difficult/more testing etc.

So its almost not worth it. Even if it works, I think our driver is different than the pre with the way it polls the battery in intervals, so not sure if that makes a difference or not with these special files like setreg.
[Nexus One Android Development] theloginwithnoname:
I was specifically referring to this part of the post:

cd /sys/devices/w1*/32-*
echo 0x146d > setreg

?
[Nexus One Android Development] RogerPodacter:
oh yes i've tried that hehe. let me give it another shot right now. you mean for us to attempt the same commands in our terminal and see if it works? yes i've tried, gonna try again maybe in some different folders, i.e. pltform vs bus etc. but it really wont work if you see the palm code...

unfortunately that doesnt work. i happened to locate our i2c driver specifically for the battery light example i gave before. and sure enough all those files can be interacted with, like blink file, via device attr files exactly like the pre. just mimmick that honestly.
[Nexus One Android Development] RogerPodacter:
i dont follow what exactly you're asking here. i'm not sure which .o file you're referring to, or about the headers. you should take a look at the palm pre driver code to see how they call the ds2784 read/write functions. but your current kernel's you've compiled work well, and with that setup you could simply add a device_attr file named setreg to the code and have working "setreg" capability (its a little more than that, but general idea).

what the pre has is a single device attr file named "setreg". and just like the "blink" example i posted, all they do is read or write that file which calls the ds2784 write function. its actually pretty straightforward.

or is there another method you had in mind to call the write function?
[Nexus One Android Development] theloginwithnoname:
Apologies for the lack of response on this thread - real life seemed to take over for a while

From the above, are you saying we can modify registry values by using similar logic with different registers? I could only find a few useable sub-folders under i2c-0, none of which correspond to ds2784? the leds folder seems to be the only one with useable bits in it!
[Nexus One Android Development] fcisco13:
Question for the experts .... if i did my calibration and all went good, then i flash another rom with a kernel that does not have the calibration implementation does the battery still have the settings stored in it, or does it all get erased ??

N1
[Nexus One Android Development] temasek:
Your battery registers are stored in the battery itself so when you flash another rom with an unsupported kernel, you simply cannot use the Battery Calibrator app to perform any of its functions.

Simple term - Your battery settings are stored and will not get erased when u switch rom with an unsupported kernel.
[Nexus One Android Development] fcisco13:
Thanx for the quick reply

N1
[Nexus One Android Development] chowlala:
Haha. Guess no one has answers to my battery eh?

Well, gonna return it tomorrow to the seller. Trading in for another piece. Let's see what happens then. =)
[Nexus One Android Development] overground:
Don't know if this is relevant in our phones, but it seems so in theory: http://xdaforums.com/showthread.php?t=906144
[Nexus One Android Development] RogerPodacter:
i saw your post and honestly i dont think anything was too far out of the ordinary from what we've seen before.

have you done additional tests to see if the same results happen or if it corrected itself?
[Nexus One Android Development] ExtraDas:
I just got my eBay 1600 replacement battery ($15ish with a wall charger).

I haven't done anything yet, just popped it in and here's a screenshot of the values.

That is completely out of whack of course. Anything tips of shall I just proeceed as I normally would eg. drain and learn?

*EDIT*

I've set my aEvolts to 3201, stop charging current to 20mA with no issues.

Age is 100% (because it's a new battery I'm assuming) but I can't change the Full40. It's set at 27306 mAh and any value I try to imput doesn't take. I've already checked -rw permissions so it's not that.

I'm still going to proceed to drain and let the learn flag come up and do a full learn cycle and report back. Any tips in the meanwhile are appreciated.
[Nexus One Android Development] RogerPodacter:
I'm afraid the bad news is you got one of the super cheap ones with the chip that has registers that are locked out. Your full40 for example is at max value. Try to change your full40 and see if it changes. If not then you likely are out of luck.
[Nexus One Android Development] ExtraDas:
Super cheap, Full40 locked out :p

Ah well. I needed a second battery so it's still usable.

What you are suggesting is that I can't run a successful learn mode on this battery? is there any way to find out what the effective capacity is at all or is it just a guess at this point?

Thanks

P.S. Can anyone link to a standard shape battery they have had luck with? I might just do that rather then have my original replaced by HTC (that's what I was planing on doing)
[Nexus One Android Development] RogerPodacter:
I don't think we ever found a solution for your type of battery. Look back thru the thread for those posts from a few months ago. You can still use it as is but you can't change anything or find out the actual capacity.

I got mine from HTC repair parts.com
[Nexus One Android Development] ExtraDas:
It's weird, its the same battery that temasek and a few other have, but a different seller.

This is mine :http://cgi.ebay.com/M11-1600-mAH-Ba...ccessories&hash=item23098bec2d#ht_1697wt_1139

and this is the one temasek posted: http://cgi.ebay.com.sg/1600mAh-Li-i...ccessories&hash=item3f040274fa#ht_3089wt_1139

They are/seem to be the same item.
[Nexus One Android Development] temasek:
Looked alike but may not be the same. I think its still safer to buy from reputed seller like htcparts
[Nexus One Android Development] ExtraDas:
I'll contact the seller and see if he'll go for a swap. Worth seeing if it makes a difference. My original battery I can get replaced for free by HTC (or so it seems) so I'll give that a shot. I need to have 2 batteries either way (need a high capacity battery but refuse to get the extended type).

Thanks for the tips guys
[Nexus One Android Development] temasek:
I understand your feeling cuz I am enjoying the long life battery of mine within a stock cover.

Love it :)
[Nexus One Android Development] Breece:
Ok tried again last night, phone was charging with Airplane mode for 8 hours.. This morning it still did not say 0x81 but again 0x83. I rebooted and now Battery age is 94% and Capa. dropped to a max of 1342 ...

Not really working for me or am I doing something wrong?
[Nexus One Android Development] temasek:
After a learn cycle and upon reboot or power off/on, your age becomes 94% it usually means a failed learn cycle.
[Nexus One Android Development] Breece:
Yes..thats what I thought but still I dont get what I am doing wrong... I will try again...
[Nexus One Android Development] temasek:
Take note for our n1, if it auto power off, upon power up again your battery will reset itself to age 94. If manual power off, upon power up again, it will still remember its age.

Also if you perform power off charging, upon power up it will reset its age to 94 also.

No idea why is it so but thats the fact.....

Fyi
[Nexus One Android Development] Breece:
Ok but how do I make sure that the phone does not auto power off after I am done with charging?

I am from Germany and would also like to know where to buy a new battery (regular size!!). I did not get the why some batterys have more mAh than it states on the label?? Where do I find "htcparts" ? Is that on ebay?
[Nexus One Android Development] temasek:
Auto Power-off

- When your battery used up till 0% it will auto power-off, or

- When you run out of mAh, or

- When you hit Empty Voltage Value (AEv)

Manual Power-off

- When you manually press power button and select power off, or

- When you use an application to power off

I am not sure where Roger bought his, but if I am not wrong, it is this (not too sure)

http://www.htcrepairparts.com/standard-battery-for-htc-nexus-one1600mah-p-3008.html?language=en
[Nexus One Android Development] Breece:
Ok, thaaank you again :) So e.g. the above mentioned ebay seller is prob not a good idea? Is this the battery you bought? And it had more than 1600mAh ?

And I did a manual power off after my last learning cycle..
[Nexus One Android Development] temasek:
The one I bought actually ran out of stock. Shortly after new batch came out by another seller which looks the same. So far a few users have bought from the other seller in ebay and got what they bought, an actual 1600mAh battery which is actually not a bad deal after all as possibly the battery registers did correctly reflect true values.

As for myself, maybe I am "lucky" to have got an unusual battery which till today is still over performing (at 100% is abt 2445mAh, though I set full40 @ 2500mAh).

Since others who bought from ebay did not manage to get a similiar battery as mine, I do not recommend now. I would think getting from the one Roger bought it from is safer.

Anyway, Roger got himself a 2550mAh full40 from his 1600mAh rated battery. His price is double mine but I believe is worth it cuz its still cheap (better than mine) :eek:
[Nexus One Android Development] Breece:
Thank you again :) Well I will wait for Roger to confirm this is the battery :) Dont want to spend 24$ if it is not the right one.
[Nexus One Android Development] temasek:
Maybe u can PM him to confirm.
[Nexus One Android Development] Breece:
PM sent, I will post something here :) Maybe one of the first posts in this thread could be edited to answer these questions?
[Nexus One Android Development] RogerPodacter:
yes i ordered mine from htcrepairparts.com which shipped from hong kong, but it was very fast and i received it 7 days later.

the 1600 i got was very high, like 2500, but another person claimed to buy the same battery after me from them, and i think his was truly only 1600. i'm not sure how that happened or the details, so perhaps read back thru the thread from december.

i still stand by my theory that its not real increased capacity, just a higher offset value. but i DO think the 1600 is significantly higher than stock and well worth the purchase. stock seems to suck at 1300 max.
[Nexus One Android Development] Breece:
Well just bought the battery, thanks :)

But there seems to be a problem as it says in my account "Payment not successful" even though everything during my paypal transaction went as it should be (ok my paypal email is different than the shop email, but that shouldnt be a problem oO)

Great... Lets see how htcrepairparts customer service is ;)
[Nexus One Android Development] RogerPodacter:
in case anyone is interested, i've always said the reason android phones have such poor battery life is because the OS keeps an always-on data session open, which some other OS's do not do. so today my test is turning off the data connection and see results.

unplugged at 8am. i've been unplugged for 6.5 hours, display-on time is 59 minutes, and i'm still at 80% battery life and 3.95 volts on the battery. on a normal day i'd be below 50% easily by now heh.

just food for thought, especially for all the criticism people say "symbian gets so much better battery life, its more efficient, etc". well not really, symbian just closes the data connection, android does not.if you set both to be like-for-like, then both perform similarly.

i love doing tests, so thought yall might be interested...
[Nexus One Android Development] ellesshoo:
After charging to full while doing a learn cycle are you supposed to unplug before shutting down or leave it plugged in? Also, are you supposed to manually shutdown and then power on with the power button or are you supposed to use the reboot option?