What calculation is behind Dash.batteryPercentage()?


#1

I purchased a solar kit from Voltaic for my project. It has a slick ‘always on’ mode and is working great with the Dash. I am capturing data from Dash.batteryMillivolts and .batteryPercentage and sending to a thingspeak channel. What I want to understand is the percentage. I get readings above the 200 range. What calculation is that using?

The battery pack that comes with the kit has a 12000mAh battery, and I am using the 2nd USB output on it which is 5v, 2000mAh. I am wondering what batteryPercentage is based on and if I can estimate the battery pack charge from that.


#2

I don’t know the equation, but it most likely calculates the percentage as 0% around 3.7V or lower and 100% at 4.2V or higher.

The USB V44 battery from Voltaic outputs a regulated 5V from the USB ports, so whether empty or full it will read 5V. That will explain why it thinks the battery percentage is +100%, because what your library defines as 100% is for the raw lithium-ion battery which cannot get up to 5V on its own.

Using a regulated USB output is not a good way to read the battery percentage because if its 1% full or 99% full it will still show a regulated 5V output until it dies. If you want to get an exact reading, use a raw battery cell, not a complete powerbank with built-in regulator circuit.

Tony


#3

Thank, this is good info!

It is still fun to see the voltage go up (though only slightly) during sunlight hours :slight_smile: