1. Home
  2. Docs
  4. Polaris Manual
  5. Main Connector
  6. Detecting Supply Voltage

Detecting Supply Voltage

The power supply voltage on the Main connector is detected with a circuit similar to one of the analog inputs with high range settings, after the reverse polarity protection diode:

Here is an example Arduino sketch that reads the main supply voltage. The diode voltage drop is estimated to be 0.25 Volts, which is fine for low current in the idle state, but may vary with higher current consumption:

void setup() {
  // Open and wait serial terminal
  while (!Serial);
  // Set ADC resolution

void loop() {
  // Read analog channel and convert to external voltage
  float vin = analogRead(AIN_S_INLEVEL) * ANALOG_SCALE * ANALOG_VREF / 4095.0f + 0.25f;
  Serial.print("VEXT (V): ");

The same example with Zerynth:

from fortebit.polaris import polaris


while True:
    print("VEXT (V):", polaris.readMainVoltage())

How can we help?