Measuring Current Draw with the INA219

The INA219 is a precision I²C-enabled current sensor that can measure both voltage and current across a shunt resistor. It is useful in power profiling for microcontrollers and battery-powered systems.

Key Features

Typical Wiring

Place the sensor in series with the load:

Arduino Code Example

#include <Wire.h>
#include <Adafruit_INA219.h>

Adafruit_INA219 ina219;

void setup() {
  Serial.begin(9600);
  if (!ina219.begin()) {
    Serial.println("Failed to find INA219 chip");
    while (1) { delay(10); }
  }
}

void loop() {
  float busVoltage = ina219.getBusVoltage_V();
  float current_mA = ina219.getCurrent_mA();
  float power_mW   = ina219.getPower_mW();

  Serial.print("Voltage: "); Serial.print(busVoltage); Serial.println(" V");
  Serial.print("Current: "); Serial.print(current_mA); Serial.println(" mA");
  Serial.print("Power:   "); Serial.print(power_mW);   Serial.println(" mW");
  delay(1000);
}
  

Use Cases

← Back to Notes