I have been trying to figure out how to remedy an issue. I can “talk” to one I2C device as long as it is the only device on the bus. However, if I plug another device on the bus, powered off in between of course, I no longer can. I checked to make sure that the devices did not have the same ID. I am using N3. Do I need to use additional pull-ups? I have tried turning down the clock rate for the config. Any ideas or insight would be appreciated.
Length of cabling? You might want to have a look here. About the Pi, but helpful info and a link to download the user manual for I2C. We are setting up Temp sensors with runs up to 25 meters. Not using a Duino though.
Am not affiliated with the author and have not purchased anything from him.
I was able to use two 4.7k pull-ups(one from SDA to 5V and one from SCL to 5V) and achieve communication again. My knowledge of electronics is limited and I am now curious if there is a resource for calculating the proper Ohms to use? Why do I need to use additional pull-ups if each module has their own pull ups? I ended up having to use 1k’s to be able to communicate with 3 devices on the bus. @Lou_Yovin The overall length of the bus is less than 10 cm
There is a calculation, but you need a capacitance meter, or you can find it empirically by measuring the rise time on your bus, but you need a scope for that. Generally, if you need to lower resistance for it to work, your capacitance has risen more than expected, slowing the rise time. Decreasing R gets it back up. Consider using wire with lower capacitance. If you are just experimenting, and not too concerned about EMI or power consumption, I would find whatever value works, then reduce it another 20% for margin. It’s normally quite forgiving, you would probably need to be below 1.5K @ 5V before going too far. I2C Bus Pullup Resistor Calculation from TI
I do have a scope and cap/multimeter. As far as wiring, It’s a custom board with copper traces. After reading the datasheet I had flashbacks of physics so I went with the pragmatic approach. I may sit down and work it all out electrically once everything is prototyped before production… or find an EE.
If you have a scope then you can work on this empirically, you simply need to work out the right resistor values to square off the wave form if it is a little rounded.
If you don’t have a capacitance meter then have you thought about calculating C from the resistance and the rise time?
A few interesting sites on RC calculations wrt to I2C:
@KiwiBryn Thanks for the suggestion. I am creating a module/pcb and I would rather have the hardware work quasi Plug and Play as opposed to using software to fix a hardware issue, which seems too hacky. Had I not had the tools and equipment I may have tried it. By using a scope and seeing the rise times, using various resistance values, I was able to select a set of resistors to use in order to get the rise times squared off for dependable communication.