I2C and long distance

Hi everyone. Hope that you guys are doing well. I have some question to ask. I'm on in my final year project where I was assigned to do some control system with a lot of input signal where I can push some button and control 9 potentiometer. I'm want to use I2C connection to connect both arduino since my input from the other side of control is too large, maybe ranging 15 to 21 and as far as 40 m in distance. The only resource that I'm using is some college-provided 18 core copper cable and 2 arduino mega connecting to each other through the cable. And the rest is either motor, relay, etc at the master side.

I use 5v to send signal to master to ask for data from slave and it works by using array data. However, since this is just a ground zero, I'm really concern over the long distance I2C communication. Thinking that it might failed, I've done some research over it, and yet have not find any solution through it. Is there any hardware to be added for this communication or is there any better communication protocol that might suit my situation.

Please help. Thanks a lot, friends.

Hello
The I²C technologie had been designed to provide a communication onboard of a PCB.
If you want to make a "long" distance communication check the specification for either RS422 or RS485.
Have a nice day and enjoy coding in C++.

2 Likes

Hi, thanks for replying. Can i do that without using utp or cat5 cable. Is there will be interruption afterwards and can i add over 2 more arduino for that. Sorry for lots of question since I was a computer student who's new to this environment.

Hello
As computer student you should be able to make your own rechereche.

or something like this

1 Like

Tq op, I'll try first. Thanks a lot

Not a good idea. Cable capacitance is what kills I2C performance. Twisted cable like CAT5 has more capacitance than parallel wires. As a compromise you could use CAT5 but consider each pair as one wire.

Hi @ffkrisaac,

every protocol has its electrical cable length limitations.

I2C --> cms (depends on speed);
the maximum bus length of an I2C link is about 1 meter at 100
Kbaud, or 10 meters at 10 Kbaud.
ref: I2C Bus Range and Electrical Specifications, Freescale 9S12 HCS12 MC9S12 I2C Hardware =So%20the%20maximum%20bus%20length,within%20an%20otherwise%20shielded%20enclosure.

SPI
While the SPI communication method is generally suitable for distances up to approximately 10 m
Ref: Isolated SPI Communication Made Easy | Analog Devices

RS232
Cable length is one of the most discussed items in RS232 world. The standard has a clear answer, the maximum cable length is 50 feet, or the cable length equal to a capacitance of 2500 pF. The latter rule is often forgotten. This means that using a cable with low capacitance allows you to span longer distances without going beyond the limitations of the standard. If for example UTP CAT-5 cable is used with a typical capacitance of 17 pF/ft, the maximum allowed cable length is 147 feet.
Ref: RS232 Specifications and standard - Lammert Bies

USB
If you are not using a regular cable, then the maximum active cable length for USB 2.0 is 30 meters (98 feet and 5 inches) and the maximum recommended length for USB 3.0/3.1 is 18 meters (about 59 feet). If you are using a regular cable (max length of 5 meters for 2.0 and max length of 3 meters for 3.0/3.1) with an active cable, then the maximum length for USB 2.0 is 25 meters (about 82 feet) and the maximum recommended length for USB 3.0/3.1 is 15 meters (about 49 feet).
Ref: USB Cable Length Limitations And How To Break Them

RS485
The maximum distance of RS-485 without using a repeater is 4000 feet (1220 meters) at baud rates up to 90Kbps.
Extend that distance by adding an RS-485 Repeater or Optically Isolated Repeater every 4000 feet.
Ref: http://www.bb-elec.com/Learning-Center/All-White-Papers/Serial/RS-485-Tips,-Tricks,-Questions-Answers/RS-485-Tips,-Tricks,- Questions-Answers.pdf

UTP Cat5/Cat6
The maximum length you can run Cat5, Cat5e, Cat6 and Cat6a cable is 100 meters or 328 feet. If you require a longer run, you will need to put an active component, such as a router, in-between the signals.
Ref: Discussing Cat5 Length Limits | ShowMeCables.com

etc. etc.

everything has limits.

RV mineirin

@ffkrisaac The length of a cable for I2C depends on many things. If everything is done wrong, then 20 cm can be too long. If everything is done right, then 2 meters is still reliable. Some can do a lot more.

The common way for long distance communication is Serial over RS-485. You need a twisted pair for that, but if you look how the wires are in a normal cable, then maybe you can use two wires that are always next to each other in the cable.
Since you have an Arduino on both sides, I suggest to use RS-485. There is absolutely no need to make the quirky I2C signal go over that distance.

There are I2C bus extenders, but they come with problems.
In the old days, the I2C signal was amplified. That is rather dumb. The P82B715 does that.
Today, the I2C signals are converted into twisted pair signals (just like the RS-485 signals). You need a number of twisted pair for that, so a Cat5 or Cat6 ethernet cable is used. See the Sparkfun PCA9615 I2C bus extender.
If you are going to convert the I2C signals into RS-485-alike signals, then I suggest to use normal RS-485.

Using a normal cable for I2C over a distance of 40 meters is not possible in my opinion.
There are ways to make it work, but it won't be reliable. You really need a better cable and you should not try I2C over that distance.
Remember that 20 cm is what the maximum distance is at the moment for you. With our help, you can get to 2 meters.

A good alternative is wireless. Up to 10 meters is easy, but for 40 meters distance you have to look for something better. Sparkfun has a wireless guide, but that is just a small part of all the possibilities.

Thank you for using meters, that also means that certain wireless solutions which can be bought at Amazon/Ebay/Aliexpress are not legal.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.