Go Down

Topic: [SOLVED]Multiple I2C, one not working (Read 213 times) previous topic - next topic

Welsyntoffie

Jul 20, 2019, 01:36 pm Last Edit: Jul 22, 2019, 03:43 pm by Welsyntoffie
Good day.
I have 2x ina219, address 40 and 44.
One RTC at address 68
Arduino nano on address 8.
1 ads1115 on address 49.

When I run I2Cscanner I get...
8
40
44
49 this is ads1115
57 no idea whats this
68

Everything communicates as expected, but the ads1115 does not. Output is always -1.
At first I had no pull-up resistors. But I tried adding 2k resistors to SCL and SDA. Still the same.

I connected the ads1115 to my test uno and it worked.

I am using a mega as my master.
I also tried setting the I2C bus speed to 200khz and 400, but still stays the same -1.

So, I can see the ads1115 responding because the scanner proofed it. But way only -1 output?

Edit:
I disconnected 1 ina219 from the bus and then the ads1115 started to work. So I can only have 5 devices at a time. Will attemp to lower the pullup resistors.

Geek Emeritus

Quote
57 no idea whats this
the EEPROM on the RTC module
All PMs will be deleted unopened due to arrogant argumentative pot stirring Malfoys.
 If you have not read "How to use this forum - please read", in particular: "7. If you are posting code or error messages, use "code" tags":  expect rude responses

Welsyntoffie

the EEPROM on the RTC module
Haha, thank you. I thought I bought the non eeprom version because the description did not specify like some other product descriptions on ebay.

Koepel

Can you show photos of all modules, or can you tell what the value is of the pullup resistors for SDA and SCL on every module ? I think that all the pullup resistors on the modules combined is too much pullup.

Welsyntoffie

I don't have clear photos. Will have to get some.

I am not sure of the onboard pullup resistors.

As a last resort I tried to swap the wires from the one ina219 with the ads1115.
In order for that to work I had to add 30cm of wire to the ads1115 (3 lenghts of jumper wires). Now all of my devices are working. I still have the 2k pullup external resistors attached. Could this be a capacitons issue?

Koepel

#5
Jul 21, 2019, 06:04 am Last Edit: Jul 21, 2019, 06:14 am by Koepel
The I2C bus can have many chips attached to it. In theory more than hundred.
In real life it is limited when using a cable or jumper wires that are still attached to each other.
Seperate short jumper wires are okay.
It is also limited by the total amount (or the lack) of pullup resistors.

You have 6 devices. That should be no problem. The best solution would normally be to use two 2k2 to 4k7 pullup resistors and remove all the pullup resistors from all the modules. However, you have already 10k onboard pullup resistors on the Arduino Mega 2560. If you keep the pullup resistors on one module, that should be enough.

Arduino Mega 2560: internal pullup resistors (was it 50k ?) plus onboard pullup resistors of 10k.
Arduino Nano: internal pullup resistors of 50k.
Suppose you have this INA219 module, they have 10k pullup resistors, and two of those modules.
Suppose you have this ADS115 module, they have 10k pullup resistors.
Suppose you have a cheap DS3231 module, they have often 4k7 pullup resistors.
And you have 2k external pullup resistors ?

Total: 50k // 10k // 50k // 10k // 10k // 10k // 4k7 // 2k = 867 Ω
The current to pull the signal down will be: 5V / 867Ω = 5.8 mA (calculated with Google).
The maximum for the I2C bus is specified as 3 mA.
Even with removing the 2k external resistors, it is still too much.

This is the best case scenario, because some cheap modules have pullup resistors that they had lying around, and the value can be lower than the 10k of the Adafruit modules.

You have to calculate the total pullup and you have to remove a number of pullup resistors from the modules.
To remove a smd resistor, use a big blob of solder and heat both ends.

Welsyntoffie

Now I get it.
I found some schematics on google for my modules. Removing all of them should be easy and then only use two external taking into account the arduino build in pullups.
Even though are suddenly working now, they are most likely barely working.

Thank you

Koepel

#7
Jul 22, 2019, 05:06 pm Last Edit: Jul 22, 2019, 05:06 pm by Koepel
The calculation is sometimes not that simple:

If you buy a module with a level shifter, then there is often a 10k before the level shifter and 10k after the level shifter.
The current the pull the SDA or SCL down has to pull down both sides of the level shifter.
5V / 10k = 0.5mA
3.3V / 10k = 0.33mA
That results already in a current of 0.83mA.

By the way, you don't have to select a "safe" value of 1 or 2mA. If the resulting current is 3mA, then it is okay.

It is possible to make a sketch with a idle I2C bus. Just a Wire.begin() in the setup().
Then you can measure the shortcut current from SDA to GND and from SCL to GND with a multimeter. That should be close to what you have calculated.

Welsyntoffie

#8
Jul 22, 2019, 06:21 pm Last Edit: Jul 22, 2019, 10:10 pm by Welsyntoffie
Ok.
So I did remove the 2k external pull-up.
With that I should get 1532 ohms. Which will give me 3.2mA.
I will disable the 2 arduino's internal pull-ups. Which then gives me 1632 ohms and 3.06mA.

Internal as far as I can see is 50k. Mega R3 and nano v3.

Then any new slave device added must be pull-up free.
??

Go Up