yashsingh1/xdaforums huggingface dataset:
[Tilt, TyTN II, MDA Vario III Android Development] elander:
The text box with this "issue" is the one located in battery settings the advance one, it allows me to input 1350 as a value but it won't put that in the nbh, I believe 2000 is as low as it will go, so since n2rjt recommends to use 1350, as it is the capacity in mAh of the original battery, having 2000 in that text box just won't work. thanks!
[Tilt, TyTN II, MDA Vario III Android Development] loserskater:
It will go down to 1000 (as that is where it starts) but I just changed it so it won't go below 1350. I tried using the previous version and setting advanced to 1350 and after opening it with a hex editor it was set at 1350, so I know the previous version worked... but it now should work how you need it to.
[Tilt, TyTN II, MDA Vario III Android Development] elander:
Yes I know it starts @ 1000 that's why I found it strange when dmesg "told me" that I have 2000mAh, and I tried it twice just to verify, even n2rjt had to edit it, anyways i'll download the nbh editor again, (latest one I guess) or did you tweaked it on the atool app?
[Tilt, TyTN II, MDA Vario III Android Development] loserskater:
I'm not sure how the kernel reacts to setting the battery value.

AFAIK setting the battery_capacity to the mAh isn't right, as I don't think the battery_capacity is in mAh but something else. I'm not sure what though.
[Tilt, TyTN II, MDA Vario III Android Development] n2rjt:
I started out thinking, wouldn't it be nice to put the conversion factor into the kernel so that battery_capacity can be truly mAh.

But after studying the ds2746 spec sheet and the code, I am convinced that as long as the KAISER_RSNS value accurately matches the resistor value in MOhms, battery_capacity is already in mAh.

So, I enabled the dynamic adjustment of battery_capacity, to see where it ends up. My battery is an Ebay special marked as 1600 mAh, but the battery_capacity adjusts to about 1320. That's close enough that I suspect maybe my battery was "accidentally" mis-labeled and is actually 1350. Or maybe it has dropped to that point in the six months since my son bought it.

So, I am experimentally asserting that battery_capacity is in mAh, and asking those wiling to try running the experimental kernel accordingly.

I changed my copy of nbheditor when I first started playing with this source file. Maybe it was an old copy. I haven't updated it or switched to the newer tool. I'd like to do a command line version so I can automate the build/install process. But that's not a priority.
[Tilt, TyTN II, MDA Vario III Android Development] elander:
finally I got it to go below 2000mAH, I edited again with the nbh editor (it took me 3 tries,lol) but now dmesg tells me: 1369/2073units and 1296mAh, which is pretty close, but I understand that what we are looking for here is to have: 2150 units and 1350Mah, am I wrong? Probably it will get there after I get the battery empty and then full again(bad for li-ion I know) anyways my battery is about a month and a half old so guess I´ll be able to hit closer to 1350Mah. It´s looking good so far.

ps: After 4 1/2 hours I´m @ 66% I used wifi for about 20 minutes and made a couple of phone calls no more than 2 minutes each, so let´s say I spent 8 minutes talking and I´m not using data as I don´t have a data plan, so I guess battery life could be better though, but I guess that´s the whole point of this, :)...
[Tilt, TyTN II, MDA Vario III Android Development] n2rjt:
Right ... these experimental changes aren't aiming to give us better battery life, but instead, to let us more accurately know how much we have left.

I'm struggling over how to handle the case where the configured battery_capacity isn't right. Two cases: configured capacity > actual capacity, and configured capacity < actual capacity.

I guess the best answer is to imitate what Windows Mobile does, right? Geesh, I'm going to have to install WinMo again, and run tests between WinMo and HARET. So, I'll install Shifu 4.3 and start doing dangerous things. If you don't hear from me again, my battery exploded ;-)
[Tilt, TyTN II, MDA Vario III Android Development] elander:
Jajajaja, I guess I´ll have to call the fire fighters just in case....lol. Well... whatever the outcome of this might be, I´m glad Somebody it´s dedicating his efforts to get this sorted out, and also, I feel good I´m on first row watching this closely, because this issue for most people (who only own one phone: kaiser) might be the one keeping them from installing android on nand and saying good bye, nice to know you WinMo.

Ps: As you might already guessed I´m not skilled when it comes to programing or editing code, so sorry if my questions have been a little on the noob side, but I´m willing to compensate by keep trying all the experiments you upload (as long as the don´t seem too crazy, like pouring gasoline on the battery just to see what happens lol), so I´m looking foward to your next post, just to see how it went with old winmo. see ya!
[Tilt, TyTN II, MDA Vario III Android Development] elander:
weird stuff my friend, I discharged the battery and when I turned the phone back on it went back to the ol´3200 units a.k.a 2000mah and it refuses to go to sleep properly, (it turns off the screen but can be awaken by most buttons instead of the power button only) so it´s been stuck @ 1% for like half an hour, and also the phone seems to recognize the wall charger as an "usb connection" like if it was the computer not a charger and I believe (I may be wrong) that it also affects the charging procedure, or at least makes it slower, what I did was to turn off everything on the phone, including the cell radio, to help charging the battery faster. I´ll keep you guys posted.
[Tilt, TyTN II, MDA Vario III Android Development] n2rjt:
I think that was a divide by zero in the aux resistance calculation. I protected it with an if statement, and no crash since then. (Fixed in the second upload.)

Yes, I see the same, but if you wait 4-5 minutes, it continues to boot.

Weird, but not caused by my edits. This has been reported on the kernel thread.

The latest status: I built a kernel that doesn't adjust the level at all, just reports what it says. I then ran the battery down to 37% with NAND installation, then installed Windows Mobile 6.5, and it said 2%. Then I let it charge in Windows. It was creeping up to about 10% then jumped to 100% full. A quick reboot into HARET android confirms that the accumulated charge is 1350 (2160 units). Next I'll run it down and charge again, in Windows, to see if there are any gaps. I need to find a WinMo app to record battery level over time, eh?

Ewww, Windows Mobile, I thought I had seen the last of it! :-(
[Tilt, TyTN II, MDA Vario III Android Development] elander:
I'll be waiting for your next .nbh Been having I few issues with last one. thanks !!!!
[Tilt, TyTN II, MDA Vario III Android Development] n2rjt:
That is strange, as I have used the latest kernel git repository as my base.

The only thing that has changed between the two versions is the battery status code. Maybe try using the latest ATOOL instead of NBHEDITOR?

I have nothing new yet, so maybe I can suggest this: try using the latest DZO kernel, but configure it the same way you configured my experimental kernels: put 1350 into advanced settings. Does that seem to be accurate, and an improvement over what you have in the beginning?

Also, I'd really like to get the temperature reading to work. Anybody who has a digital multimeter can help. The battery has four contacts. The outer two are marked + and -. The inner two are unmarked, but from my reading it seems that one goes to a battery ID resistor and the other goes to a thermistor, each tied to ground (-).

I haven't found much information on what the battery ID values mean. Wouldn't it be nice if each size battery had a different resistance, so we could automate the battery_capacity value? Yet it probably just differentiates battery chemistries. In that case it would be of no value to us.

The thermistor, on the other hand, readily leads to a temperature reading.

Measure between each of the middle connectors and the "-" connector.

On my questionable 6 month old 1600 mAh battery, I get these resistance values at room temperature:

1) +

2) 99.7 k-Ohm

3) 3.912 k-Ohm

4) -

I'd like to get anybody's measurement, plus what is the rated capacity and approximate age of the battery?
[Tilt, TyTN II, MDA Vario III Android Development] TuoNonno:
... I can't understand... am I the only bastard with a kaiser seeing the battery go smoothly from 100% to 1% or am I missing the point of this 3d?

EDIT: incubus' froyo on nand with 2.6.32 kernel from dzo site
[Tilt, TyTN II, MDA Vario III Android Development] l1q1d:
This thread is about modded version by n2rjt. If you want to test it flash the image in the first thread.
[Tilt, TyTN II, MDA Vario III Android Development] TuoNonno:
this is what I don't understand, why mod a kernel if it already works? (except of the temperature sensor) Oo
[Tilt, TyTN II, MDA Vario III Android Development] n2rjt:
Many of us see battery go smoothly from 100 to 75 or 70 then instantly jump to 5. On charging we see battery go up to maybe 30 then instantly jjump to 100. You can help us! Please tell what your rated battery capacity is and how do you configure your NBH .. what number do you put in the editor?
[Tilt, TyTN II, MDA Vario III Android Development] highcoder:
@ TouNonno

Yeah it seems that you are the only one who have a smooth runnin batterymeter on android. So whould you post more system details and how exactly did you install your android? May be there are a special difference between your way/system and our´s.

@ n2rjt

First i´m glad about to see that you working on that battery issue. I have a Kaiser 130 with radio 1.71.09.01. <- maybe the radio is important? I´m using Myn´s Warm Donut because that is the fastest Android on Kaiser with smooth animations. But i use an older Kernel (the last DZO Eclair Kernel) because the newer froyo kernels cause laggy animations. It looks like a low framerate. But that´s another thing... so here are my Battery details:

I have a 3,7V Li-Polymer Battery with 1500mAh that is about one year old.

1) +

2) 90,8 kOhm

3) 3.811 kOhm

4) -

best regards
[Tilt, TyTN II, MDA Vario III Android Development] TuoNonno:
Let me explain to you everything I did:

I bought this kaiser (kais 160) with in mind the idea of install android about a month ago.

The device is 2 years old and when I power it I found out that the guy who sold it to me already flashed a custom wm 6.5 rom from a xda user.

The first thing that I did when I went back home was installing the android kernel (2.6.32) and this -> http://xdaforums.com/showthread.php?t=715402 version of froyo.

Battery was not fully charged when I flashed the kernel and installed android.

I used the phone almost 5/6 hours learning how android works and I found out that battery continues to show me 100% charge but suddently the phone rebooted and on the next boot he started saying that battery was below 15%.

I then flashed back to winmo because my battery didn't start to charge. Even if the battery meter was saying 15% the recharge led still was green.

I let winmo charge the battery to 100% and then reflashed android kernel (2.6.32) but this time I've installed incubus' froyo.

From that time I have the battery meter works correctly.

When I read your 3d, some days ago, I've flashed back to winmo, let the phone discharge to 70% and then reflashed to andoid and... guess what? Battery meter was totally messed up.

I then flashed winmo, let the phone recharge totally, reflashed android and until now the battery meter is ok, phone charge and discharge smoothly.

Kaiser specs:

Incubus' froyo RLS15 with 2.6.32 kernel (kaiser,froyo,panel3,qwertz)

battery: dynapack kais 160 3,7 vDC 1350 mAh

radio 1.70.xxx

I don't know if this is the stock battery, but Below "Rating: 3,7 vDC --- 1350 mAh" there is another voltage saying "-Japanese ideograms- : 4,2 VDC".

Hope this helps
[Tilt, TyTN II, MDA Vario III Android Development] n2rjt:
Thank you for the details. Yes, that helps. Two follow-up questions:

When you discharged to 70% and switched to WinMo, you said the battery indicator was messed up. Did it say empty, 40%, or what?

When you flash a Linux kernel for Android, do you use nbheditor to change the battery capacity? I am guessing that you do not.

I've been switching back and forth between WinMo and Android for the past few days, and I have learned a few things and am guessing many more. More analysis is needed, but...

WinMo does calibrate the battery setting on a full charge. When the battery is fully charged, WinMo puts 2700 mAh as the capacity, which is the same as the default value in DZO's kernels, but twice the actual capacity.

When Android says 15% (which is really calculated as 5% or less and displayed as 15%), WinMo thinks the battery is too low to continue running without a charge.

I found a WinMo battery meter (batty) that displays the temperature, and the value changes over time. Unfortunately, I can't see the corresponding ds2746 values in WinMo.

In WinMo, my battery stays cooler than in Android, both when charging and when operating.

I wonder if perhaps WinMo writes to one or both of the bias registers as well, or if they maybe use a RSNS value of 20 instead of 10. If I can find a WinMo battery meter that displays charge in mAh, that might answer the question of why it uses 2700 capacity instead of 1350.

I have actually been rebooting and flashing so often that I have moved my SIM card to one of my old HTC Wizards. That old phone was a lot of fun and is still quite reliable: it brings back happy memories.
[Tilt, TyTN II, MDA Vario III Android Development] TuoNonno:
1) battery meter said me 100% and was like that till the phone said me that I was below 15%

2) I've changed the kernel with nbheditor to fit my keyboard and screen, I've no changed other options.
[Tilt, TyTN II, MDA Vario III Android Development] n2rjt:
After testing with WinMo

I spent the weekend between WinMo and Android, comparing battery levels under various conditions. I learned that WinMo calibrates when the battery seems full, then lets the accumulator units continue to rise as the battery gets topped off. Also, by comparing current (mA) values, I discovered that WinMo uses an RSNS value of 20.

The third attempt uploaded changes RSNS from 10 to 20, and in general models the WinMo behavior more closely. I will continue testing, but I believe this time it is ready to be used by more people. However, anyone who uses a kernel based on these changes needs to be sure to configure the battery capacity to rated mAh value, not rated * 1.6 as has been the practice before.

I removed the zImage from the zip file, since 2.6.32 doesn't work well with HARET, as far as I could tell. If anyone wants, I can perhaps build an old kernel with these changes, or perhaps liqid will do so.

I have become convinced that my battery does not have a thermistor. Even in WinMo, whether the phone is very warm or very cool, the temperature displayed is always between 25.1C and 25.4C. I can't make progress on the temperature reading until I replace this apparently counterfeit battery.
[Tilt, TyTN II, MDA Vario III Android Development] l1q1d:
If you succed in your proposal i can prepare the backport for 2.6.25

in 2.6.32 we need to fix nand instability :-(
[Tilt, TyTN II, MDA Vario III Android Development] n2rjt:
Attempt 3 has a problem calibrating at full. Please wait for attempt 4. Sorry about that. It wil be available soon.
[Tilt, TyTN II, MDA Vario III Android Development] 79bass:
Yes.. attempt 3 is far better then attempt 2...as I can see in a couple of hours.

NAND instability would be almost solved when the system stop to lose power when it believe to have still 90% of battery...but would go from 100 to 1% and than shutdown by itself.

Anyway, the corruption it's just for the data partition, that is around 120 Mb or so.

We should try to modify tinboot and the kernel to use jffs2 in /data. With a so small partition it should still be usable this fs, and maybe it wuold "solve" our issue.

Or maybe not :P

bye
[Tilt, TyTN II, MDA Vario III Android Development] n2rjt:
Try attempt 3 again ... should be better now.

I had it working smoothly yesterday, and intended to delete all of the test and debug code that wasn't necessary. I deleted one thing too much.
[Tilt, TyTN II, MDA Vario III Android Development] n2rjt:
My workaround for NAND instability is data on sdcard partition.

That also makes it easier to switch between WinMo and Android, but I hope I don't have to do that much longer.
[Tilt, TyTN II, MDA Vario III Android Development] highcoder:
Hi n2rjt.

I´ve tried TuoNonno`s installation procedure. I flashed a WinMo version and did a full charge. Then i installed Myn´s Warm Donut with the last Eclair Kernel from DZO (02.Jul.2010) which i edited with "atools". Kaiser, 240x320, Donut, Panel 1, Quertz, and i put 1500 (for my 1500 mAh Battery) into SIMPLE SETTINGS, not into ADVANCED as you wrote yet. So far so good...

On first boot with the full charged battery i had 100% on Android. 1 hour later it directly jump from 97% to 15%, but i could use the phone 20 more hours before it shutdown... no it isn´t a shutdown... it is a hard powerdown. Ok... time to recharge. So i boot up an plug the charger in but wth?!? It shows 99%... 30 seconds later 100% and green LED. That was stranger then before. So i decided to install "os-monitor" to read the ds2746 value...

I saw the voltage in mV, the current (+486mA), 110/100, charging status, and a very high unit value over 4380 (new for me). But now the strange: when the charging current fall under 200mA the units switch to 3200 and stay there! (tested twice).

If you unplug the charger (negative current value) this units fall directly under 3200...

So now i have some questions because i´m more confused than before:

1.) Why we have to put in the mAh and what does it change? In WinMo you don´t have to...

2.) What kind of value are the "units"?

3.) Why this unit jump from over 4000 to 3200 when the charging current runs under 200mA?

Now ds2746 says: 4196mV, +50mA charging current only, 100/100, 3200 units, so i think its time for the next discharge...

i will report...

kind regards
[Tilt, TyTN II, MDA Vario III Android Development] n2rjt:
What kernel did you use when you had 3200 units?

I've been running attempt 3a since morning, battery drain has been very slow. Its 71 percent now. I'm expecting a quick jjump to 5, in my pessimism.
[Tilt, TyTN II, MDA Vario III Android Development] highcoder:
I don´t use your mod because i whould test TuoNonno´s procedure with full charge under Windows Mobile before flashing android. As i wrote in my last post...

now i do a fast discharge (display always on) to see if i have a smooth downcounting batterymeter. but i have a jump from 75 to 15 percent.

dmesg says 3323mV, -375 mA, 75/100, 2411 units before jump

and 3276mV, -424mA, 15/100, 147 units after jump

you can have the dmesg-log if you want.

maybe it hast something to do with a consumption peak? because before jump the discharge-current was below 400mA (between 325-375mA) and 424mA at jump...

hmm...
[Tilt, TyTN II, MDA Vario III Android Development] n2rjt:
As part of attempt #3, I changed the KAISER_RSNS from 10 to 20, thinking that by doing so, I would get twice the units for the same mAh, and therefore get values that agree with WinMo. Sorry, that was not smart.

The dmesg units do not change as any function of board-kaiser-battery.c conversions. The dmesg units are the INPUT, not the output. So, by doubling RSNS, we don't double the units, but merely cut the "mAh" value in half, guaranteeing a big jump. Silly me.

If you can build the kernel from source, you should edit it, changing KAISER_RSNS back to 10. With that change, attempt #3 is reasonably good in a NAND phone. I am still stumped by what WinMo changes so that the units get doubled. For good HARET performance, we do want the linux battery meter to act as much as possible like the WinMo version.

I'll do more testing this evening.
[Tilt, TyTN II, MDA Vario III Android Development] n2rjt:
Attempt #4

Attempt #4 posted. It is attempt #3a with RSNS=10, and just a little clean up.
[Tilt, TyTN II, MDA Vario III Android Development] elander:
will attemp #4 remember the settings after a reboot?, cuz #02 didn´t.
[Tilt, TyTN II, MDA Vario III Android Development] n2rjt:
If you see dmesg telling you a mAh capacity different from what you configured, that is not remembered across reboots. Until it is, best to learn what number your battery ends up with and start configuring your kernels with that value. We can do better, but first I want to get the meter working smoothly for all.
[Tilt, TyTN II, MDA Vario III Android Development] n2rjt:
Getting a new battery.

I ran attempt #4 starting last night. I charged it fully overnight, then let it drain starting at 7:30 AM. At 1:00 PM it rebooted without warning about low battery, the last indicator said 30%. Looks like some adjustment of the low battery voltage threshold is in order.

I then fully charged the battery, then installed WinMo, who said battery was 30%.

Then I let Windows charge the battery. It climbed from 30% to 50%, then instantly jumped to 100%. A quick dip into Android showed me the units that would scale to 2700 mAh, which is definitely wrong. I went back to WinMo, charged until leaving work at 5:00. Now, at 6:30, phone says 34%, and I have done nothing with it other than take two phone calls.

I have realized that it is folly to try to fix the software, when I am testing with a battery that is either counterfeit or very messed up. So, I am ordering a stock 1350 mAh battery, and won't be putting out any more attempts until after the new battery arrives.

Still, if anyone is brave enough to try attempt #4, please let me know what you think. And if anyone can provide any clues on how to interpret aux0,aux1 readings, we would all appreciate that as well.

I'll be back...
[Tilt, TyTN II, MDA Vario III Android Development] n2rjt:
Back with a new 1350 mAh battery with working thermistor.

Now that I have two batteries, I'm trying out a way to switch batteries without totally confusing the meter. Seems impossible, but WinMo does it nicely.
[Tilt, TyTN II, MDA Vario III Android Development] scooter1556:
Hello n2jrt,

not sure what happened to my post the other day, i went to follow your instructions so i could get you a dmesg report but the post had gone. I tried putting in a value of 1336 into the advanced settings of NBH Editor because that is the value it was reaching when charging and only getting to 98% but now it is only reaching a value of 1322 and still only reaching 98% when charging. It has now been on 1322 mAH for a day and hasn't moved from 98% on a clean install of froyo with your attempt 4. This is on a Kaiser with a stock 1350mAH battery. If you can post the instructions i'll get you a log from dmesg.
[Tilt, TyTN II, MDA Vario III Android Development] n2rjt:
Sorry, xda-developers lost some of our posts. I had posted a way to collect a dmesg log by using a terminal emulator and typing "dmesg > /sdcard/dmesg.log" or something like that. There is an easier way...

The easiest way to collect a dmesg log is to install the OSMonitor app from the market. Then, run it, hit the menu key, and under Options make sure "View Log" has dmesg selected. Then go to the "Message" tab, and see the dmesg output. To save to a file, use the menu key to select "Export Log", then enter a file name. The file will be written to /sdcard.

I think I know what is happening to you and others who report a maximum charge less than 100%. Stay tuned for a fix.

I am also testing a kludge that makes a crude guess at battery capacity when you change batteries. The cure may be worse than the disease. Perhaps the best solution is a change to initrd to allow setting a battery level.
[Tilt, TyTN II, MDA Vario III Android Development] l1q1d:
It's not a big problem change the initrd but i need a place where i can extract the info (writeble like nand or sd), so we need to save info on shutdown.