I have connected an INA219 breakout board to a D1 Mini so that the INA219 is measuring only the 5v current into the D1 Mini. I loaded a minimal ESPHome configuration, using the example in the ESPHome doc for the INA219.
When running, I measure across the shunt with a DVM and get 7mV. And the device also reports the same:
'INA219 Shunt Voltage': Sending state 0.00710 V with 3 decimals of accuracy
I believe that the board’s shunt resistor is 0.1 ohm, because a) it has marking ‘R100’, which matches the marking on the board from Adafruit they say theirs is 0.1 ohm, and b) an ‘R10’ chip is supposed to 0.1 ohms so I think R100 is also.
With those numbers, I calculate the current at 0.007v / 0.1 ohm = 0.070 A or 70 mA, which I can accept since I’ve heard that the D1 Mini draws less than 120 mA.
Ok, but, ESPHome reports the current is 0.0007A:
'INA219 Current': Sending state 0.00069 A with 3 decimals of accuracy
So I changed the value of the shunt_resistance: 0.001 ohm
And now it reports the expected current:
'INA219 Current': Sending state 0.07174 A with 3 decimals of accuracy
What is up?
Here is the relevant part of my config:
sensor:
# the INA219 current sensor
- platform: ina219
address: 0x40
# the board's shunt is 0.1 ohms but I set to 0.001 ohms so the current comes out right
shunt_resistance: 0.001 ohm
current:
name: "INA219 Current"
accuracy_decimals: 3
power:
name: "INA219 Power"
bus_voltage:
name: "INA219 Bus Voltage"
shunt_voltage:
name: "INA219 Shunt Voltage"
accuracy_decimals: 3
max_voltage: 32.0V
max_current: 3.2A
update_interval: 10s
Thanks in advance,
Kent