Is INA219 DC Voltage & Current Sensor Compatible with Home Assistant (ESPHome)?
Electrical Specifications
Always confirm pin assignments against the manufacturer datasheet before wiring.
Compatibility Overview
High-precision DC power monitoring sensor for solar panels battery banks and 12V automotive circuit telemetry.
Wiring INA219 DC Voltage & Current Sensor to ESP32
| Module pin | ESP32 | Note |
|---|---|---|
| VCC | 3V3 | Powers the chip. Independent of the circuit being measured. |
| GND | GND | Must be common with the circuit under measurement — see the gotchas. |
| SDA | GPIO21 | |
| SCL | GPIO22 | |
| VIN+ | supply side of the load | The positive lead is cut and the shunt inserted: supply into VIN+, out of VIN− to the load. High-side sensing. |
| VIN− | load side | |
| A0 / A1 | open | Solder jumpers. Both open is 0x40; bridging them selects up to 0x4F. |
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) Shunt Voltage (mV) Current (mA) 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 2s. |
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_ina219_esphome.yaml and run esphome run emb_esp32_ina219_esphome.yaml. The first flash goes over USB. If it is not detected, hold BOOT button for 2s 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 on the load, and Current matches with a known load (a 12V, 5W bulb reads about 0.4A). A current that is exactly ten times out is the shunt value; a bus voltage of zero with a load running is VIN+ and VIN− on the wrong sides of the cut.
ESPHome Configuration
Starting configuration for INA219 DC Voltage & Current Sensor on ESP32. Untested on hardware — verify wiring and pins against your own board.
# ESPHome configuration for INA219 DC Voltage & Current Sensor
# 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_ina219_esphome
friendly_name: "INA219 DC Voltage & Current Sensor"
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 actually fitted to your board —
# 0.1 ohm is the common value but 0.01 ohm boards exist, and a wrong value
# gives readings that look plausible and are silently 10x out.
sensor:
- platform: ina219
address: 0x40
shunt_resistance: 0.1 ohm
max_voltage: 32.0V
max_current: 3.2A
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
Measured at VIN−, relative to GND. Up to 26V.
Through the shunt, signed: negative when it flows from VIN− to VIN+.
Watts. Feed it to a total_daily_energy sensor to get kWh for the Energy dashboard.
Known Problems and Fixes
The shunt value is everything
The 0.1Ω shunt on the common module gives ±3.2A. shunt_resistance in the config must match the resistor actually on the board (it is marked R100 for 0.1Ω, R010 for 0.01Ω); a wrong value produces readings that look plausible and are out by exactly ten times. Swapping the shunt for a lower value raises the current range and the max_current setting with it.
Common ground, positive rails only
The INA219 measures the voltage at VIN− against its own GND, so the circuit it monitors must share ground with the sensor, and the bus voltage must be positive and under 26V. It cannot monitor a floating rail or a negative supply.
0x40 is shared
The HTU21D sits at 0x40 too. Bridge A0 on the INA219 (0x41) if both are on one bus.
Small currents are noisy
Twelve bits across 3.2A is about 0.8mA per step, and the bottom few steps are noise. For a sleeping battery device drawing microamps this is the wrong part; the INA226 has sixteen bits.
It is in the supply path
The shunt carries the load current. The module's screw terminals and traces are good for the rated 3.2A; do not route a motor stall current through them.
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:
- INA226 Bi-Directional Power Monitor — resolvable
- HTU21D Temp & Humidity Sensor — resolvable
- HDC1080 Temp & Humidity Sensor — resolvable
A0/A1 strapping selects 0x40-0x4F. Check a full build in the planner
Report a Pinout Error or Submit Tested Code Snippets
Found a pin mapping quirk or built a custom ESPHome YAML driver for INA219 DC Voltage & Current Sensor? Submit a pull request or report corrections to our index.
Hardware Correction Reporter (emb-esp32-ina219-esphome)
Frequently Asked Questions
Does INA219 DC Voltage & Current Sensor work without an internet connection?
How is INA219 DC Voltage & Current Sensor powered and wired to the host board?
How does the host board reach Home Assistant (ESPHome)?
Alternatives
INA226 Bi-Directional Power Monitor
Sixteen bits, 36V, the same wiring — for small currents or a slightly higher bus.
MAX17043 LiPo Fuel Gauge
A fuel gauge, if the question is "how full is the LiPo" rather than "what is it drawing".
SCT-013-000 AC Current Transformer
A clamp-on transformer for AC loads, which this part cannot measure.
PZEM-004T V3 AC Energy Monitor
Mains voltage, current and energy in one module, with isolation.