Is INA226 Bi-Directional Power Monitor Compatible with Home Assistant (ESPHome)?
Electrical Specifications
Always confirm pin assignments against the manufacturer datasheet before wiring.
Compatibility Overview
High-precision 16-bit I2C current and voltage monitor measuring up to 36V DC bus lines with sub-milliamp accuracy.
Wiring INA226 Bi-Directional Power Monitor to ESP32
| Module pin | ESP32 | Note |
|---|---|---|
| VCC | 3V3 | Powers the chip (2.7–5.5V), independent of the circuit being measured. |
| GND | GND | Shared with the monitored circuit: bus voltage is measured against it. |
| SDA | GPIO21 | |
| SCL | GPIO22 | |
| IN+ | supply side of the load | Cut the positive lead and insert the shunt: supply into IN+, out of IN− to the load. Reversed, current reads negative rather than zero. |
| IN− | load side | |
| VBUS | IN− (load side) | Bus voltage is read on its own pin, not at IN− as on the INA219. Where the board brings VBUS out separately, it has to be wired. |
| A0 / A1 | open | Both low is 0x40, the config's address. The chip decodes sixteen addresses, 0x40–0x4F; the pads on common modules give 0x40, 0x41, 0x44 and 0x45. |
| ALERT | unconnected | ESPHome polls the registers. |
Host pins are the ones the configuration on this page uses. Move a pin here and change it in the YAML — they are documented together so they cannot disagree.
Technical Specification Matrix
| Feature / Attribute | Specification / Status |
|---|---|
| Hardware Protocol | I2C Bus / 3.3V |
| Bridge Required | NO |
| Border Router Needed | None |
| Hardware Capabilities & Peripherals | Bus Voltage (V) Current (A) Power (W) Note: these entities come from the ESPHome configuration you flash — each one needs its matching component in that YAML before it appears. |
| Pairing Complexity | Intermediate |
| Factory Reset Instruction | Hold BOOT button for 3s. |
Wire, Flash, Adopt, Check
Wire it up
Follow the wiring table above. The ESP32 pins there are the ones the configuration uses, so if you move one, change it in both places.
Flash the configuration
Create a new device in the ESPHome dashboard (the Home Assistant add-on) and paste the configuration below into it, or save it as emb_esp32_ina226_ha.yaml and run esphome run emb_esp32_ina226_ha.yaml. The first flash goes over USB. If it is not detected, hold BOOT button for 3s to put it in download mode. Every update after that is over the air.
Adopt it in Home Assistant
Settings → Devices & Services. A node on the same network shows up as a discovered ESPHome device within a minute of joining Wi-Fi; choose Configure and enter the API encryption key from your secrets.yaml. If discovery does not find it, add the ESPHome integration by hand with the node's IP address.
Check it works
The I2C scan lists 0x40, Bus Voltage matches a multimeter at the load, and Current matches a known load — a 12V, 5W bulb draws about 0.42A. A current stuck near 0.82A whatever the load is the shunt saturated. The right size but negative is IN+ and IN− swapped. A Bus Voltage of zero with current flowing is VBUS unwired.
ESPHome Configuration
Starting configuration for INA226 Bi-Directional Power Monitor on ESP32. Untested on hardware — verify wiring and pins against your own board.
# ESPHome configuration for INA226 Bi-Directional Power Monitor
# Host: ESP32. Pin numbers below are host-side defaults — any free
# GPIO will do, and you should change them to match your own wiring.
esphome:
name: emb_esp32_ina226_ha
friendly_name: "INA226 Bi-Directional Power Monitor"
esp32:
board: esp32dev
framework:
type: esp-idf
logger:
api:
encryption:
key: !secret api_encryption_key
ota:
- platform: esphome
password: !secret ota_password
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
i2c:
id: i2c_main
sda: GPIO21
scl: GPIO22
scan: true
# A0/A1 strapping puts this anywhere in 0x40-0x4F; 0x40 is both pins low.
# shunt_resistance must match the resistor fitted to your board. The INA226
# reads at most 81.92mV across it, so the common 0.1 ohm (R100) shunt tops
# out at 0.82A — max_current says so, which also makes each current step
# about 25uA instead of the 98uA the 3.2A default gives.
sensor:
- platform: ina226
address: 0x40
shunt_resistance: 0.1 ohm
max_current: 0.8A
current:
name: "Current"
power:
name: "Power"
bus_voltage:
name: "Bus Voltage"
update_interval: 60s
Before you flash:
the !secret values come from your
secrets.yaml, and the GPIO numbers are host-side
defaults rather than properties of this part — change them to match how you actually wired it.
If the device is not found:
it is usually the I2C address, not the config. Many breakouts strap their address with
solder jumpers, so two boards of the same part can differ. This config leaves
scan: true on — the boot log lists every address
actually present on the bus, and you can copy the right one from there.
What Appears in Home Assistant
Volts at VBUS against GND, in 1.25mV steps, 0–36V.
Amps through the shunt, signed: positive into IN+, negative when current flows back — a battery charging rather than discharging.
Watts, calculated by the chip from current and bus voltage. Feed it to a total_daily_energy sensor to get kWh for the Energy dashboard.
Optional, not in the config: shunt_voltage: under the same platform reports the drop across the shunt, which is the quickest way to check the shunt value.
Known Problems and Fixes
On the 0.1Ω shunt, 0.82A is the ceiling
The INA226 reads at most 81.92mV across its shunt. Most modules carry an R100 (0.1Ω) resistor, which puts the limit at 0.82A, and max_current: 0.8A in the config says so. The component's default of 3.2A is the INA219's range and does not apply to this chip. Above 0.82A the reading sticks at the top. For more current fit a lower shunt (R010, 0.01Ω, gives 8.2A) and change shunt_resistance and max_current to match.
max_current sets the step size
ESPHome divides max_current by 32,768 to choose the size of one current step. 0.8A gives about 25µA a step, close to what the chip resolves on a 0.1Ω shunt (2.5µV per shunt step). Left at the 3.2A default, each step would be about 98µA for no extra range.
VBUS makes low-side sensing possible
Because bus voltage has its own pin, the shunt can sit in the ground return — IN+ and IN− in the negative lead, VBUS on the positive rail — and the chip still reports the supply voltage. The INA219 cannot do that.
Common ground, 36V maximum
Bus voltage is measured against the module's GND, so the monitored circuit must share ground with the ESP32. 36V is the most the inputs may see: a "36V" lithium pack charges to 42V and is beyond it.
A snapshot, not a minute's average
The component runs the chip continuously, 1.1ms per shunt and bus conversion, averaged four times, so each update reports roughly the last 9ms. With update_interval: 60s a pulsing load — a motor, a radio transmitting, a node waking from sleep — is caught once a minute at a random moment. For energy totals shorten the interval, or raise adc_averaging (1024 averages span over two seconds).
0x40 is shared
The INA219 and HTU21D also sit at 0x40. Bridge A0 (0x41) if either shares the bus.
Shares I²C address 0x40
These parts default to the same address. At least one can be re-strapped, so they can coexist once you change it:
- INA219 DC Voltage & Current Sensor — resolvable
- HTU21D Temp & Humidity Sensor — resolvable
- HDC1080 Temp & Humidity Sensor — resolvable
A0/A1 strapping selects 0x40-0x4F. Check a full build in the planner · The ways out of an address conflict
Report a Pinout Error or Submit Tested Code Snippets
Found a pin mapping quirk or built a custom ESPHome YAML driver for INA226 Bi-Directional Power Monitor? Submit a pull request or report corrections to our index.
Hardware Correction Reporter (emb-esp32-ina226-ha)
Frequently Asked Questions
Does INA226 Bi-Directional Power Monitor work without an internet connection?
How is INA226 Bi-Directional Power Monitor powered and wired to the host board?
How does the host board reach Home Assistant (ESPHome)?
Alternatives
INA219 DC Voltage & Current Sensor
Cheaper and 12-bit, to 26V and 3.2A on its stock shunt, with bus voltage read at IN− so there is one wire fewer.
INA3221 ↗
Three channels in one chip, for a solar setup with panel, battery and load to watch.
PZEM-004T V3 AC Energy Monitor
AC mains voltage, current and energy, which neither INA part measures.
ADS1115 16-bit 4-Channel Precision ADC
Four 16-bit voltage inputs, if what you need is several voltages rather than a current.