Long distance I2C

Hello Arduinites,

I want to extend the reach of several Seeed Studio grove connected sensors, the most relevant one being a +/- 16 g accelerometer.

The supplied grove harness is 20 cm long, I intend to splice in longer wires to make it maybe 50 cm long (1/2 meter). I have seen info that for shielded cable, I2C can work up to 1 meter in length.

Can anyone provide any perspective on this?

Thanks,

Steven Lightfoot

Where?

Here is something to read...

I2C bus is limited by the address space and also by the total bus capacitance of 400 pF

This came from the following link...

The I2C bus can not deal with crosstalk between SDA and SCL. Keep SDA away from SCL.

They are just two (weak) digital signals. They are not twisted pair signals.
You can make the I2C bus less weak, by adding more pullup resistors, or with a lower value of the pullup resistors. The maximum sink current (to make SDA or SCL low) is 3mA.

Forget Wikipedia, I disagree with what is written there. It is not complete nonsense, but not very useful for the length of the I2C bus.
Read the official I2C standard instead: https://www.nxp.com/docs/en/user-guide/UM10204.pdf
On page 54, paragraph 7.5, there is mentioned that you get 10 cm if you do it wrong. So, don't do it wrong :face_with_raised_eyebrow:

A much better approach is to connect a small MCU directly to the sensors, and send the data up to 100 m using RS232 UART serial, which is vastly more robust than I2C. Use RS485 for 1000 m or more.

Thanks, that is helpful, although its does say under the Circuit Interconnections section that many meter distances are possible with a different design, although I dont know what that means.

Excellent comments, I am a real newbie at the electronics side of this, but what you say makes sense. I do in fact want to measure various sensors at many meter distances, so your proposal may be what I need to do. Thank you.

Thanks, very helpful. I assume the Grove Seeed I2C connector ribbons are 20 cm for a reason. For now I will live with that length and consider other ways to extend my sensor distances.

Take a look using that small computer with CAN, that is a two wire bus that goes from node to node. All nodes are masters, slaves, or both, up to your software. At lower baud rates it is good for 4,000 feet. They work great in cars, home automation and many other places.

2 Likes

Thanks good idea. The issue is that the sensors I have are from the Arduino Seeed Studio sensor kit, and seem wired limited to I2C, at least the ones I want to use. I LOVE this system, and Arduino, but I am beginning to realize its limitations, it really is more of student/learning/toy system, and I want to push it a bit into actual engineering applications.

I am getting an Arduino Uno Rev 4 wifi and it does have a CAN bus connection, so I may eventually explore that. I was just want to know the limits of what I can with the small hardware I already have, I think I now know - I will need to keep my I2C cable lengths pretty short.

Steven Lightfoot

You can slow down the I2C clock, it may enable you to go 1 meter.

Thanks, I will investigate that possibility.

How many I2C accelerometers (and other I2C devices) do you have on the bus?

option?
P82B715 I2C Bus Extender

Two max, one accelerometer and one oled.

Thanks, I will check it out.

Might be a little annoying to write to the oled at a slow clock.
Another option is to use SoftI2C to create a second I2C bus.
Quite a few options have been presented here. You need to decide which workes best for you.

Yes, thanks for your comments and help.

My plan, basically, is to built a small shaker table (cantilever beam) driven by an unbalanced motor/rotor at the end of the beam controlled by my Arduino Uno Rev 4 wifi and then measure the shaking via the accelerometer, and I need the shaker table/beam to be maybe two feet from the stationary Arduino MCU.

Then you probably don't want a slow clock.
The 16g accelerometer board has fairly low value pull-up resistors so it may well work at two feet. With four pieces of wire (5V,GND,SCL,SDA) you can easily find out

Agree, I prolly dont want to slow the clock speed. I may not even use an oled but just sent the accel feedback to my serial mon.

I will def try extending with four wires to see if I can get it to work at 24 inches, if not, I may have to rearrange the mounting such that the Arduino board is mounted close to the end of the beam with the most movement (co-located more or less with the accelerometer mount position, and just let the accel I2C cable bounce up and down with the end of the beam.