yashsingh1/xdaforums huggingface dataset:
[Samsung Galaxy Nexus] goldenchyld21:
Thanks OP. Very helpful.
[Samsung Galaxy Nexus] waylo:
Glad to spread the word!

Don't forget to click the THANKS button if I helped!
[Samsung Galaxy Nexus] mingtaoh:
thanks!! helps alot more knowledgeable now about batteries
[Samsung Galaxy Nexus] deekjx:
I bought the spare battery kit that comes with an external charger. I run my battery to near empty or empty then swap it out. Do the external chargers behave the same way?
[Samsung Galaxy Nexus] ellesshoo:
Very happy to see the same crew from the N1 battery calibration days on the GN. I was pretty disappointed when I got the NS and there was little discussion or attention given to the battery at such a detailed level. By the time I picked up the GN I had mostly accepted that the N1 situation and battery related dev/testing/discussion was unique in that it was both possible to tinker with and we had some dedicated fellas, especially you RP, that were willing/able to tackle the task.

As with the N1 battery testing, I'm all in to test and help whenever possible to break some ground with the GN.

This topic made me reminisce about my old N1, wish I hadn't sold it on eBay. I sold it to a Canadian, cost me a bloody fortune to ship to him bc of restrictions on amount of lithium cells/customs regulations. The guy was probably wondering if he bought it from some nut job when it arrived with like 7 batteries of many different manufacture/capacity and spare battery chargers. I half expect that US/CAN Customs put me on some kind of list when they inspected the shipment.
[Samsung Galaxy Nexus] deekjx:
I'd also be willing to contribute to these efforts.
[Samsung Galaxy Nexus] waylo:
That's an excellent question I don't know the answer to. I'm not sure what kind of charging algorithm the external chargers would use, except to stop charging once the current reaches a certain low level.

As RogerP described above, most of the GNex battery algorithms are a mystery at this point, with some proprietary methods that won't ever be voluntarily revealed =P.
[Samsung Galaxy Nexus] @rbiter:
There is probably not a whole lot that can be done with the nexus battery. Yall gotta remember there was a bugnor bad programming revealed and that is why so much time was devoted to that. Roger already found that the battery stops around 4.15 volts. Changing it 4.2 will not make a big difference here and im sure it is intentional to extend charging cycles.

My grandma beat me down and took my nexus. Sent from a jitterbug with beats by dre.
[Samsung Galaxy Nexus] RogerPodacter:
well i dont think this project is "dead". i still plan to compile a kernel with a few batt driver tweaks and see if we can extract what the "rcomp" register is, what values it contains, and if we can tweak it at all. same with the "mode" register. also if you guys browse the source, there is a different driver called max10742 and it has all the extra options including "age". if only samsung had given us that one.

the other thing i want to do, or someone here could do, is map the voltage readings to the batt percentages. we did this way back in the beginning on the n1, except we mapped percentage vs mAh. but here we dont have mAh readings, only volts. what we can learn from this is if the percentage is calculated precisely from the voltage, how linear the mapping is, or if it's loosely estimated based on their modelgauge algorithm or whatever they call it at maxim.

i think it would be easy to just use battery monitor widget and export a full day's worth of your logs. maybe i'll install it and give it a shot.
[Samsung Galaxy Nexus] waylo:
I already have weeks of mv vs. batt % if you need that, specifically from battery monitor widget.

Graph 1: All data from the start. 5000 data points.

Graph 2: ~600 data points, starting from after I ran the battery down to 0 completely, plugged in with phone off, and charged to 100%.

Not sure why all the data gives 2 distinctly different patterns. The lower data plots seems more favorable, with higher % at lower mV.
[Samsung Galaxy Nexus] ikediggety:
Waylo, roger... THANK YOU. this is exactly why I love android, love the nexus line, and love xda. Super duper awesome. I can't wait to see where this project goes.

Also, my own grammar OCD compels me to point out that "amp" is shorthand for "ampere", hence "ampage" should be "amperage".
[Samsung Galaxy Nexus] RogerPodacter:
Ah brilliant. So these look like data from multiple discharge cycles. Its quite obvious that its not dead linear like the n1 was. First thought is that this means their algorithm is using something else other than pure voltage readings. Perhaps a sense resistor internal which doesnt give outside access to the user. Additionally under heavy load the volt is pulled down considerably. I guess the points on the top of the graph are during your idle periods during the day. And the larger group with the steeper slope is heavier screen on usage. The grouping of these makes it look like there are only 2 discharge profiles that the fuel gauge is giving, with literally nothing in between. Very interesting, i'll have to give it more thought. Any reverse engineering we can do will help.

On second thought the top slope very well could be during your charge back up while plugged in. However the beginning is very flat which looks like idle discharge to me, very light yet flat load pulling down those volts.
[Samsung Galaxy Nexus] Tubes6al4v:
How did you export that data and plot it? That would be fun to do.

BTW, this thread is awesome!
[Samsung Galaxy Nexus] waylo:
Great observations. Ahh, you're completely right, there's no time/or (+/-) mA on these to indicate which direction the current is flowing! So, yes, one slope could be charging, the other discharging. Forgot to think of that.

I pulled the .txt log and put them into excel. It's been a long time since I've converted data into graphs in excel, so these are very rough. I had initially wanted to plot multiple days, discharge only, on the same graph, but didn't have time to figure it out. I'll go over it again, that may really help us out.

'Ampage' will be corrected!
[Samsung Galaxy Nexus] waylo:
Simple confirmation that RogerP knows his stuff :). All hypotheses appear correct!

Too many days to go through to plot each day on a line graph, so another pair of scatter plots =P

Charging scatter plot is the top line in the previous graphs. Reversed the x axis here to make it more resemble passing time = increasing batt %. I don't mess around with my phone too much while it's charging, so that may explain the minimal variance in vertical mV.

Discharging is the bottom line in the previous graphs. Like RP said, a lot more variance with mV being pulled when the phone is used as intended.

"mA" is the estimated mA from the BMW log. An easy way for me to sort out whether I was charging or discharging in Excel. ~-18-20mA seems to be a baseline level of idle discharge after the battery has finished charging, so I cut out the values greater than this.

A few outliers here and there, but definitely adheres better to 2 distinct curves.
[Samsung Galaxy Nexus] Tubes6al4v:
Here are some battery profiles from my phone. These are individual charge or discharge profiles.

min: 3552 mv

max: 4205 mv

Graph 1: Discharge Full cycle (unstable voltage)

Graph 2: Discharge after brief usb charging session (some variance, with one extreme)

Graph 3: Charge cycle 1

Graph 4: Charge cycle 2 (weird curve)
[Samsung Galaxy Nexus] Tubes6al4v:
It might be interesting to see a few different profiles:

Wall Charging 0 -> 100

USB Charging 0 -> 100

Idle discharge 100 -> 0

High power drain discharge (screen on?) 100 -> 0

It may be that the battery looses or gains mV according to different curves.
[Samsung Galaxy Nexus] RogerPodacter:
I was about to post the same thing, it would be useful to plot idle drain from 100-0 and then screen-on use from 100-0 just to see the data, although the idle data will take a long time to gather. Also you're graphs are interesting, your voltage made it down to only 3.8 3.9 volts near empty, thought it would be lower. Very very interesting to see more empty volt values.
[Samsung Galaxy Nexus] deekjx:
I thought the battery percentage displayed was calculated with a method that provided the same results based on the current charge. This does not appear to be the case. I went from 4% to 5% battery last night after about five minutes of idle time. It wasn't on a charger. Seems the system they use to calculate the remaining charge has some variance and perhaps that is something we may be able to tweak.
[Samsung Galaxy Nexus] Tubes6al4v:
I am trying to do the idle drain as best I can right now. Or rather, normal drain with minimal usage (I use my phone for some business, so I can't not use it for a couple days). 14 hours later, I am only down to 50% At least there are some cool things about this test :p I'll post up CPU usage and screen on, etc at the same time.

Can other people do some tests to help further this?

Install Battery Monitor Widget from the market, and open it at least once.

When you've collected some good data, plug your phone into the computer and copy battery_history.txt from the root of your SD card.

Open this file in some spreadsheet program. Be sure to sepperate by space, "|" (shift + \), "m", and "%" to make everything just raw numbers.

Then graph your selected time frame in regard to mV and battery %

Shift + PrntScn then CTRL+V in paint to export and image, then just crop and upload
[Samsung Galaxy Nexus] RogerPodacter:
awesome for gathering data man. the idle data is hard to get i'm sure. also it will be beneficial when we start gathering single discharge values rather than huge groups of data from a week or so. this way we can see precisely the discharge profile from person to person.

I've linked/attached the datasheet for the fuel gauge for the max17040. some quick highlights are:

only has 6 readable register addresses, SOC, Volts, Mode, Version, RCOMP and Command.

maxim has a special algorithm called "modelgauge" which does all the SOC estimates internal, and spits out the battery percentage. so basically we cant see what or how it does it internally, only what it spits out as SOC. we will have to reverse guess based on any voltage data we can gather. basically the datasheet state of charge (battery percentage) is done by following:

so its all done by their secret calculation that we dont know exactly what it's doing. here's what they say about their modelgauge:

ModelGauge Theory of Operation

last part says it can be programmed...

it does mention that RCOMP is used to compensate the algorithm, and can be adjusted. it states the following:

RCOMP

We need to see if we can tweak that RCOMP register, or at least figure out what it's capable of doing etc...

also the version register might be useful in that maybe it gives details about each specific battery, maybe the capacity or something, so if we could get access to that it might be useful for apps and whatnot to extract precise battery info. who knows.

anyone wants to read the datasheet have at it. in summary this max17040 is a "low cost" solution compared to the nexus one ds2784 chip. so it has reduced functionality and less options to tweak. ironically if you look thru the kernel there is another driver max17042 (for a different device i assume) and it has all kinds of options and registers to tweak.
[Samsung Galaxy Nexus] Tubes6al4v:
Here is my graph with minimal usage. I attached the android graph (inverted to line up) so you can see what was draining power.
[Samsung Galaxy Nexus] RogerPodacter:
well i think your data somewhat proves that the sharp edge of the earlier data we saw is the idle discharge curve. and the data that was more scattered below that sharp line must have been "screen-on" usage pulling down the voltage. i dont know where it goes from here other than making that kernel and reading that RCOMP register and trying to send commands to it i guess...?

the other thing is that this battery seems to turn off around 3.6 volts, but we know it can go a tad lower since many phones hit 3.4 v. if only it could be tweaked even a little.
[Samsung Galaxy Nexus] boynamedstacy:
?..... fag
[Samsung Galaxy Nexus] Jedan:
Already hit the thanks button for you OP, but just wanted to say that posts like this are why a user like me started lurking in XDA in the first place.
[Samsung Galaxy Nexus] waylo:
Appreciate it! Yes, I myself started lurking after getting my N1 in 4/2010. Sadly, and/or gladly, I found that phone very much in need of tweaking/fixing.

RogerP, thanks for sharing your research thus far--always something new to learn.
[Samsung Galaxy Nexus] Tubes6al4v:
I will do the Screen On test tonight to see if that makes any change to the graph. Perhaps we can figure out under which conditions the battery will drop to 3.4v rather than 3.6. Maybe just a large battery load at low voltage already?

I forgot to tick "monitor without widget" so I don't have the graph to show it, but when charging over USB, it hit 4205mV (100%) then dropped down to 4193mV(99%) and stayed there. On wall charging, however, it stays at 4205mV(100%)
[Samsung Galaxy Nexus] RogerPodacter:
I just stumbled across some useful info about our battery fuel gauge from the sgs2 forum. Basically the result is there is not much we can do with our fuel gauge. But they do talk about how to truly calibrate it. And they discuss the improved version max17042 which is used on tbe sgs2 and has all the bells and whistles.

Heres the topic.

http://xdaforums.com/showthread.php?t=1312273

And here is the source for the better max17042 chip.

https://github.com/Entropy512/linux_kernel_sgh-i777/blob/master/drivers/power/max17042-fuelgauge.c

Basically this does give us some insight how our reduced chip may work by looking at the improved chip and assuming they are similar. I am gurssing that our chip is using a voltage average value which we cant see and is internal part of the "modelgauge" algorithm. It sucks cause the sgs2 driver can lower the empty volt like we did on the n1. But we dont have this ability with our chip.

However the thread i posted contains a recalibration method, and that should work just fine for our device as well.

Enjoy.
[Samsung Galaxy Nexus] waylo:
Excellent, including the link in the original post.
[Samsung Galaxy Nexus] Tubes6al4v:
I'll give that battery calibration a test, but until then a couple updates:

1. With Franco's Kernel and hotplug enabled, my idle is WAY down.

2. Attached is the screen on drain test. It was done at the minimum brightness, and most of my screens are dark. Probably the reason why I got 7+ hours of screen on :)
[Samsung Galaxy Nexus] @rbiter:
You were just draining the screen and not using the phone? The best I've had is 5.25 hours display using the phone over wifi.

My grandma beat me down and took my nexus. Sent from a jitterbug with beats by dre.
[Samsung Galaxy Nexus] Tubes6al4v:
I tried to use it as little as possible. As you can see, I accidentally shut off the screen after use a couple times.
[Samsung Galaxy Nexus] RogerPodacter:
the data looks almost like the idle discharge curve from earlier in the thread. one thing i'm kinda disappointed with is the shut down volts seems so high. nexus one shut down at 3.416 volts, and we lowered it to 3.2. but if you notice all the data in this thread the voltage curve is still very flat and hasnt started dipping yet at 3.6 volts. seems to me like there is more juice available is my point...
[Samsung Galaxy Nexus] waylo:
I concur, it certainly seems there should be more juice to squeeze.

But I could only manage 1 BMW reading of 3.4, and that was from me repeatedly booting and booting after the phone shut down. Eventually it just would not boot at all. So, maybe there is something different going on here with empty voltage levels.
[Samsung Galaxy Nexus] ellesshoo:
Anyone know if the battery uses cylindrical cells or if it is Li-poly? I find it hard to imagine a phone like this would be anything but Li-poly but the rounded sides are certainly reminiscent of battery packs containing cylindrical cells.

I'd cut one open myself if spares were easily attainable. Not really relevant to the main purpose of this topic but if they were indeed cylindrical cells the bad news would be they're not the "best" battery technology but the good news is we could at least hold out hope that someone like Mugen or Seidio could produce an aftermarket battery with increased power density in the same overall size one day. Maybe they will lower the empty voltage on their controllers as well.
[Samsung Galaxy Nexus] RogerPodacter:
i'm almost positive it's not li-poly...
[Samsung Galaxy Nexus] gogol:
The popular battery calibration method has been debunked:

http://xdaforums.com/showthread.php?t=1442989
[Samsung Galaxy Nexus] waylo:
About time this was validated from a verifiable source!

EDIT: First post edited accordingly
[Samsung Galaxy Nexus] Tubes6al4v:
I went ahead and collected some data from my battery_history.txt I'll appologize for some of the amateur work, I am still learning.

NOTE: Since our batteries do not report mA, these values are calculated by Battery Monitor Widget

USB: Consistently sub 600 mA

AC: 600 - 1200 mA

Charging over AC: I usually get an initial surge of 800+ mA when first connecting. Usually it stabilizes, but as you can see there have been some instances where very high mA is calculated. I did not find a similar anomaly in voltage, so it may be a calculation error.

Charging over USB: Generally more stable than AC, but characterized by consistent fluctuations in calculated mA. This is contrast to the (relatively) smooth lines for AC
[Samsung Galaxy Nexus] seanyzf:
I got a question here. Tried using this app and follow exactly what I was told but however it seems that my final capacity is only 1200mAh instead of Full40@1452(stock batt) and the Batt Age drop to 83% from 100% after a reboot. Redo the whole thing produce the same results, can anyone help me?
[Samsung Galaxy Nexus] RogerPodacter:
Thats my app (and dvghl's)! Are you using this on a galaxy nexus? If so i'm baffled as how those registers are outputting values since this kernel and driver wont work.

But from your tests it looks to be working exactly right, your battery has just aged to 83%. Your full40 seems to match that at 1200mAh. If you really dont want to believe it you can manually enter a new full40 value of 1452 and then use the phone normally. Charge to full. Then see if it dies at 0% or not.
[Samsung Galaxy Nexus] waylo:
Is this on your Nexus One?

If so, you're on the wrong forum and should post this on the appropriate thread for the battery app in the N1 section! Nice theme though, looks very much like the Galaxy Nexus.

If you ran the app on the Galaxy Nexus, you also did that wrong, as the app is only for the Nexus One!
[Samsung Galaxy Nexus] seanyzf:
Nope I not using it on Galaxy Nexus but on HTC Desire. I suppose it should work on most Android except for a few devices that are listed incompatible?

sorry, i will cont it under [UTILITY] Battery calibration tools
[Samsung Galaxy Nexus] RogerPodacter:
Yes youre correct, the original desire is also compatible as it uses the ds2784 chip as well. Hope you find your answer but it looks normal to me at first glance.
[Samsung Galaxy Nexus] waylo:
RogerP of course is correct, my statement was not entirely accurate as it's not "ONLY" for the Nexus One, but for others with the appropriate battery drivers and chip.

My apologies, seanyzf, for appearing to bounce you off this thread, but the thread you listed has many more senior users who monitor it to just to answer questions like you posted.
[Kindle Fire General] uniqua97:
Some more and strange info:

$ cd /mnt

$ ls -l

ls -l

drwxr-xr-x root system 2012-01-02 01:38 obb

drwxr-xr-x root system 2012-01-02 01:38 asec

drwx------ root root 2012-01-02 01:38 secure

d--------- system system 2012-01-02 01:38 sdcard

I can not do su, I can not reach any directory. (including sdcard).

I can not do even whoami:

$ whoami

whoami

whoami: permission denied
[Kindle Fire General] b63:
as a first step you could try if this is successfull:

adb shell

look if your prompt is $ or # - if it is $ type su - must change to #

mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system

chmod 755 /system/app

if not you can try to install twrp (if you not allready have)

http://xdaforums.com/showthread.php?t=1414832

and flash a backup, the stockrom or one of the roms available in the forum
[Kindle Fire General] uniqua97:
HI Thanks for the reply.

adb shell works and prompt changes to #

su does not work.

mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system

chmod 755 /system/app

does not work, says I don't have the permission. I think this is because of readonly file system.
[Kindle Fire General] b63:
have you tried the second solution ?
[Kindle Fire General] uniqua97:
I will try tonight but, I am not sure whether it will work. Because, if I am not calling wrong, I tried to get into data directory last night and could not.

But I will try tonight again and will let you know.

Thanks again.
[Kindle Fire General] osozraz:
Second solution works, I fixed this same problem that way.

BUT. Be careful what you do next, as I flashed the stock rom and now my Fire is bricked again and with a non working adb. So, again, be VERY CAREFUL
[Kindle Fire General] uniqua97:
osozraz,

So given you experience, which rom should I use?
[Kindle Fire General] b63:
absolutely right ! - i would suggest one of the prerooted stock roms from here

http://xdaforums.com/showthread.php?t=1402440
[Kindle Fire General] osozraz:
I can´t say, as my Fire is still bricked and that was the first rom i installed. For my experience, DON´T flash the stock rom.
[Kindle Fire General] uniqua97:
Thanks a lot for all the help.

The solution about fbmode in the following thread is worked:

http://xdaforums.com/showthread.php?t=1414832

Then I installed TWRP using Kindle Fire Utility v0.9.1:

http://xdaforums.com/showthread.php?t=1399889

Then I used update-6.2.1-rooted-unsecureboot.zip with TWRP:

http://xdaforums.com/showthread.php?t=1402440

The videos from the following links are also awesome:

http://www.jayceooi.com/2011/12/29/how-to-install-twrp-2-0-recovery-on-kindle-fire-video/

http://www.jayceooi.com/2011/12/30/...droid-rom-on-kindle-fire-with-twrp-2-0-video/

There are more videos in those links.

Hope this helps to others as well.
[A7 General] Caleb365:
I was trying to update my a7 using a flash drive. I went back on the update site, read more thoroughly and it said that I have to use a MicroSD card because the USB port is only a host and cannot be used for a firmware update. It went into update mode and Andrew in a file came up with a download symbol below it then, the comand prompt came up and said updating do not unplug, I left it sitting there and came back a few minutes later and the screen was black. Can anyone help, it won't boot up at all and will only turn on and off and that is it.
[A7 General] FUZA:
A7+ bricked was fixed with Destron5638 information

Destron5683 responed for the black screen will fix the new a7+. If you bricked it his information will get you back to factory settings.

Thanks a million