Skip to content
My Account

Reference

INA219 / INA226 Voltage, Current and Power Sensor Complete Guide

The INA219 and INA226 measure voltage, current and power on a low-voltage DC bus over I2C, using a shunt resistor and Ohm's law, not the mains-AC energy-meter ICs this site already covers. This guide covers both chips' real specs, wiring one to an ESP32, and which to pick for a battery or power-budget project.

2 min read

No ratings yet, be the first.

The INA219 and INA226 are Texas Instruments current/power monitor ICs: they measure the tiny voltage drop across a shunt resistor in series with a DC load, then report current, bus voltage and power over I2C. This is a different job from the already-published BL0937/BL0942 energy-meter ICs on this site, those measure mains AC power for a smart plug, these measure low-voltage DC bus power, for example how much current a battery pack, solar panel or 3.3V/5V rail is actually drawing.

INA219 vs. INA226: real differences

INA219INA226
ADC resolution12-bit16-bit
Max current (with a 0.1Ω shunt, 3.2A range)3.2A (has a built-in PGA to boost sensitivity)0.8A (no PGA, use a smaller shunt for higher current)
Selectable I2C addresses4 (via 2 address pins)16 (via 2 address pins)
Default I2C address0x400x40

The INA219 handles higher current out of the box thanks to its programmable gain amplifier. The INA226 trades that for finer resolution and more selectable addresses, useful when monitoring several rails on one I2C bus. For most single-battery or single-rail hobby monitoring, either works, pick the INA219 if you’re already reaching for its very common Adafruit breakout, or the INA226 if you specifically need its extra resolution or address count.

Wiring to an ESP32

Both chips measure current by sitting in series with the load’s supply line, through the shunt resistor built into the breakout board.

PinFunctionESP32 Pin
VCCLogic power, 3V–5.5V3.3V
GNDGroundGND
SDAI2C dataGPIO21
SCLI2C clockGPIO22
VIN+ / VIN−Shunt terminals, wired in series with the load being measured— (power path, not logic)

Arduino code (Adafruit INA219 library)

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

Adafruit_INA219 ina219;

void setup() {
  Serial.begin(115200);
  Wire.begin(21, 22);
  if (!ina219.begin()) {
    Serial.println("Failed to find INA219");
    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("Bus 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);
}

Install “Adafruit INA219” via the Arduino Library Manager. For the INA226, there’s no official Adafruit library, the community RobTillaart/INA226 library is a well-maintained alternative with a similar API.

Practical Applications

  • Battery fuel gauging: track real current draw to estimate remaining runtime.
  • Solar panel monitoring: measure actual power output under real conditions.
  • Power-budget debugging: find which part of a project is drawing more current than expected.
  • Overcurrent protection logic: cut power in software if current exceeds a safe threshold.

Conclusion

The INA219 and INA226 give you real voltage/current/power visibility into a DC bus over I2C, complementing (not duplicating) the mains-AC BL0937/BL0942 guides already on this site. Either pairs cleanly with an ESP32 over I2C.

Advertisement

Related

All guides

More guides

Keep building.

From ESP32 HomeKit accessories to Arduino and ATtiny reference guides, there’s more where this came from.

All guides