Ich habe hier eine Formel gefunden die die Spannung an einem Li-Ion Akku in Prozent umrechnen will. Sie stammt aus dem Odroid Go, ein ESP32 basierter Gameboy-Klon. Ist sowas einigermaßen universell, oder funktioniert das jetzt so nur mit genau diesem Akku? Der Akku ist so eine typische "Plastiktasche". Die Formel ist hier: https://github.com/hardkernel/ODROID-GO/blob/master/src/utility/battery.cpp Herauskopiert:
1 | #define BATTERY_VMAX 420
|
2 | #define BATTERY_VMIN 330
|
3 | |
4 | int Battery::getPercentage() { |
5 | int res = 101 - (101 / pow(1 + pow(1.33 * ((int)(getVoltage() * 100) - BATTERY_VMIN)/(BATTERY_VMAX - BATTERY_VMIN), 4.5), 3)); |
6 | |
7 | if(res >= 100) |
8 | res = 100; |
9 | |
10 | return res; |
11 | }
|
Ich habe die Formal mal in gnuplot geworfen:
1 | gnuplot> set xrange [3300:4200] |
2 | gnuplot> plot 101 - (101 / ((1 + ((1.33 * (x - 3300) / (4200 - 3300)) ** 4.5)) ** 3)) |
Screenshot ist angehängt.