Rockbox.org home
Downloads
Release release
Dev builds dev builds
Extras extras
themes themes
Documentation
Manual manual
Wiki wiki
Device Status device status
Support
Forums forums
Mailing lists mailing lists
IRC IRC
Development
Bugs bugs
Patches patches
Dev Guide dev guide
translations translations
Search



Donate

Rockbox Technical Forums


Login with username, password and session length
Home Help Search Staff List Login Register
News:

Thank You for your continued support and contributions!

+  Rockbox Technical Forums
|-+  Support and General Use
| |-+  Hardware
| | |-+  Does battery estimation take in account power settings
« previous next »
  • Print
Pages: [1]

Author Topic: Does battery estimation take in account power settings  (Read 163 times)

Offline questions2000

  • Member
  • *
  • Posts: 37
Does battery estimation take in account power settings
« on: April 21, 2025, 08:57:56 PM »
iPod / Linux
I apologize I know this is an issue with iPods but not sure if other devices experience this as well.

I have read in the RB iPod manual that RB developers have mentioned there have been difficulties figuring out how to accurately display the battery percentage, so that at the moment battery percentage is based on an estimation until a better method is figured out.
I look at the work being done by RB developers as amazing, so I can imagine that the battery must really be something difficult to accurately read/access.  I wonder how the Apple firmware accesses the battery to generate a value.  Although I do not remember them showing an actual percentage, just a picture of a battery so hard to say how accurate they were either?

Estimation also makes it a little difficult to get an idea of how efficient RB is compared to Apple firmware as far as power consumption.

Which brings me to my question about the estimation.
It can also be a little difficult to know how much battery life is really available, so I was wondering if anyone knew if any of the other power settings are taken into account when it comes to the estimation.

So as far as I know, the estimation is based on what "Battery Capacity" setting is choosen, for example 550mAh.

Does anyone know if any of the following settings are taken into account by the battery estimation?
-Backlight = Off
-Display = Sleep when Backlight is Off
-Brightness = Lower values
-Accessory Power Supply = Off
etc.

Meaning for example does turning "off" backlight completely alter the battery estimation shown in the battery meter?
Or is the estaimation a static setting based only on the size battery choosen in the "Battery Capacity" setting section?

Thank you for any information offered.
Logged

Offline saratoga

  • Developer
  • Member
  • *
  • Posts: 9370
Re: Does battery estimation take in account power settings
« Reply #1 on: April 21, 2025, 09:03:13 PM »
Are you asking about the battery state of charge or the runtime estimation (hours remaining)? Battery state of charge is by measuring the battery voltage. Runtime estimation is the battery state of charge times battery capacity in mah divided by the run current for the device.
Logged

Offline Bilgus

  • Developer
  • Member
  • *
  • Posts: 1192
Re: Does battery estimation take in account power settings
« Reply #2 on: April 24, 2025, 09:50:39 AM »
We have a way to import battery levels for the end user now

First time you run battery bench the current battery levels will be exported as
Code: [Select]
battery_levels.default
Set your device up as you normally use it and set a playlist to play on repeat with the same formats of the songs you generally listen to (mp3 flac etc)

now run battery bench till the device dies (maybe do this several times and average the results to get really precise)

now alter
Code: [Select]
battery_levels.default with your new voltage values and rename it to
Code: [Select]
battery_levels.cfg
https://www.rockbox.org/wiki/PluginBatteryBenchmark.html

an example of the defaults from my clip zip:
Code: [Select]
# Rename to /.rockbox/battery_levels.cfg
# Sandisk Sansa Zip Battery Levels (f93982349bM-250112)

# Battery voltage (millivolt) lower than this won't access the disk to write
disksafe = 3400

# Battery voltage (millivolt) lower than this player will shutdown
shutoff = 3300

# Battery voltage (millivolt) of 0%, 10%, ... 100% when charging disabled
discharge = { 3300, 3653, 3701, 3735, 3768, 3790, 3833, 3900, 3966, 4056, 4140 }

# Battery voltage (millivolt) of 0%, 10%, ... 100% when charging enabled
charge = { 3427, 3786, 3842, 3877, 3896, 3924, 3971, 4028, 4084, 4161, 4190 }

I wouldn't mess with the disksafe level if you are NOT using solid state storage

Also you shouldn't change shutoff unless you know what you are doing and the underlying battery chemistry,
as most devices will still shutoff anyway and the ones that don't will likely damage the battery if you set it too low.


basically you will take your battery bench results and map them to the 0-100 of the battery level to get a more accurate display of battery capacity
https://download.rockbox.org/daily/manual/rockbox-ipod6g/rockbox-buildch12.html#x19-33600012.4.2
« Last Edit: April 24, 2025, 10:04:38 AM by Bilgus »
Logged

Offline questions2000

  • Member
  • *
  • Posts: 37
Re: Does battery estimation take in account power settings
« Reply #3 on: May 07, 2025, 08:58:55 PM »
Thank you guys for these replies.
I am still interested in the question, just need a minute.
I typed out a long response and then realized there was a new reply :)
Logged

Offline questions2000

  • Member
  • *
  • Posts: 37
Re: Does battery estimation take in account power settings
« Reply #4 on: May 18, 2025, 06:25:41 PM »
@Bilgus
Again another great post with great information, I was not aware that there was a solution for iPod batteries.
Thank you for this

I have not tried this out yet.
I was not expecting this question to lead to something that would need to be tested.
I have to pick the right time to perform this test.
Right now have been have been trying to figure out some things about themes.
Then I have to make sure to apply any settings desired and start with fresh setup.
This way can get as accurate of a result as possible.
Logged

Offline questions2000

  • Member
  • *
  • Posts: 37
Re: Does battery estimation take in account power settings
« Reply #5 on: May 18, 2025, 06:28:49 PM »
(Might not be worth reading)
I mentioned above that I had already typed out a post before realizing that there was another reply with these instructions.
Because already typed, I figured I might as well post, still some info that would be good to know.

@saratoga / anyone else interested
Thank you for reply.
Sorry I did not realize there were two different indicators available, all the themes I have tested I believe just have shown the "battery state of charge" based on your description.  So this is the battery indication that I was referencing in my question, so now my question probably does not make as much sense because I guess it was more based on "runtime estimation" rather than "battery state of charge"
Also apologize the following reply is going to be a bunch of random information I have come across.

IPOD FIRMWARE
I imagine this is similar what the orginal iPod firmware uses for battery indication, which was just a picture of battery outline with a fill inside giving a general indication of how much power currently available, but this was not very accurate (in my opinion) just a visual.

3RD PARTY THEME BATTERY METER
However the theme I was testing not only includes battery graphic meter, but it also includes an actual number percentage value, for example "85%".  To me this is more of a helpful indication (if it is accurate).

Here are some items I narrowed down from that theme regarding the battery
Code: [Select]
# Numeric Power %
%V(164,168,38,10,0)%Vf(cccccc)%Vb(000000)
%ac%bl%%
Code: [Select]
%xl(B,batt.bmp,0,0,9)
%V(164,186,44,47,-)
%t(1)%?bp<%?bc<%xd(Bh)|%xd(Bi)>|%?bl<||%xd(Ba)|%xd(Bb)|%xd(Bc)|%xd(Bd)|%xd(Be)|%xd(Bf)|%xd(Bg)|%xd(Bg)>>;%t(1)%?bp<%?bc<%xd(Bg)|%xd(Bi)>|%?bl<||%xd(Ba)|%xd(Bb)|%xd(Bc)|%xd(Bd)|%xd(Be)|%xd(Bf)|%xd(Bg)|%xd(Bg)>>

I thought it was the following variable mentioned in the manual
%bv The battery level in volts
but I think it is using this variable instead
%bl

also here is the estimation variable you had mentioned, I do not see this one in the themes code
%bt Estimated battery time left
I would be curious to see how this variable displays / how accurate this would be.
Wonder if this one would be more informative then the volt percentage.

QUESTION 1
Does anyone know how accurate the
%bv The battery level in volts
and or the
%bl
are?

(I might be looking at this incorrectly also? not that familiar with how voltage works, anyways)
Reason I ask this is because the battery power value ##% shown in theme seems to adjust in both directions often.
I would imagine it would just keep going lower show less of a value, but on occassion I have noticed the value also going up as if the battery is magically being charged :)

------------------------------------------------------------------------------------

QUESTION 2
Might as well ask this again then just for curiosity.
Lets say user/theme uses this variable which is "runtime estimation"
%bt Estimated battery time left

So as far as I know, the estimation is based on what "Battery Capacity" setting is choosen, for example 550mAh.

Does anyone know if any of the following settings are taken into account by the "runtime estimation"?
-Backlight = Off
-Display = Sleep when Backlight is Off
-Brightness = Lower values
-Accessory Power Supply = Off
etc.

Meaning for example does turning "off" backlight completely alter the battery estimation shown in the battery meter?
Or is the estimation a static setting based only on the size battery choosen in the "Battery Capacity" setting section?

Or is it just exactly what developer saratoga has mentioned
Runtime estimation is the battery state of charge times battery capacity in mah divided by the run current for the device.

Thank You to anyone who reads all of this.
Logged

Offline speachy

  • Administrator
  • Member
  • *
  • Posts: 657
Re: Does battery estimation take in account power settings
« Reply #6 on: May 18, 2025, 07:06:28 PM »
Quote from: questions2000 on May 18, 2025, 06:28:49 PM
QUESTION 1
Does anyone know how accurate the
%bv The battery level in volts
and or the
%bl
are?

I would imagine it would just keep going lower show less of a value, but on occassion I have noticed the value also going up as if the battery is magically being charged :)

%bv is what the hardware reports.  %bl is computed by first looking up the voltage in a table, and linearly interpolating.
(Note there are exceptions here; some hardware with a "smart" PMIC only reports the battery percentage instead of a voltage)

The reason you see it go back up sometimes is that the measured battery voltage is affected by the load on said battery.  Spinning up the hard drive is particularly heavy; this is why rockbox has a "critical battery level" threshold under which it won't try to spin up the storage (eg to save playback state) as that could corrupt data or crash the device outright.

Quote from: questions2000 on May 18, 2025, 06:28:49 PM
QUESTION 2

So as far as I know, the estimation is based on what "Battery Capacity" setting is choosen, for example 550mAh.
Runtime estimation is the battery state of charge times battery capacity in mah divided by the run current for the device.

Runtime estimation is just that, an estimation.  It takes the configured battery capacity and percentage level to compute a "X mAh remaining" value.  It then divides that by the estimated power consumption *at that exact time* (ie does not try to do any sort of usage pattern analysis).  What goes into this consumption estimate depends on the individual device, but typically takes into account: (a) the baseline idle power consumption, (b) if the display is on, and (c) if the storage device is active.  The power consumption numbers for each of those situations can vary widely in accuracy; they may be taken from datasheets, measured carefully in a controlled setting, simply guessed at, or in some cases, supplied by the hardware in realtime. 

This can be made as fine-grained as one would like, it's just a matter of carefully measuring the current in isolation.

Further details can be found in firmware/powermgmt.c, in the battery_current() function.
Logged

  • Print
Pages: [1]
« previous next »
+  Rockbox Technical Forums
|-+  Support and General Use
| |-+  Hardware
| | |-+  Does battery estimation take in account power settings
 

  • SMF 2.0.19 | SMF © 2021, Simple Machines
  • Rockbox Privacy Policy
  • XHTML
  • RSS
  • WAP2

Page created in 0.068 seconds with 22 queries.