Skip to content

getShuntMicroVolts()

Arnd edited this page Dec 12, 2020 · 3 revisions

getShuntMicroVolts([deviceNumber]);

This function returns the shunt voltage in microvolts of the specified "deviceNumber" device, defaulting to device 0 when the parameter is not specified. Each INA2xx has a defined LSB for shunt accuracy, typically 2.5 μV. The shunt voltage is returned as a signed 32-bit integer so that the full range is capable of being stored. If the system mode is set to triggered measurements rather than continuous ones (see setMode() for details) then the next measurement cycle is triggered by this read.

This value is directly read from the INA2xx registers and is not affected by the settings for calibration given in the begin() function call.


Example:

INA_Class INA(); // Instantiate the class
void setup() {
  uint8_t deviceCount = INA.begin(10,100000); // 10 Amp Maximum bus with a shunt resistor of 0.1 Ohm
  Serial.print("Found ");
  Serial.print(deviceCount); 
  Serial.print(" INA2xx devices, displaying data for device 0, a \"");
  Serial.print(INA.getDeviceName());
  Serial.println("\".");
} // of setup
void loop() {
  uint32_t ShuntMicroVolts = INA.getShuntMicroVolts(); // wait for conversion on device 0 to complete
  Serial.print("Bus voltage is ");
  Serial.print((float)ShuntMicroVolts/1000,3);
  Serial.print(" mVolts\n");
  delay(5000); // wait 5 seconds before next measurement        
} // of main loop