Electronics Design AU
Sensors

How Do You Use the INA219 and INA226 I2C Current-Sense ICs?

Last updated 29 June 2026 · 15 min read

Direct Answer

The INA219 (12-bit ADC, ±320 mV maximum shunt range, 0–26 V common-mode) and INA226 (16-bit ADC, fixed ±81.92 mV shunt range, 0–36 V common-mode) both require a Calibration register write before the Current register returns valid data. Calculate the calibration value from your shunt resistor and chosen current resolution: INA219: Cal = trunc(0.04096 / (Current_LSB × R_shunt)); INA226: Cal = trunc(0.00512 / (Current_LSB × R_shunt)), where Current_LSB is the desired resolution in A/bit and R_shunt is in ohms. Worked example — 10 mΩ shunt, 5 A maximum: Current_LSB = 5 / 32767 ≈ 153 µA = 0.000153 A; INA219 Cal = trunc(0.04096 / (0.000153 × 0.01)) = 26,763; INA226 Cal = trunc(0.00512 / (0.000153 × 0.01)) = 3,346. Write this to register 0x05 over I2C, then read register 0x04 (Current) as a signed 16-bit integer and multiply by Current_LSB. Use the INA219 when the current range is large and variable (programmable PGA adjusts the full-scale shunt input range from ±40 mV to ±320 mV); use the INA226 for higher resolution, programmable hardware averaging, or an ALERT interrupt for autonomous over-current protection.

Detailed Explanation

The INA219 and INA226 from Texas Instruments are the most widely deployed I2C current and power monitors in embedded designs. Both integrate a precision differential amplifier, high-resolution ADC, and I2C interface in a single IC, replacing what would otherwise require a discrete instrumentation amplifier, external ADC, and communication logic.

The fundamental operating principle is the same for both: the IC measures the small differential voltage across an external shunt resistor (V_SHUNT = I × R_SHUNT), converts it with the internal ADC, and reports the shunt voltage, bus voltage, calculated current, and calculated power through the I2C register interface.

For shunt resistor selection, high-side vs low-side placement, and Kelvin connection PCB layout, see measuring current with a shunt resistor. This page covers the INA219 and INA226 IC implementation specifically: registers, calibration, ALERT configuration, and bring-up.


INA219 vs INA226: Which to Choose

FeatureINA219INA226
ADC resolution12-bit16-bit
Shunt voltage LSB10 µV (fixed)2.5 µV (fixed)
Shunt input range±40/80/160/320 mV (PGA selectable)±81.92 mV (fixed)
Bus voltage range0–16 V or 0–32 V0–36 V
Common-mode input0–26 V0–36 V
Supply voltage3.0–5.5 V2.7–5.5 V
Hardware averagingUp to 128 samplesUp to 1024 samples
ALERT / READY pinNoYes — open-drain, configurable
I2C addresses0x40–0x4F (16 options)0x40–0x4F (16 options)

Choose the INA219 when the current range is large or variable — the programmable PGA lets you match the shunt input range to the signal, avoiding saturation at high currents while maintaining resolution at low ones. The INA219 also suits designs that need to remain within a 26 V common-mode constraint.

Choose the INA226 when higher resolution is required (16-bit ADC, 2.5 µV shunt LSB vs 10 µV), when autonomous ALERT interrupts for over-current or under-voltage protection are needed, when the common-mode voltage exceeds 26 V (up to 36 V), or when extensive hardware averaging is required to suppress noise (up to 1024 samples).


Hardware Connections

Mount the shunt resistor in the high-side current path (between the supply rail and the load), with the IC's IN+ and IN− pins sensing across it:

Supply+ ─── R_SHUNT ───┬─── Load+
                       │
           INA21x IN+  ┘  (connects to supply side of shunt)
           INA21x IN−  ─── Load+ (connects to load side of shunt)
           INA21x VS  ──── 3.3 V or 5 V (IC supply — independent of monitored bus)
           INA21x GND ──── GND
           INA21x SCL ──── I2C SCL (4.7 kΩ pull-up to logic supply)
           INA21x SDA ──── I2C SDA (4.7 kΩ pull-up to logic supply)

The VS supply is independent of the monitored bus — you can monitor a 24 V rail from a 3.3 V microcontroller supply as long as the common-mode rating is not exceeded. Place a 100 nF ceramic decoupling capacitor between VS and GND within 2–3 mm of the IC.

I2C Address Selection

Both ICs support 16 unique addresses per device type via the A0 and A1 pins, each connected to GND, VS, SDA, or SCL:

A1A07-bit address
GNDGND0x40
GNDVS0x41
GNDSDA0x42
GNDSCL0x43
VSGND0x44
VSVS0x45
VSSDA0x46
VSSCL0x47
SDAGND0x48
SDAVS0x49
SDASDA0x4A
SDASCL0x4B
SCLGND0x4C
SCLVS0x4D
SCLSDA0x4E
SCLSCL0x4F

Prefer GND and VS connections where four addresses are sufficient — address pins tied to active signal lines (SDA, SCL) are more susceptible to noise and can cause metastable address detection under some bus conditions.


Calibration Register — the Essential Setup Step

Neither IC produces valid current or power data until the Calibration register (0x05) is written with a non-zero value. Both ICs power on with Cal = 0, which causes the Current and Power registers to always return zero regardless of current flow. This is the most common bring-up failure mode.

The calibration equation links the chosen current resolution (Current_LSB) and the shunt value (R_SHUNT) to the IC's internal ADC scaling:

INA219:

Cal = trunc(0.04096 / (Current_LSB × R_SHUNT))

INA226:

Cal = trunc(0.00512 / (Current_LSB × R_SHUNT))

Where:

  • Current_LSB — the desired current resolution in amps per ADC bit (e.g. 0.001 for 1 mA/bit)
  • R_SHUNT — the shunt resistor value in ohms (e.g. 0.01 for 10 mΩ)

The constants 0.04096 and 0.00512 are derived from each IC's internal shunt voltage LSB (10 µV for INA219, 2.5 µV for INA226) and internal ADC scaling factor — see each IC's datasheet for the derivation.

Worked Example

Design parameters: 10 mΩ shunt resistor (R_SHUNT = 0.01 Ω), maximum current 5 A.

Choose Current_LSB to span the full range with maximum resolution:

Current_LSB = 5 A / 32767 ≈ 153 µA = 0.000153 A

Or round up to a convenient value — 0.0002 A (0.2 mA/bit) — giving a readable maximum of 6.55 A with 0.2 mA resolution:

INA219INA226
Cal = trunc(K / (0.0002 × 0.01))trunc(0.04096 / 0.000002) = 20,480trunc(0.00512 / 0.000002) = 2,560
Shunt voltage at 5 A5 × 0.01 = 50 mV — within ±80 mV PGA or ±81.92 mV fixed rangesame
Current resolution0.2 mA0.2 mA

Write the calibration value to register 0x05 as a 16-bit unsigned big-endian integer. After writing, reading the Current register (0x04) returns a signed 16-bit value; multiply by Current_LSB to obtain the current in amps.

Power register scaling:

Power (W) = Power_register × 20 × Current_LSB   (INA219)
Power (W) = Power_register × 25 × Current_LSB   (INA226)

The multipliers (20 and 25) are fixed internal constants defined in each datasheet.


INA219 Configuration Register (0x00)

The INA219 configuration register controls the PGA range, ADC resolution, and operating mode. The power-on default (0x399F per the datasheet) sets continuous shunt+bus conversion with a 32 V bus range and ±320 mV shunt range.

BitsNameFunction
15RSTWrite 1 to reset all registers to default (self-clears on write).
13BRNGBus voltage range: 0 = 16 V full-scale; 1 = 32 V full-scale (default).
12:11PGAShunt input range: 00 = ±40 mV; 01 = ±80 mV; 10 = ±160 mV; 11 = ±320 mV (default).
10:7BADCBus ADC resolution and averaging (0011 = 12-bit single sample, ~532 µs; 1000–1111 = 12-bit with 1–128 hardware-averaged samples).
6:3SADCShunt ADC resolution and averaging (same encoding as BADC).
2:0MODE000 = power-down; 001–011 = triggered single-shot; 100 = ADC off; 101–110 = continuous shunt or bus only; 111 = shunt+bus continuous (default).

Selecting the PGA range: The shunt voltage at peak current must stay within the selected PGA range. A shunt voltage above the PGA limit saturates the ADC — the reading clamps at the maximum without indicating overflow. Calculate V_SHUNT_MAX = I_MAX × R_SHUNT and select the next PGA setting above it:

PGAMax shunt VMax I at 10 mΩMax I at 50 mΩMax I at 100 mΩ
±40 mV40 mV4 A0.8 A0.4 A
±80 mV80 mV8 A1.6 A0.8 A
±160 mV160 mV16 A3.2 A1.6 A
±320 mV320 mV32 A6.4 A3.2 A

INA226 Configuration Register (0x00)

The INA226 configuration register controls hardware averaging, conversion time per sample, and operating mode. Refer to the INA226 datasheet (SBOS547) for the complete bit-by-bit encoding — key fields:

BitsFieldOptions
15RSTWrite 1 to reset all registers.
14:12AVGAveraging count: 000 = 1 sample; 001 = 4; 010 = 16; 011 = 64; 100 = 128; 101 = 256; 110 = 512; 111 = 1024.
11:9VBUSCTBus voltage conversion time per sample: 000 = 140 µs; 001 = 204 µs; 010 = 332 µs; 011 = 588 µs; 100 = 1.1 ms; 101 = 2.116 ms; 110 = 4.156 ms; 111 = 8.244 ms.
8:6VSHCTShunt voltage conversion time (same eight options as VBUSCT).
5:3MODE000 = power-down; 001–011 = triggered; 101 = shunt continuous; 110 = bus continuous; 111 = shunt+bus continuous.

Total conversion time = AVG_count × (VBUSCT + VSHCT). More averaging suppresses random noise but lengthens the measurement cycle. For a 10 A current loop with switching ripple, 16–64 averages at 332 µs per sample typically provides a stable average reading while maintaining a reasonable update rate.


INA226 ALERT Pin

The INA226 ALERT pin (open-drain, requires a 10 kΩ pull-up to the logic supply) can interrupt the MCU when a current or voltage threshold is crossed, eliminating the need to poll the I2C bus. Configure it using two registers:

Mask/Enable register (0x06):

BitNameFunction
15SOLAlert when shunt voltage exceeds Alert Limit (over-current)
14SULAlert when shunt voltage falls below Alert Limit (under-current)
13BOLAlert when bus voltage exceeds Alert Limit (over-voltage)
12BULAlert when bus voltage falls below Alert Limit (under-voltage)
11POLAlert when power exceeds Alert Limit
10CNVRAssert ALERT when a new conversion result is ready (use instead of polling)
4AFFAlert Function Flag — set to 1 when the alert condition is met (read-only)
3CVRFConversion Ready Flag (read-only)
2OVFMath Overflow Flag
1APOLAlert polarity: 0 = active low (default); 1 = active high
0LENLatch enable: 0 = ALERT clears automatically when condition clears; 1 = latched until Mask/Enable register is read

Alert Limit register (0x07): The threshold in the same register units as the associated measurement. For a shunt over-current alert (SOL), write the shunt register value that corresponds to the trip current: alert_limit = trip_current / Current_LSB.

Over-current alert example — 4 A trip point, Current_LSB = 0.0002 A:

Alert Limit = 4 A / 0.0002 A = 20,000 → write 20,000 to register 0x07
Mask/Enable = 0x8002 (SOL enabled, active low, latched until register read)

Reading the Mask/Enable register in the ISR both retrieves the AFF flag (identifying which condition fired) and clears the latch, allowing the ALERT pin to de-assert.


Reading the Registers

Both ICs use the same I2C protocol: write the register address as a single byte, then read 2 bytes (big-endian, MSB first). All current and shunt voltage registers are signed 16-bit integers.

#define INA_ADDR    0x40   // A1=GND, A0=GND
#define REG_CONFIG  0x00
#define REG_SHUNT   0x01
#define REG_BUS     0x02
#define REG_POWER   0x03
#define REG_CURRENT 0x04
#define REG_CAL     0x05

static void ina_write_reg(uint8_t reg, uint16_t value) {
    uint8_t buf[3] = { reg, (uint8_t)(value >> 8), (uint8_t)(value & 0xFF) };
    i2c_master_transmit(INA_ADDR, buf, 3);
}

static int16_t ina_read_reg(uint8_t reg) {
    uint8_t buf[2];
    i2c_master_transmit(INA_ADDR, &reg, 1);
    i2c_master_receive(INA_ADDR, buf, 2);
    return (int16_t)((uint16_t)(buf[0] << 8) | buf[1]);
}

// INA219 init — 10 mΩ shunt, 0.2 mA/bit resolution, ±80 mV PGA (8 A max)
void ina219_init(void) {
    // BRNG=1 (32V), PGA=01 (±80mV), BADC/SADC=0011 (12-bit), MODE=111 (continuous)
    ina_write_reg(REG_CONFIG, 0x2FFF);
    // Cal = trunc(0.04096 / (0.0002 × 0.01)) = 20480
    ina_write_reg(REG_CAL, 20480);
}

float ina219_current_a(void) {
    return ina_read_reg(REG_CURRENT) * 0.0002f;   // 0.2 mA/bit
}

float ina219_bus_voltage_v(void) {
    // Bus voltage register: bits 15:3 = voltage (13-bit), bit 1 = CNVR, bit 0 = OVF
    int16_t raw = ina_read_reg(REG_BUS);
    return (raw >> 3) * 0.004f;   // 4 mV/LSB
}

float ina219_power_w(void) {
    return ina_read_reg(REG_POWER) * 20.0f * 0.0002f;   // Power_reg × 20 × Current_LSB
}

INA226 note: The bus voltage register is the full 16-bit value at 1.25 mV/LSB — no shift required. Multiply ina_read_reg(REG_BUS) directly by 0.00125f.


Design Considerations

  • Shunt resistor power rating: Dissipation is P = I² × R_SHUNT. At 10 A through 10 mΩ: P = 1 W. Use a resistor rated at least 2× the expected dissipation with appropriate PCB copper area for thermal spreading. Precision low-inductance shunts (Vishay WSL, Bourns CSS series) are available in 2-terminal and 4-terminal (Kelvin) packages specifically for this application.
  • Wait for the first conversion before reading: In continuous mode, the first valid result is available after one conversion cycle following power-up or a configuration register write. Poll the Conversion Ready flag (bit 1 of the INA219 bus voltage register, or the CVRF bit in the INA226 Mask/Enable register) to confirm a fresh result is available before reading registers for the first time.
  • Use the ALERT as an interrupt, not polling: Continuously reading the I2C current register at 10 Hz keeps the bus occupied and prevents the MCU from sleeping. Configuring the INA226 ALERT pin as an edge-triggered GPIO interrupt allows the MCU to sleep and wake only when a threshold is exceeded — improving both efficiency and response latency.
  • Validate calibration before production: The calibration value depends on R_SHUNT, which has a manufacturing tolerance of typically ±1% for precision shunts. At 1% tolerance, the current reading error is bounded by the shunt tolerance. For applications requiring tighter accuracy, measure R_SHUNT on each board and compute the calibration value accordingly, or calibrate against a known current.

For products that need precision current monitoring across multiple power rails, battery coulomb counting, or motor drive current feedback — including shunt specification, PCB layout, and calibration workflow — Zeus Design's electronics engineering team provides end-to-end measurement system design.

Common Mistakes

  • Calibration register not written at startup: Both ICs reset to Cal = 0 on power-up. The Current and Power registers always read zero until register 0x05 is written with the correct calibration value. Verify the write with a register read-back during bring-up before debugging further.
  • INA219 PGA range set too low — shunt ADC clips silently: If V_SHUNT_MAX = I_MAX × R_SHUNT exceeds the selected PGA range, the shunt ADC saturates and clamps at its maximum output. The reading freezes at the PGA limit with no overflow indication. Always calculate the worst-case shunt voltage and confirm the PGA setting covers it with margin.
  • INA226 ALERT pin left floating without pull-up: The ALERT pin is open-drain and requires a pull-up resistor (typically 10 kΩ to the logic supply) to be readable as a logic level. A floating ALERT pin on an MCU GPIO input will generate spurious interrupts from noise coupling. If the ALERT function is unused, tie the pin to VS through 10 kΩ and leave the Mask/Enable register at its reset state.
  • Reading the INA219 bus voltage register without right-shifting: The bus voltage register encodes the voltage in bits 15:3; bits 2:1 carry the CNVR and OVF status flags. Reading the raw 16-bit value without shifting right by 3 produces a value approximately 8× the real bus voltage. Always apply (raw >> 3) × 0.004 V.
  • Reversed IN+ and IN− polarity: IN+ must connect to the high-potential side of the shunt (upstream, towards the supply). Reversing IN+ and IN− results in a large negative shunt voltage that the signed ADC may report as maximum negative rather than as a near-zero positive value. Verify polarity with a multimeter across the shunt at a known load current during initial bring-up.
  • Address collision with other I2C peripherals: Several common I2C devices share the 0x48–0x4F address range (e.g. LM75 temperature sensors, PCF8574 GPIO expanders). Map the full I2C address space before assigning INA219/INA226 address pins to avoid conflicts that are difficult to diagnose without a logic analyser.

Frequently Asked Questions

Why does the INA219 or INA226 current register always read zero?
The most common cause is that the Calibration register (0x05) has not been written. Both ICs initialise with a calibration value of zero, which prevents the internal current calculation from producing a non-zero result — the Current and Power registers will always return 0x0000 until you write a non-zero calibration value. Calculate Cal = trunc(0.04096 / (Current_LSB × R_shunt)) for the INA219, or trunc(0.00512 / (Current_LSB × R_shunt)) for the INA226, and write it to register 0x05 before reading register 0x04. If the calibration is set and readings are still zero, confirm the shunt resistor is physically in circuit, that IN+ and IN− connect to opposite ends of the shunt (Kelvin sense taps), and that the VS supply pin is within the rated range (3.0–5.5 V for INA219, 2.7–5.5 V for INA226) per the respective datasheets.
Can I connect multiple INA219 or INA226 ICs on the same I2C bus?
Yes. Both ICs support up to 16 unique I2C addresses per device type (0x40–0x4F), set by tying the A0 and A1 pins to GND, VS, SDA, or SCL. This allows up to 16 INA219s and 16 INA226s on the same bus simultaneously — 32 current monitoring channels in total. In practice, address pins tied to SDA or SCL are more susceptible to noise than those tied to GND or VS. Prefer GND and VS connections where the four resulting addresses are sufficient; only use SDA/SCL ties when more than four instances are needed on the same bus.

References

Related Questions

Related Forum Discussions