Editing Mer/Documentation/BME Protocol

Warning: You are not logged in. Your IP address will be recorded in this page's edit history.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 1: Line 1:
-
{{Mer}}
+
This documentation is entirely for the purpose of implementing software gathering battery information on Nokia Internet Tablets, not alteration of battery management state.  
-
 
+
-
This documentation is entirely for the purpose of implementing software gathering battery information on Nokia Internet Tablets, not alteration of battery management state.
+
-
 
+
-
See [[Mer/Status/Battery | battery status]] for the current state of support for BME in Mer.
+
-
 
+
-
This information (other than the basic explanations of battery behaviour) is not applicable to the n900, which has a different protocol.
+
Existing code:
Existing code:
Line 99: Line 93:
</pre>
</pre>
-
The '''“Instantaneous battery voltage (mV)”''' field’s observed values have a certain regular spacing indicating a linear function of some integer value with a smaller range, presumably retu adc register #8.  If it is indeed from that register, then note there is a non-zero offset involved: one function that gives values consistent with the set of values observed and that somewhat matches one set of observations of both fields (which unfortunately had a non-negligible delay between sampling the two) is mV = 2252.362 + 2.81361 * adc#8 (where the multiplier is fairly accurate, while the constant is accurate to within 2 units in the last place; the choice of 2252.362 rather than some integer multiple of 2.81361 away from there is based on how well ioctl values match with values read from bme at about the same time, though there was still quite a bit of noise, and the methodology could be improved).
+
The '''“Instantaneous battery voltage (mV)”''' field’s observed values have a certain regular spacing indicating a linear function of some integer value with a smaller range, presumably retu adc register #8.  If it is indeed from that register, then note there is a non-zero offset involved: one function that gives values consistent with the set of values observed and that somewhat matches one set of observations of both fields (which unfortunately had a non-negligible delay between sampling the two) is mV = 2252.362 + 2.81361 * adc#8 (where the multiplier is fairly accurate, but the constant could be out by some multiple of 2.81361).  -- pjrm.
-
 
+
-
One might wonder how bme authors came up with numbers like 2252.362 and 2.81361One hypothesis would be that someone measured a voltage for two adc8 values (perhaps one near the top of the range and one near the bottom), and used a straight-line fit for the rest.  If the mV field is calculated by rounding to nearest int rather than flooring, and the two voltage measurements were both an integer number of mV, then there is exactly one pair of integer points that matches the data: adc8 of 238 was 3222mV, while 576 was 4173mV.  Thus, without yet having looked for other simple models, it seems most likely that this mV field is calculated by some expression equivalent to mV = 3222 + round((adc8 - 238) * ((4173 - 3222) / (576 - 238.))), i.e. mV = 3222 + round((adc8 - 238) * (951 / 338.)); where the rounding function can either be C99 round or floor(x+.5), or rint with some rounding modes, so long as 3697.5 rounds to 3698.
+
-
 
+
-
Accordingly, some uses of this “instantaneous voltage” field would do well to convert to an integer adc8 value (or convert to an integer adc8 value then convert back to a non-integer mV value), in order to avoid uneven steps between values (sometimes 2mV between neighbouring values and sometimes 3mV).  This can be done as adc8 = 238 + round((claimed_mV - 3222) * (338 / 951.)).
+
-
The '''“Battery monitor check voltage (mV)”''' field has similar values to the “Instantaneous battery voltage (mV)” field, but without obvious regular spacing.  I (pjrm) don't know how it's calculated.
+
The '''“Battery monitor check voltage (mV)”''' field has similar values to the “Instantaneous battery voltage (mV)” field, but without obvious regular spacing.  I don't know how it's calculated.  -- pjrm.
Voltage levels depend not just on amount of charge remaining in the battery, but also recent electrical load: the voltage level goes down markedly while the CPU is being heavily used, for example.
Voltage levels depend not just on amount of charge remaining in the battery, but also recent electrical load: the voltage level goes down markedly while the CPU is being heavily used, for example.

Learn more about Contributing to the wiki.


Please note that all contributions to maemo.org wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see maemo.org wiki:Copyrights for details). Do not submit copyrighted work without permission!


Cancel | Editing help (opens in new window)

Templates used on this page: