Current, voltage and power
INA226 with ESP32
Reach for the INA226 instead of an INA219 when you need more precision or a higher bus voltage. Its 16-bit readings give 2.5 µV per shunt step and 1.25 mV per bus step, and the bus input reads up to 36 V. That covers a 24 V battery or a solar system with room left over.
The module's shunt sets the real current limit, and the printed chip range does not. Maximum shunt voltage is about 81.9 mV, so a 0.1 Ω shunt reads up to about 0.8 A. Many cheap modules use that resistor, and sellers' higher figures do not change the arithmetic. For larger currents, use a smaller shunt and change the value in your code. A 36 V rating does not make a bare module safe for any battery pack: an unfused high-current wire on a breadboard can still melt.
The shunt goes in series with the load, on the positive side. The chip's logic runs from 2.7 to 5.5 V, so 3.3 V works without level shifting. The address falls between 0x40 and 0x4F. It is usually 0x40, but modules wire their address pads differently, so scan the bus first. Note that a scan proves only that the chip answers, not that the shunt path is right. Check current with a multimeter at a known load. The example reads the registers directly, with no library.

Specifications
| Bus voltage | 0–36 V |
|---|---|
| Bus resolution | 1.25 mV per step |
| Shunt resolution | 2.5 µV per step |
| Maximum shunt voltage | About 81.9 mV |
| 0.1 Ω shunt limit | About 0.8 A |
| Logic supply | 2.7–5.5 V |
| I2C address | 0x40 to 0x4F |
Power and logic levels
3.3 V: safe to connect directly
| Supply | 2.7–5.5 V, use 3V3 |
|---|---|
| Signal level | I2C follows the supply |
| On an ESP32 | The measured circuit stays separate. Run it from 3V3, so the I2C lines stay at 3.3 V. |
ESP32 pins, including those on a display board's connectors, work at 3.3 V and are not 5 V tolerant. Modules differ, so if in doubt, measure the signal before you connect it.
Wiring
| INA226 | Connect to | Note |
|---|---|---|
| VCC | 3V3 | |
| GND | GND | Common with the measured circuit |
| SDA | GPIO 8 | Any free pin, set in Wire.begin() |
| SCL | GPIO 9 | Any free pin, set in Wire.begin() |
| IN+ / IN- | In series with the load | Positive side, fuse the circuit |
Arduino code
#include <Wire.h>
const int SDA_PIN = 8, SCL_PIN = 9;
const uint8_t ADDR = 0x40;
const float SHUNT_OHM = 0.1;
int16_t readReg(uint8_t reg) {
Wire.beginTransmission(ADDR);
Wire.write(reg);
Wire.endTransmission();
Wire.requestFrom(ADDR, (uint8_t)2);
int16_t v = Wire.read() << 8;
return v | Wire.read();
}
void setup() {
Serial.begin(115200);
Wire.begin(SDA_PIN, SCL_PIN);
}
void loop() {
float shuntV = readReg(0x01) * 2.5e-6; // 2.5 uV per step
float busV = (uint16_t)readReg(0x02) * 1.25e-3; // 1.25 mV per step
float amps = shuntV / SHUNT_OHM;
Serial.printf("%.3f V %.3f A %.2f W\n", busV, amps, busV * amps);
delay(1000);
}
No extra library needed. Compiled for ESP32-S3 with arduino-esp32 3.x. Not yet tested by us on a physical sensor. Change the pins to match your board.
On a display
Read the value in your sketch and pass it to a label, or send it over MQTT and show it with an MQTT value in the editor.
Design a display for INA226Boards with a ready connector
Only boards whose connectors we have surveyed. Others may still work on free GPIOs.
| Elecrow CrowPanel ESP32 HMI 2.4" | I2C port: SDA 22, SCL 21Not shared with the touch controller (it is on SPI) — free for sensors |
| Elecrow CrowPanel ESP32 HMI 2.8" | I2C port: SDA 22, SCL 21Not shared with the touch controller (it is on SPI) — free for sensors |
| Elecrow CrowPanel ESP32 HMI 3.5" | I2C port: SDA 22, SCL 21Not shared with the touch controller (it is on SPI) — free for sensors |
| Elecrow CrowPanel ESP32-S3 HMI 5.0" | I2C port: SDA 19, SCL 20Same I2C bus as the GT911 touch (0x14 / 0x5D) and, on V3.0 boards, the PCA9557 touch-reset expander (0x18) |
| Elecrow CrowPanel ESP32-S3 HMI 7.0" | I2C port: SDA 19, SCL 20Same I2C bus as the GT911 touch (0x14 / 0x5D) and, on V3.0 boards, the PCA9557 touch-reset expander (0x18) |
| LilyGO T-Display-S3-Pro 2.33" | QWIIC RIGHT: SDA 5, SCL 6I2C only — same bus as the touch, the PMU (SY6970) and the light sensor |
| M5Stack AtomS3 0.85" | Bottom I2C pins: SDA 38, SCL 39Same I2C bus as the built-in IMU (MPU6886, 0x68) |
| Makerfabs MaTouch ESP32-S3 Rotary IPS 2.1 Round | Mabee I2C (J1): SDA 17, SCL 18Same I2C bus as the touch controller (CST826) |
| Makerfabs MaTouch ESP32-S3 Parallel TFT 4.3" | Mabee I2C: SDA 17, SCL 18Same I2C bus as the touch controller (GT911) |
| Makerfabs MaTouch ESP32-S3 Parallel TFT with Touch 5.0" | Mabee I2C: SDA 17, SCL 18Same I2C bus as the touch controller (GT911) |
| Makerfabs MaTouch ESP32-S3 Parallel TFT with Touch 7.0" | Mabee I2C: SDA 17, SCL 18Same I2C bus as the touch controller (GT911) |
| Sunton ESP32-4827S043R/C 4.3" | I2C header (P3): SDA 19, SCL 20Same I2C bus as the GT911 touch controller. P3 also carries GPIO 17 / 18. |
| Sunton ESP32-8048S043C 4.3" | I2C header (P3): SDA 19, SCL 20Same I2C bus as the GT911 touch controller. P3 also carries GPIO 17 / 18. |
| Sunton ESP32-8048S050C 5.0" | I2C header (P3): SDA 19, SCL 20Same I2C bus as the GT911 touch controller. P3 also carries GPIO 17 / 18. |
| Sunton ESP32-8048S070C 7.0" | I2C header (P3): SDA 19, SCL 20Same I2C bus as the GT911 touch controller. P3 also carries GPIO 17 / 18. |
| Waveshare ESP32-S3 Touch LCD 2.1" round | I2C connector: SDA 15, SCL 7Same I2C bus as the touch controller, the IO expander, the RTC and the IMU (addresses 0x15/0x5D, 0x20, 0x51, 0x6B, 0x7E taken) |
| Waveshare ESP32-S3 Touch LCD 2.8" | I2C connector: SDA 11, SCL 10Same I2C bus as the RTC and the IMU (0x51, 0x6B, 0x7E taken) — the touch has its own bus |
| Waveshare ESP32-S3 Touch LCD 2.8" Type B | I2C connector: SDA 15, SCL 7Same I2C bus as the touch controller, the IO expander, the RTC and the IMU (addresses 0x15/0x5D, 0x20, 0x51, 0x6B, 0x7E taken) |
| Waveshare ESP32-S3-Touch-LCD-2.8C | I2C connector: SDA 15, SCL 7Same I2C bus as the touch controller, the IO expander, the RTC and the IMU (addresses 0x15/0x5D, 0x20, 0x51, 0x6B, 0x7E taken) |
| Waveshare ESP32-S3-LCD-7B | I2C connector (H1): SDA 8, SCL 9Same I2C bus as the touch controller (GT911) and the IO expander (CH422G) |
Good to know
- The shunt sets the current limit: about 0.8 A with 0.1 Ω.
- Fuse the measured circuit.
- Check the address: modules differ.
- Do not use it on mains.
What it is good for
- Battery monitors
- Solar charge displays
- Bench supply readouts
FAQ
What is the difference between INA219 and INA226?
The INA226 has higher resolution and reaches 36 V on the bus input.
How much current can a 0.1 Ω module measure?
About 0.8 A before the shunt voltage hits the limit.
Can it measure AC mains?
No, it is for DC circuits.
Sources
Related parts
Use this information at your own risk. It is for general guidance only: the example code compiles, but it has not been tested on every part, and modules differ between sellers. Check the manufacturer's data before you build. Product names belong to their owners, and LCD Ultra Pro is not affiliated with them. See our Terms.