Working Principle
The INA219 and INA226 from Texas Instruments are high-side current and power monitors with an integrated 12-bit (INA219) or 16-bit (INA226) ADC. They measure the voltage drop across a small shunt resistor (typically 0.1 Ω) placed in the high-side (V+ rail) of the circuit. Ohm’s law converts this voltage to current: I = Vshunt / Rshunt. The chip also measures bus voltage, computing power (P = V × I) internally.
Why high-side? Measuring on the positive rail avoids disturbing the ground reference, allowing accurate monitoring of power consumption without affecting the circuit’s ground plane.
Electrical Characteristics
| Parameter | INA219 | INA226 |
|---|---|---|
| ADC Resolution | 12-bit | 16-bit |
| Bus Voltage Range | 0–26 V | 0–36 V |
| Shunt Voltage Range | ±320 mV (default) | ±81.92 mV |
| Current Resolution | 0.1 mA (0.1 Ω shunt) | ~1.25 µA (0.1 Ω) |
| Supply Voltage | 3–5.5 V | 2.7–5.5 V |
| Interface | I2C (4 address options) | I2C (16 address options) |
| Power Calculation | On-chip (V × I) | On-chip (V × I) |
| Alert Pin | No | Yes (configurable threshold) |
Interfacing with an MCU
Connect VCC, GND, SDA, SCL for I2C communication. Wire the shunt resistor in series with the load on the V+ rail, then connect Vin+ and Vin- to each side of the shunt. The INA219 default I2C address is 0x40; address pins A0/A1 select from 4 (INA219) or 16 (INA226) options.
Calibration
- Calibration register: Set based on shunt resistance and max expected current. Libraries calculate this automatically.
- Shunt resistor: Choose Rshunt so max current produces <320 mV drop (INA219) or <81.92 mV (INA226)
- Averaging: INA226 supports hardware averaging (1–1024 samples) for noise-free readings
- Zero offset: Read with no load to measure offset; subtract from all measurements
Code Example
/*
* INA219 Current & Power Monitor — Arduino
* Library: Adafruit INA219 (install via Library Manager)
* Wiring: VCC → 5V, GND → GND, SDA → A4, SCL → A5
* Vin+ → V+ rail, Vin- → Load (0.1Ω shunt between)
*/
#include <Wire.h>
#include <Adafruit_INA219.h>
Adafruit_INA219 ina219;
void setup() {
Serial.begin(9600);
if (!ina219.begin()) {
Serial.println("INA219 not found!");
while (1);
}
ina219.setCalibration_32V_1A(); /* 0.1 Ω shunt, 1A max */
Serial.println("INA219 Ready");
}
void loop() {
float busV = ina219.getBusVoltage_V();
float shuntmV = ina219.getShuntVoltage_mV();
float current = ina219.getCurrent_mA();
float power = ina219.getPower_mW();
Serial.print("Bus: ");
Serial.print(busV, 2);
Serial.print(" V Current: ");
Serial.print(current, 1);
Serial.print(" mA Power: ");
Serial.print(power, 1);
Serial.println(" mW");
delay(1000);
}
Real-World Applications
Battery Management & Energy Profiling
INA219/INA226 are essential in battery-powered IoT devices for tracking state-of-charge via coulomb counting (integrating current over time). Solar charge controllers, USB power delivery monitors, server rack power metering, and embedded system energy profiling all rely on precision current monitoring. The INA226’s 16-bit resolution enables µA-level sleep current measurement.
Limitations
- Shunt resistor heat: At high currents, the shunt dissipates P = I²R power; size the resistor for thermal handling.
- Voltage drop: The shunt introduces a voltage drop in the supply rail; minimize Rshunt for low-voltage circuits.
- No galvanic isolation: The sensor shares ground with the measured circuit; not suitable for mains AC monitoring.
- Sample rate: I2C read latency limits effective sample rate to ~1 kHz; not suitable for fast transient analysis.