VEX IQ Battery percentage to volts

We can get Battery percentage in Blocks but does anyone know how that converts to volts?

0% is 6V or less.
100% 8V or above

2 Likes

I guess I could experiment to find out, but is it linear between the two? 50% is 7V? 75% is 7.5V?

Thanks!

1 Like

All we know about the IQ battery is voltage, there is a direct sdk call for that, but the blocks team chose to expose capacity which IMHO is sort of useless unless used very superficially. The relatioship is linear, the code looks like this (volts is a float)

    int16_t capacity = 100 * (volts - 6) / 2;
    
    if( capacity <   0 ) capacity = 0;
    if( capacity > 100 ) capacity = 100;
6 Likes

One last question… Is the percentage in “device info” calculated the same way?

Thanks for all the insights!

1 Like

Hm, actually no, written some years apart by different developers.
The brain screen uses 6.3V and 8.2V as the thresholds, still linear though, I should probably adjust the sdk so they are both the same.

4 Likes