yashsingh1/xdaforums huggingface dataset:
[Nexus One Android Development] chowlala:
I think the idea to prevent the current from dipping is to keep the phone off? So that the current will always be positive perhaps? No idea, I gave it a shot with what I did last night... Heh.
[Nexus One Android Development] RogerPodacter:
no the current is always negative off the charger, and always positive when you are charging. my particular issue was because i was using my car charger, which has notoriously dipped current like that when i push the device too hard, which is exactly what i freaking did like an idiot. my current was all positive except that one that stopped it.

unfortunately at this stage we cant do it with the phone off cause we need to see the register value to know if we got it or not. i've tried later today, and that must have been a freak lucky charge, cause no dice so far. however reading the data sheet gave me a few ideas why it might have worked, so i have to recreate that condition again (i.e. full discharge) cause this whole thing happened during a 18% - 0% drop, that's when i got learn mode active. the attempts after were at 1-2% down to zero, which might not satisfy all the conditions, i.e. VAE must be below threshold, IAE must be greater than threshold at least 2 times, etc. so i'll try again.
[Nexus One Android Development] RogerPodacter:
if that is really your mAh number at 100%, then you absolutely activated learn mode. how exactly did you do it now?

what happened with the pre guys, they too had the 87-88% -> 100% jump. the number right before the jump is their true capacity, which for us seems to be around 1250 mAh. if this is now your normal 100% value, then you certainly did calibrate with learn mode. damn how long did you wait when you saw the power down message, 1 second or like 3-4 seconds?

trying today, i counted 11 seconds that power down message displays till complete shut off. i tried plugging in at all different times, no go.

i guess post your dmesg log if you did one at the time. or charge to full now with phone on and see if it stops at 1244mAh and post that log.
[Nexus One Android Development] theloginwithnoname:
I slammed charger in just as it powered down and I got 1278.

there are a couple of recentish posts with the procedure but in a nutshell 1) use terminal, "cat /sys/kernel/debug/batt* > /sdcard/<filename>", then email yourself with the file attached, or 2) cat again, connect via USB, "adb pull /sdcard/<filename>".

Last-but-one column is the reg_status.

btw, the battery log is only persisted to next reboot.
[Nexus One Android Development] chowlala:
I slammed in the charger the instant I saw the message, so probably bout 1-5 seconds gap. Then let the phone die off, and then let it charge till the next morning while I went to bed. Lol.

Will report tonight what % the battery dies off at later.
[Nexus One Android Development] ram130:
You know I started doing this a few days ago without reading it here first :D ..This is so weird lol..one thing though is that I never noted the values ..ANyway guys gonna do it again since my battery is about to die.
[Nexus One Android Development] theloginwithnoname:
watch and write your way up careful, as mine's about an hour away and I wanna try it too :D
[Nexus One Android Development] ram130:
Battery finally died after 24hours! :p and guess what, it died at 1%!! and guess what, I was able to use the phone for over 3 or 6mins before it shut off too :eek: ..and guess what, yep, i got some screen shots of the final moments..:rolleyes:

Only one problem, I don't know at what mAh the phone was at when it came off the charger(didn't check) :( .. I did how ever hit the Export Log button in OS Monitor before it shut off tho, hope it has mAh at 100%...Also I managed to "slam" the charger in when it said shutting down..:D ..I'll be back later once my phone has finished charged to post the pics(don't wanna interrupt it right now;))..

:D:D how did your discharge go and what percentage this time..:rolleyes:

My friend's galaxy s died at 1% yesterday, it seems samsung vibrant doesn't have any battery calibration issues...hmm, gonna sell my n1 soon..

Here's a theory, maybe having the n1 EDGE slowed the discharge rate to an accurate one? Hmm
[Nexus One Android Development] chowlala:
I think I can safely say that my phone has finally been calibrated. It's at 9% right now. I've never seen 9%. EVER. Lulz.

Edit: at 5% now. =))

Whee, ok, phone just flatted out, not sure at what % though cuz I was playing Angry Birds. Lol. I suspect it's pretty near 1% or so.

Now. For the crunch test - charging regularly with the phone on overnight. Let's see what happens in the morning. =S
[Nexus One Android Development] theloginwithnoname:
what the blummin' hell did you start Angry Birds on 5% for?!

lol
[Nexus One Android Development] chowlala:
Trying to burn off the battery. At 1% now, did a burst charge. Never had these values ever.

Time to see what happens tomorrow morning. Lol.
[Nexus One Android Development] RogerPodacter:
Ok guys I activated learn mode again! But then I lost it. But I proved my theory how to activate it, its a little hard to explain. First of all I'm an idiot cause both times I've done this I was out and about in my car, and the car charger does not provide enough current so it drops thus stopping learn mode.

The data sheet tells us that learn flag gets activated when active empty point is detected. This happens when voltage active empty threshold is passed and current active empty is above for 2 consecutive readings.

That exact condition does not happen on our phone unless you have the 15 to zero drop issue. Right now I'm back at 0x61 which means that both active empty volt and standby empty flags are set, which is good. The problem is you MUST reach this point from a 100% discharge. If you try to plug back in and do it again (like the pre guys do) it just won't satisfy those conditions because now your battery will temporarily work at 1, 2 5% etc until you do another full discharge where it will die before zero percent. See my logs, I'm gonna do it this time on a wall charger!

09/06/2010 13:49:12 [INFORMATION] batt: 0, 3542mV, 87mA (179), 42.2C, 0mAh, 0x71, 93
09/06/2010 13:49:12 [INFORMATION] batt: charging OFF
09/06/2010 13:49:14 [INFORMATION] batt: charging FAST
09/06/2010 13:49:22 [INFORMATION] batt: 0, 3571mV, 427mA (179), 42.2C, 0mAh, 0x61, 9
09/06/2010 13:49:32 [INFORMATION] batt: 0, 3591mV, 407mA (179), 42.0C, 0mAh, 0x61, 9
09/06/2010 13:49:45 [INFORMATION] batt: 0, 3576mV, 191mA (312), 41.5C, 1mAh, 0x61, 93
09/06/2010 13:50:00 [INFORMATION] batt: 0, 3576mV, 135mA (312), 41.0C, 1mAh, 0x61, 93
09/06/2010 13:50:17 [INFORMATION] batt: 0, 3605mV, 287mA (189), 40.5C, 3mAh, 0x61, 93
09/06/2010 13:50:27 [INFORMATION] batt: 0, 3625mV, 475mA (189), 40.0C, 4mAh, 0x61, 93
09/06/2010 13:50:47 [INFORMATION] batt: 0, 3620mV, 350mA (348), 39.6C, 4mAh, 0x61, 93
09/06/2010 13:51:00 [INFORMATION] batt: 0, 3630mV, 397mA (367), 39.5C, 6mAh, 0x61, 93

The point is now I know exactly how to do it. It must be full use the entire time during the discharge, screen on max brightness, use device, etc.
[Nexus One Android Development] ram130:
Well my phone charged up faster than natural this time(i think). As usual I didn't note the % when I turned it on, but after 10% discharge it was at around 3000mAh..Anyway here are the pictures as promised from my amazing discharged before and to note, "export log" never exported everything from 100%, I guess OS monitor needs be running since start up. Oh well here we go:

So I started at 7% :

To help speed this along, 3% later:

Now at 3%:

At 2%, I had some updates to download:D:

And finally at 1%:

Interesting isn't it? Now if this can be a everyday thing :D
[Nexus One Android Development] RogerPodacter:
Ram130, I'm very much convinced that you successfully did a learn cycle yesterday when you said you plugged in during shut down then left the phone off all night during charge. Can you please post your log at full charge at 100%? That will give us the info we need to see.

It seems the difficulty getting into learn mode is we need voltage to drop below 3.4 volts BEFORE the other empty detected points happen.

I'm interested to see your full point numbers now:-)
[Nexus One Android Development] chowlala:
Ok, so this morning, the phone was back up at 13xx mAh.

Not sure, but I'm assuming even though I did manage to get calibration cycle, it's not fully working. Not sure why the phone decided to bump itself up again. Lol.

So right now, we have a working theory.

1) Phone goes into shut down

2) Slam charger

3) Leave overnight to charge till full

4) Morning values should read 12xx mAh

However, though this works, it doesn't stay at that level of calibration. Maybe it's cuz I had quite a few shut downs as well towards the night. Will test again later tonight. =/
[Nexus One Android Development] RogerPodacter:
You got it for the most part. After one complete learn cycle (full uninterrupted charge to 100%) your full point gets recalculated to that new (now lower) full point, and age percent gets updated to match that value. Curious to see your results...
[Nexus One Android Development] chowlala:
Yeah, am thinking maybe a few more calibrations might do the trick. Or maybe the idea is not to mess up the calibration by doing silly short charges. Not sure. Still trying out. Meh.
[Nexus One Android Development] theloginwithnoname:
Definately not! If you hit learning/calibration mode, you're calibrated - don't try and do it again or you'll likely get the jump issues back!

The key for those who have likely hit learning mode and who now have a battery that goes from 100 - 0% (and likely with a lower full capacity) is to make sure you are running a kernel that stops on-charges when the battery says it's full - i.e. a kernel that doesn't have custom "< 80mAh"-type conditions, just "if battery.full then stop_charge".

edit: **the kernel that comes with CM6 has the <= 40 hackery in it**

http://github.com/CyanogenMod/cm-kernel/blob/android-msm-2.6.35/drivers/power/ds2784_battery.c - line 472 onwards
[Nexus One Android Development] RogerPodacter:
dammit! i got learn mode activated again for the third time and lost it. but i think now i have a theory on how to get it to stick. gonna try on the next attempt.
[Nexus One Android Development] RogerPodacter:
yeah that's a good thought. and brings up another idea, for your "battery cal app", you can add a phase 2, or an extra part of that app which lowers the Imin terminating current for those who wish to obtain that extra top 50 mAh battery capacity which currently gets cut off using C/20, and build that into the 0-100% range so it captures all of it. technically the battery is full when pulling zero current. that could be like an added bonus part of the app.

and hell you could even raise the charge volt to maybe 4.19 for that extraness too...(not sure how safe that one is though)
[Nexus One Android Development] ram130:
You made a great point. Well I turned on my phone and I didn't have OS monitor on auto start so it didn't capture the from start up value, either way once I started OS monitor it showed 1262mAh, I'm sure I got 1278 though. Here's the picture:

my number question now is do I let my n1 go down to 0% all the time then slam charge it or charge whenever(normally)?

I had to shut down the phone to get the picture and transfer some stock rom images,hopefully the value is the same. Gonna flash back to stock 2.2 unrooted and sell the phone on Wednesday, *crys* :( ..then ....it's my move to the vibrant. I can't tell if I'm excited or making a stupid mistake though :(, any advise?:o I guess I can be ya'll goto vibrant man for batt. info on the samsung side? What you guys think, stick with the n1?
[Nexus One Android Development] chowlala:
Owh. Right. Didn't think bout this. Time to pester Pershoot for a regular kernel without the amendments. Heh. Will do another recal tonight if my phone doesn't shut down at <10%. Just to test the theory. Pretty sure that morning my battery was recalibrated. Must be all the fudge I was doing that messed it up after. Haha.
[Nexus One Android Development] RogerPodacter:
No, once calibrated, you won't have to keep doing that. The true test is do a full charge with the phone turned on to see what happens at 100%. Does it jump up to 1363mAh, or stay at 1278?

So is pershoot's kernel now officially have our edits? Cause really once we get register writing, we should leave the driver the way it was originally and just change our register value to accomplish the same task. That way its up to each individual if they want it or not.

Selling the nexus for a vibrant? It's very possible the vibrant uses the same ds2784 battery chip, or certainly a similar one to mess with. It's certainly not a bad move, but I'm gonna wait for the higher CPU phones I think.
[Nexus One Android Development] RogerPodacter:
System panel does this exact function already. It's monitoring shows every app that uses CPU and what percentage, etc. It's also the only task manager that shows true app status for android, unlike ATK and those etc. It's the task manager for people who know better that they are not required in android:-)
[Nexus One Android Development] theloginwithnoname:
Is this a recent addition - i.e. to the release candidate of the paid version? I have used SystemPanelLite for monitoring up until it got released recently, when the monitoring functionality expired (as expected). I didn't see a way to see what apps were using what % of CPU, only the battery % as a whole?

If it's something they've added, can you explain how to use and I'll get the paid version.

p.s. I find I have to use two apps for killing tasks - SystemPanel sees some that Advanced Task Manager free doesn't, and vice versa!
[Nexus One Android Development] RogerPodacter:
It's buried deep in monitoring so maybe you missed it. Go to monitoring, then history, then plot, show top apps. It gives you a complete breakdown of every and and CPU usage from highest to lowest.

And yes I think this is a new addition. But It's really a brilliant function and must have.
[Nexus One Android Development] RogerPodacter:
About not seeing certain apps, are you sure you enabled show system processes in system panel settings? Just making sure.
[Nexus One Android Development] theloginwithnoname:
Ah yes, I remember seeing the app stuff now - will give this a bash later on. Do you know if it includes Widgets, or just "executable" apps?

Yep, I did - but good point.

I technically use *three* task killers actually. OS monitor shows items like Camera and My Uploads that SystemPanel (SP) and Advanced Task Manager free (ATMF) don't. ATMF shows the Maps (/Latitude?) threads that SP doesn't (this may be because they are lower level and I only kill up to Inactive apps). SP handles the rest. Annoyingly, SP doesn't kill itself ;)
[Nexus One Android Development] chowlala:
Not too sure how task managers affect the Android System, I've stopped using task managers already after learning how the OS governs its apps. Apparently aggressively killing tasks will only cause them to drain more power because they'll be forced to restart from process beginning all over again.

Now, I was wondering, again, would it be possible to pull someone's batterystats.bin and push it into another's person's phone? And like, what would happen?
[Nexus One Android Development] theloginwithnoname:
I only kill the ones that don't return - I exclude ones like widgets and Voice Search. Anything that comes back regularly, basically. Especially as the Market starts them periodically! I also uninstall any that I don't use (Voice Dialler, Car Home, etc).

I'd spend a bit of time researching/cracking the file format first - may save you any problems if you go straight to copying another person's file. Has there been any work done on this before?
[Nexus One Android Development] Marine6680:
Thanks

All Li-ion batteries fall in a certain specification range regardless of capacity. 4.2v fully charged 3v discharged; (the safe discharge voltage for longest service life, and 3.4-3.5v seems to be the minimum operating voltage for these phones) they follow a set discharge curve fairly closely. (at a constant load) Many batteries have a control circuit inside that reports its initial (read "new") specs; the software uses those values to determine the health of the battery and when you would need a replacement. The battery stats file helps the phone know how the battery differs from the norm.

The load on the battery affects its operating (nominal) voltage. The nominal voltage for a Li-ion battery under moderate loads is 3.7 volts; (loads of around 1C of the battery capacity, in the case of the nexus battery it would be 1.4 amps) heavier load means a lower operating voltage and lower loads mean higher voltages. The nexus will pull in around .15 amps (150mA) at full load (that load is minus the screen, the cpu draws around 120mA alone; the other chips will pull some as well, the screen will double that load at least), much lower than than a moderate load so voltage drop is small, but the difference between idle/screen off load and full load is enough to cause a voltage drop that will cause the phone to shut off when the battery is near empty. The battery status is not 1 to 1, it has a refresh interval. Your lock screen may show 10% but then you start up an app that bumps up the load for a few seconds, and the battery voltage will drop bellow the voltage needed to run the device; then it shuts down.

Battery capacity is determined by taking a sample of a design, and measuring the energy required to charge it fully from a discharged state (usually 3v, some dubious makers use the lowest voltage you can drain Li-ion without destroying it around 2.6v or so)

While refreshing the battery stats file regularly will help accuracy and with helping get the best charge when powered on, the battery gauge will never be 100% accurate. The battery gauge is really just a best guess using typical discharge curves and profiles; this process is complicated by the dynamic nature of the loads. Refer to my prior post for info about how the battery is charged.

Every battery is slightly different. The 1400mah is just the average (or a nice round number) gotten from testing design samples, or the engineering design capacity. (you can get close approximations from design and volume calculations)
[Nexus One Android Development] chowlala:
@marine

Lol, too deep. But very interesting though. Not entirely sure how the entire technicality of the batteries work.

But I guess what you're saying is:

No matter what we try to do with the batterystats, we can only come "this" close to having it measure up accurately. And that difference isn't very far from what we currently have?

Is that it? Cuz I'd like to brainstorm further about what we can actually further from a OS point of view, like using apps to control/read/write the stats to improve the reading accuracy or stuff.

Again, I'm just babbling stuff out since we did call this "Brainstorming". =)
[Nexus One Android Development] Marine6680:
Yeah I ramble at times.

But yes, that is the basic idea, its just a close guess. If you want better battery life, charge while powered off; perfect accuracy of the battery meter is really not going to happen. Regular deleting of the battery stats file will hinder long term accuracy, because it lowers the sample size; refreshing the file with a regular calibration will be helpful. Deleting the battery stats will help people with regular poor charging habits though.
[Nexus One Android Development] RogerPodacter:
So my battery discrepancy is simply a manufacturing variance. From the beginning its always died at 8% showing 3.48 volts. After 3 months of this I finally wiped my battery stats and get identical results, dies at 8%. So I think the OS Just has hard coded battery info its expecting for a predetermined "1400 mAh battery." My battery is probably 1350 mah instead due to production tolerance.

Like I said, previous phone the Nokia 5800 came with a 1350 mah battery. But the actual reading on my particular unit showed 1275 mah. So it was 75 mah off from the rated specs.

It's pretty safe to conclude the same is happening with my nexus battery, hence the 8% difference.

I'm really curious to buy a spare battery and see the results.

Also this tells me that the battery stats file has a lot less influence than we might think, since it obviously can't adapt for my battery.
[Nexus One Android Development] Marine6680:
Battery percentage is based on voltage readings, the device reads the battery voltage and compares that to an internal reference.

It seems strange that your gauge shows 8% at 3.48v, that should be pretty much dead for the nexus one. (though not truly dead from a Li-ion standpoint) Maybe it is your battery at fault though.

Here are some pics. One shows the discharge curve under constant load; as you can see the drop is sharp at the end, which is why the safe voltage of 3v is used as its practically 0 anyway.

You can also see that 3.5v there is still 25-30% battery capacity left, so we only use about 1000mah of our 1400mah batteries.

Also, you can see that sharp drop at the first of the graph before it levels off. It poses difficulties in accuracy because such a large portion of the usage time for our phones is in that area.

The other pic shows how the charging works for a Li-ion battery. It shows that if we charge our batteries at 1C (1.4A) it would take 2.5 hours; the supplied charger can only provide 1A and USB provides .5A at max; this increases charge time. Around 3.5 hours for the charger and 6 for USB; that is with the device powered off, if it is on only the first part of the charge curve can be done safely. It is also interesting to note, that charging via USB, while taking longer to charge, is better for the battery in the long term, and also gives a better charge to the battery. (might can gain an hour of real world standby time, and around 10 minutes or so of active use)
[Nexus One Android Development] RogerPodacter:
You just said it, at 8% my battery dies and shows 3.48 volts. It's done this from the beginning.
[Nexus One Android Development] Marine6680:
Call up google support, complain about having poor battery life, and they should send you a new battery; see if that fixes it.
[Nexus One Android Development] rohandhruva:
(I have created a thread for this in QnA, but I am cross posting here because this thread looks more active. Thank you.)

Hi everyone,

I am having strange battery issues. When the phone is switched on and charging, it charges very quickly (an hour or so). But it also discharges just as quickly - I talk on the phone for 30 minutes, and battery indicator is already on 3/4th green. Maximum time I can get out of it is 15-16 hours standby, and normal calling.

However, if I switch off the phone and charge, it takes longer to charge it (around 2-2.5 hours), but it also retains the charge longer. Maximum time I can get here is 35 hours standby, again with normal calling.

Also, my indicator is quite weird - when my battery information (in *#*#4636#*#*) says 34%, the indicator still shows 1/2 green.

I had done a "wipe battery stats" only once, when I had upgraded from EPF21B to FRF50. I have since tried CyanogenMod, and updated from nand backup, then went to FRF72 etc., but I have never done "wipe battery stats" at that time. Could this be the cause of my problem?

I realise this may be a battery calibration issue, and I have read many threads, but I am unable to find the authoritative way to re-calibrate my battery. Please help.
[Nexus One Android Development] theloginwithnoname:
Have a look at my post a page or two back - report back with your results.
[Nexus One Android Development] rohandhruva:
Are you talking about post #32 -- http://xdaforums.com/showpost.php?p=6831260&postcount=32 ?
[Nexus One Android Development] theloginwithnoname:
that's the one!
[Nexus One Android Development] rohandhruva:
Thank you.. I'll do a comprehensive recal when my battery next drains.
[Nexus One Android Development] chowlala:
I found that turning off the phone and allowing it to charge up further improves battery accuracy. Basically this sets the "high" end threshold for the battery to measure.

Give this a shot for better charging habits. =)