Wemos D1 mini with INA219 breakout - i2c not working

I have a wemos D1 mini I intend to use for a small mobile robot. I have three devices on the i2c bus, these are:
0x30 Lolin dual motor driver shield
0x0D QMC5883L magnetic compass
0x40 INA219 current monitor

The magnetic compass and INA219 are connected to 3V3, GND, D1 for SCL, D2 for SDA.

When running a scan for addresses on the i2c bus I see the first two modules and can communicate with them fine, but the INA219 does not show up at any address.

As far as I'm aware, my INA219 breakout has the two 10k pull-up resistors on the board. I am using the Adafruit_INA219 library.

How should I attempt to troubleshoot this?

Running a I2C Scanner is how to troubleshoot it, but you have already done that.

Do you have a Arduino Uno ? The INA219 can be used with 5V and 3.3V, so you can test it with just any board.

With the Wemos D1, remove everything and connect only the INA219.
Let the I2C Scanner run and fiddle with the wires. Do you use a breadboard ? They have often bad contacts.

A logic analyzer can be used to check the bus. A cheap 8 channel 24MHz logic analyzer works, but I recommend a 25 dollar LHT00SU1. With sigrok/pulseview it is a very nice tool. In Windows you need to run a "zadig.exe" tool to make the drivers, but it is worth the trouble. Turn off the analog channel in sigrok/pulseview or else the sample rate of the digital channels is limited.

When the wiring is okay, then the INA219 module might be broken (to be sure, test it with an Arduino Uno).

Many thanks for the help :slight_smile:

Not currently using a breadboard, jumper wires straight from ESP to INA219 breakout as no junctions required.

Tried with the other I2C devices disconnected, nothing detected.

Tried a different Wemos D1 mini as I don't have my UNO handy right now, still nothing.

Tried reflowing the solder on the INA219 header pins, still nothing.

Dug in my box of bits and managed to find another brand new INA219 breakout, soldered some pins on that and it works perfectly.

My conclusion: The first INA219 was dead on arrival as I only took it out of the anti-static bag and soldered the pins on yesterday!

Thanks for the tip on the logic analyser, I don't have one yet. I do have a cheap clone of a "Jyetech DSO Shell" oscilloscope, would that be good enough to troubleshoot I2C in future?

Glad you found the problem.

With such a device it is hard to find what you want to see and it can not decode the I2C signals. It can show a repeating analog signal, but a single I2C event would be very hard or impossible.

A USB logic analyzer has in my opinion only advantages and no disadvantages. It can capture an enormous amount of data. The mouse can be used to scroll and zoom, so it is easy to find what you want to see. The software can decode the I2C signals and many other signals. It is easier to make a screenshot and show it here on this forum. A capture can be saved. It has a higher sample rate. Shall I go on ?
For the low frequency signals of a Arduino, a 25 dollar USB logic analyzer has more value to me than a 1000 dollar standalone logic analyzer.