i2c freezes, but only with long cables?

Hi all,

I am connecting 2 arduino's with a distance of +/- 10m. I connected them with 3 cables.
If I run my code on my computer (where I just connect the arduino's with jumper wires) it all works fine.
But when I install them on the place they need to be, they freeze while using the i2c?
Even if one arduino is powered and sends something, and the other isn't the whole script freezes?

How can this happen?

Thanks!

AFAIK I²C is not suitable for any distance. This issue is protocol related.

How can I communicate over that distance?

How can I communicate over that distance?

Under normal conditions I2C max length is about 1m!
Some people report they could get up to 10..15m without extender. It very much depends on the quality of the cable and if there is much e-noise around or not.

Before you go to another communication method (RS485 would certainly do), did you pay attention to the required pullup resistors of I2C ?

Here are some good information links to move on and decide what to do:

and

and a quote:

Max cable length depends on the I2C devices, pull-up resistance (or pull-up current) and cable capacitance.

With standard I2C devices and standard pull-up resistors and standard speed, max bus capacitance is 400pf.
Cable could be ~40-60pf/m. 32m of cable wold be too much.
Clock and data have to be on different pairs, or separated with a ground in between (flat cable).

Fast Mode Plus (FM+) devices can be used on higher capacitance busses.
If you use an Arduino to only SEND I2C to other devices, you could lower the pull-up resistor value to as low as 220ohm, to counteract cable capacitance. Try 470ohm first.
Standard mode devices might not be able to answer back.
You could also use standard pull-up resistors (>1k5?), normal wiring, and a lower bus speed.

from here.

Here I read about max. 400pF capacitance in the cable and the right resistor values. Lower I²C speed would be good too, of course.

I'm using 2 OLED's with wires around 9 feed. My wires are 18 gage "sprinkler wire" as that's all I could find in low quantities and low budget. I had some lock issues due to the wires in close proximity with a relay (inductive spikes). I did put a resistor in series with SDL SCL, can't remember the values though. My OLED's never lock up.