I2C bus problem with INA219 - SDA is held low on the bus

Hi,
I can’t figure out how to solve this problem.

“Recovery: failed, SDA is held low on the bus”

I removed every component and breadboard and now I have only the INA219 (current sensor) connected to the board, with direct jumper wires.
I replaced the nodemcu with a new board, no luck.
I replaced the sensor with a new one, no luck.

thanks in advance for any suggestion!

esp8266:
  board: nodemcuv2

(...)

i2c:
  sda: D2 #GPIO4 
  scl: D1 #GPIO5

sensor:
  - platform: ina219
    address: 0x40
    shunt_resistance: 0.1 ohm
    power:
      name: "$device_name watt"
      id: desklamp_power_watt

log:
[02:10:09][C][i2c.arduino:052]: I2C Bus:
[02:10:09][C][i2c.arduino:053]: SDA Pin: GPIO4
[02:10:09][C][i2c.arduino:054]: SCL Pin: GPIO5
[02:10:09][C][i2c.arduino:055]: Frequency: 50000 Hz
[02:10:09][C][i2c.arduino:064]: Recovery: failed, SDA is held low on the bus
[02:10:09][I][i2c.arduino:068]: Results from i2c bus scan:
[02:10:09][E][i2c.arduino:076]: Unknown error at address 0x08
[02:10:09][E][i2c.arduino:076]: Unknown error at address 0x09
[02:10:09][E][i2c.arduino:076]: Unknown error at address 0x0A
(…)
|02:10:09|[C]|[ina219:133]|INA219:|
|02:10:09|[C]|[ina219:134]|Address: 0x40|
|02:10:09|[E]|[ina219:137]|Communication with INA219 failed!|

1 Like

Double check your wiring. Do you have SDA incorrectly connected to ground (or SCL)?

Do you have the correct board definition?

Thanks. Wiring is very straight on the two pins SCL and SDA.
Board is the Amica nodemcuv2 esp8266, SDA and SCL are on D1/D2.

I’ll try to test a I2C oled on those pins.

Hello again, I connected a I2C display on D1 and D2 pins and it works when INA219 is not connected.
When I connect the INA219 sensor the bus reports the error above.
Two INA219 sensors gives me the same error. Both are failed? Sounds strange.
IMG_1927 Small

The soldering of the pins in the photo looks pretty average !! Have you checked the modules with a multimeter for a short to ground ??

1 Like

Hi Gaz, you are right soldering is not very nice.
I checked this module and also a brand new just arrived, with no soldered pins: SDA to GND measures 3.9 to 4.2 M Ohm on all modules.

I tried compiling a sketch with standard example for INA219 on Arduino IDE and sensor is not found.

I haven’t figured out how to solve this. Ordered a new sensor and I have the same issue. The I2C bus is fine cause I have a display connected and working.

I solved measuring the current with an external smart plug on Home Assistant and using it as a sensor in this esphome device.
Oversized but working.

Weird, I definitely have these boards working with ESPHome.

i2c:
  sda: 33
  scl: 32
  scan: true
  id: bus_a

sensor:
  - platform: ina219
    address: 0x40
    shunt_resistance: 0.1 ohm
    current:
      name: "12V Current"
      filters:
        - multiply: -1
        - sliding_window_moving_average:
            window_size: 10
            send_every: 10
            send_first_at: 1
    power:
      name: "12V Power"
      filters:
        - sliding_window_moving_average:
            window_size: 10
            send_every: 10
            send_first_at: 1
    bus_voltage:
      name: "12V Bus Voltage"
      filters:
        - sliding_window_moving_average:
            window_size: 10
            send_every: 10
            send_first_at: 1
    shunt_voltage:
      name: "12V Shunt Voltage"
      filters:
        - sliding_window_moving_average:
            window_size: 10
            send_every: 10
            send_first_at: 1
    max_voltage: 15.0V
    max_current: 3A
    update_interval: 6s

  - platform: ina219
    address: 0x41
    shunt_resistance: 0.1 ohm
    current:
      name: "5V Current"
      filters:
        - multiply: -1
        - sliding_window_moving_average:
            window_size: 10
            send_every: 10
            send_first_at: 1
    power:
      name: "5V Power"
      filters:
        - sliding_window_moving_average:
            window_size: 10
            send_every: 10
            send_first_at: 1
    bus_voltage:
      name: "5V Bus Voltage"
      filters:
        - sliding_window_moving_average:
            window_size: 10
            send_every: 10
            send_first_at: 1
    shunt_voltage:
      name: "5V Shunt Voltage"
      filters:
        - sliding_window_moving_average:
            window_size: 10
            send_every: 10
            send_first_at: 1
    max_voltage: 6.5V
    max_current: 3A
    update_interval: 6s

I had exactly the same problem - I2C bus do not get recognizable info from device.
Wasted lots of time on getting it working - tried 5 units(seller sold those as a batch) and none of them worked.
Finally ordered the same device from another seller and it worked without any problems.
And then I also realized the difference - the shunt resistor is marked “R10” on non working module. I googled about this and the first result leaded me here:)
So, seems that if the shunt resistor is R10 and not R100 then there is a big change that it’s not working.

1 Like

did you measure the actual shunt resistance ?