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
| Feature | INA219 | INA226 |
|---|---|---|
| ADC resolution | 12-bit | 16-bit |
| Shunt voltage LSB | 10 µV (fixed) | 2.5 µV (fixed) |
| Shunt input range | ±40/80/160/320 mV (PGA selectable) | ±81.92 mV (fixed) |
| Bus voltage range | 0–16 V or 0–32 V | 0–36 V |
| Common-mode input | 0–26 V | 0–36 V |
| Supply voltage | 3.0–5.5 V | 2.7–5.5 V |
| Hardware averaging | Up to 128 samples | Up to 1024 samples |
| ALERT / READY pin | No | Yes — open-drain, configurable |
| I2C addresses | 0x40–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:
| A1 | A0 | 7-bit address |
|---|---|---|
| GND | GND | 0x40 |
| GND | VS | 0x41 |
| GND | SDA | 0x42 |
| GND | SCL | 0x43 |
| VS | GND | 0x44 |
| VS | VS | 0x45 |
| VS | SDA | 0x46 |
| VS | SCL | 0x47 |
| SDA | GND | 0x48 |
| SDA | VS | 0x49 |
| SDA | SDA | 0x4A |
| SDA | SCL | 0x4B |
| SCL | GND | 0x4C |
| SCL | VS | 0x4D |
| SCL | SDA | 0x4E |
| SCL | SCL | 0x4F |
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:
| INA219 | INA226 | |
|---|---|---|
| Cal = trunc(K / (0.0002 × 0.01)) | trunc(0.04096 / 0.000002) = 20,480 | trunc(0.00512 / 0.000002) = 2,560 |
| Shunt voltage at 5 A | 5 × 0.01 = 50 mV — within ±80 mV PGA or ±81.92 mV fixed range | same |
| Current resolution | 0.2 mA | 0.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.
| Bits | Name | Function |
|---|---|---|
| 15 | RST | Write 1 to reset all registers to default (self-clears on write). |
| 13 | BRNG | Bus voltage range: 0 = 16 V full-scale; 1 = 32 V full-scale (default). |
| 12:11 | PGA | Shunt input range: 00 = ±40 mV; 01 = ±80 mV; 10 = ±160 mV; 11 = ±320 mV (default). |
| 10:7 | BADC | Bus ADC resolution and averaging (0011 = 12-bit single sample, ~532 µs; 1000–1111 = 12-bit with 1–128 hardware-averaged samples). |
| 6:3 | SADC | Shunt ADC resolution and averaging (same encoding as BADC). |
| 2:0 | MODE | 000 = 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:
| PGA | Max shunt V | Max I at 10 mΩ | Max I at 50 mΩ | Max I at 100 mΩ |
|---|---|---|---|---|
| ±40 mV | 40 mV | 4 A | 0.8 A | 0.4 A |
| ±80 mV | 80 mV | 8 A | 1.6 A | 0.8 A |
| ±160 mV | 160 mV | 16 A | 3.2 A | 1.6 A |
| ±320 mV | 320 mV | 32 A | 6.4 A | 3.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:
| Bits | Field | Options |
|---|---|---|
| 15 | RST | Write 1 to reset all registers. |
| 14:12 | AVG | Averaging count: 000 = 1 sample; 001 = 4; 010 = 16; 011 = 64; 100 = 128; 101 = 256; 110 = 512; 111 = 1024. |
| 11:9 | VBUSCT | Bus 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:6 | VSHCT | Shunt voltage conversion time (same eight options as VBUSCT). |
| 5:3 | MODE | 000 = 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):
| Bit | Name | Function |
|---|---|---|
| 15 | SOL | Alert when shunt voltage exceeds Alert Limit (over-current) |
| 14 | SUL | Alert when shunt voltage falls below Alert Limit (under-current) |
| 13 | BOL | Alert when bus voltage exceeds Alert Limit (over-voltage) |
| 12 | BUL | Alert when bus voltage falls below Alert Limit (under-voltage) |
| 11 | POL | Alert when power exceeds Alert Limit |
| 10 | CNVR | Assert ALERT when a new conversion result is ready (use instead of polling) |
| 4 | AFF | Alert Function Flag — set to 1 when the alert condition is met (read-only) |
| 3 | CVRF | Conversion Ready Flag (read-only) |
| 2 | OVF | Math Overflow Flag |
| 1 | APOL | Alert polarity: 0 = active low (default); 1 = active high |
| 0 | LEN | Latch 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, ®, 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
How Do You Measure Current with a Shunt Resistor?
Covers shunt resistor selection, low-side vs high-side sensing, INA219/INA226 I2C monitors, Kelvin connection layout, and calibration register calculation.
Sensor Signal Conditioning Basics
Covers signal conditioning for sensors: op-amp gain, offset, 4-20mA interface, anti-aliasing filter design, ADC input protection, and two-point calibration.
What Is an Instrumentation Amplifier and How Does It Work?
Covers the three-op-amp topology, gain formula G = 1 + 2R/Rg, CMRR, and in-amp applications for Wheatstone bridges and sensor front ends.
What Is I2C (Inter-Integrated Circuit)?
I2C is a two-wire serial bus for addressing multiple peripherals over shared SDA/SCL lines. Learn how addressing, speed grades, and pull-up resistors work.
How Does a Fuel Gauge IC Measure Battery State of Charge?
A fuel gauge IC estimates battery state of charge so your device can show accurate battery level. Learn how voltage-based and coulomb-counting gauges work.
What Is an Accelerometer and IMU?
Covers IMU and accelerometer basics: MEMS principles, MPU-6050 and LSM6DSO interfacing, gyroscope drift, and complementary filter sensor fusion.
Related Forum Discussions
MAX31865 reading fault bit on every conversion — VBIAS enabled but still faulting
Spent most of yesterday trying to get a MAX31865 talking to my STM32F4 and I'm stuck on the same problem no matter what I try: the fault bit
ICM-42688-P INT1 never fires after FIFO setup — FIFO count stuck at 0x0000 but WHO_AM_I reads back correctly
Working on a motion data logger — ICM-42688-P on an STM32F4 via SPI4 at 4 MHz. SPI seems fine: WHO_AM_I at register 0x75 reliably returns 0x
NTC thermistor temperature reading jumping ±4°C — ADC noise or something in the circuit?
I've got an NTC thermistor (10 kΩ at 25°C, standard B = 3950) in a voltage divider with a 10 kΩ fixed resistor, top rail 3.3 V, thermistor t