Battery %


How do I show 0-100% of battery between to point of voltages?

I have 7S battery where I have mounted a BMS that only use 3,7 to 2,8 (7S 25,9 - 17,65v ) voltage on each cell. That’s is in total 32 % of the battery capacity. Now I want to show the 0-100 % between these voltage.? How do I do this?

7S = 25,9 voltage.

0-100 % between 25,9v and 17,65v


If you didn't have to code it, could you write the math for what you want? To get a percentage, you divide the part (the smaller voltage) by the whole (the full 100% voltage) and then multiply by 100.

Have a feeling the Op might be looking for "mapping" although the mapping reference in Arduino tend to warn against fractions.
Might be able to do with whole numbers and then divide down??

2590 1765 etc.

Map the value you get from the A/D to 0-100 with the map function.

Note that voltage is not a good indicator of battery charge.
You might have to use a coulomb counter.