Measurement errors on INA226

Hi,

I’m trying to measure power consumption with INA226. As power source I use laboratory power supply so I set required V there. As a load I use PWM fan. I do not use PWM control capabilities, I just provide different V to the fan. Below are measurements that I receive from INA226 and what I see on power supply:

V_source: 5v
V_ina: 4.87v
I_source: 0.055A
I_INA: 0.065A

If I set V to 12.7v on power supply then I have next data:

V_source: 12.7v
V_ina: 12.36v
I_source: 0.135A
I_INA: 0.150A

So INA always shows lower V and higher current. Power measurement differs for ~10%.

I expect I miss-configured INA sensor so please help me to understand where is the error.

sensor:
  - platform: ina226
    update_interval: 10s
    max_current: 1A
    adc_time: 140us
    adc_averaging: 128
    current:
      name: "INA226 Current"
    power:
      name: "INA226 Power"
    bus_voltage:
      name: "INA226 Bus Voltage"
    shunt_voltage:
      name: "INA226 Shunt Voltage"

Tray adding this to your config:

shunt_resistance: 0.1026 ohm

Added but it didn’t help. Metrics are more or less the same.

Well that should have shifted your voltage +2.6%.

Share where you put it in your config.

Now I have next config

sensor:
  - platform: ina226
    update_interval: 10s
    max_current: 1A
    shunt_resistance: 0.1026 ohm
    adc_time: 140us
    adc_averaging: 128
    current:
      name: "INA226 Current"
    power:
      name: "INA226 Power"
    bus_voltage:
      name: "INA226 Bus Voltage"

Sensors value are not stable so I’m sure that it affected current measurement, it is just not visible due to noise. If I set it to 0.11 ohm current is reduced to almost the same value as on power supply. Did I get it right that it could be just a resistor has different value on this specific board? If so, then I can tune that parameter to match the current. But voltage is still lower than on power supply. Is there something similar for V?

Where are you measuring the voltage?

Keep in mind the resistance of wires and terminals will drop a small amount.

I use that wiring scheme from this article. Only differences are:

  1. I didn’t connect and use ALE pin
  2. VCC connected to 3v on ESP board.

I use short prototyping wires so I do not expect they’ll lead to drop V from 12.7 to 12.36v. It looks too big drop for me.

Did you buy those from ailexpress or ebay?

I just threw out all my pre-made DuPont cables because they were copper plated steel wire (test yours with a magnet, they should not attract) and they were all corroding.

Tested with magent - only connector part is attracted. Wire itself doesn’t.