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


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


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;

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.


Sorry to revive this, but I’m curious about the conversions for V2 brains. They want to have a function that alerts you if the battery goes under 7.4 volts at any time like the blinking red does for the 6.0 level. Are the conversions the same?


It’s essentially the same.
The issue we have is that there is no way to detect a gen2 battery from an older gen1 battery. Gen2 batteries have a much flatter discharge curve, voltage will drop quickly during perhaps last 15% of capacity. We could have tried to add some fancy code looking at voltage over time, but in the end we just decided to keep it simple and do what we did in gen1.

// full range 6400mV to 8200mV
int32_t percent = (volts - 6400) / 18;
// limit to 5% increments
percent = (percent / 5) * 5;
if( percent >  95 ) percent = 100;
if( percent <   5 ) percent = 5;