[SOLVED] How do GoPiGo3 Analog Digital Ports Work?

How do GoPiGo3 Analog Digital Ports (connector) Work?

Follow-up questions:

  • If configured for analog, can I measure a single voltage input or two?
  • Analog: What is the reference voltage, min and max voltage?

(I want to measure the battery voltage, using r1.r2 divider as appropriate, and measure battery current using an ACS712 sensor which outputs an analog variance from 2.5v.)

Answering my own question - hopefully also for others.

From the GoPiGo3 Documentation

The Grove Analog Digital Ports have two “signal pins” but only one may be active at a time. The “outside” pin is the default and is “pin 1”. The “user derived analog sensor” can be pointed at the other pin (after sensor instantiation) using the set_pin() call with any value other than 1.

The reference voltage is 5v, the min is 0, the max is 5v and the ADC is 12bit.

Battery voltage is available native to the GoPiGo3 using the volt() API, returning a float value. (Precision and accuracy are not stated in the doc.)

Note - On my current bot, I monitor the battery voltage and perform a “estimated 15 minutes left” safety shutdown after four consecutive readings below 1.08v per cell or 8.6v for an 8-cell NiMH configuration.