I2C, SPI, UART & RS-485 DISCUSSION

How far can I run I2C over a cable, and what should I use for a 5 m sensor lead?

Started by venkatesh I2C bus lengthbus capacitanceI2C extenderdifferential I2Clong cable sensor
4 replies 248 views 5 participants
Latest activity · 30 Sep 2026

How far can I run I2C over a cable, and what should I use for a 5 m sensor lead?

venkatesh I2C, SPI, UART & RS-485 Forum
#1

My sensor works on a 20 cm jumper but becomes unreliable on a 5 m cable: occasional NACKs and sometimes the bus locks up completely. The bus is 3.3 V at 100 kHz with 4.7 kΩ pull-ups.

Is there a defined maximum length for I2C? And if 5 m is too far, what is the normal way to reach a remote sensor?

Community replies 4

Re: How far can I run I2C over a cable, and what should I use for a 5 m sensor lead?

#2

The specification does not give a length, it gives a capacitance: 400 pF maximum for standard and fast mode. Ordinary multi-core cable is somewhere around 50 to 100 pF per metre between conductors, so 5 m can use up 250 to 500 pF on its own. I2C was designed for chips on the same board, and a cable that long is at or past the limit before you add the devices.

Re: How far can I run I2C over a cable, and what should I use for a 5 m sensor lead?

#3

You can estimate what your pull-ups can drive. The rise-time limit is R_max = t_r / (0.8473 × C_b). For standard mode, t_r is 1000 ns, so with 400 pF the largest usable pull-up is 1000 ns / (0.8473 × 400 pF), about 2.95 kΩ. Your 4.7 kΩ is too weak for that load. Dropping to 2.2 kΩ and lowering the clock to 50 kHz or less will often make a marginal cable work, because only the rise time is fixed, not the bit period.

Re: How far can I run I2C over a cable, and what should I use for a 5 m sensor lead?

#4

Capacitance is only half of the problem. SDA and SCL running side by side in the same cable couple into each other, and a glitch on SCL looks like an extra clock pulse, which is one way buses end up locked. If the cable has spare cores, pair SDA with ground and SCL with ground rather than SDA with SCL, and keep the cable away from motor or relay wiring.

Add a bus recovery routine too: if SDA is stuck low, toggle SCL up to nine times until the device releases it, then send a STOP.

Re: How far can I run I2C over a cable, and what should I use for a 5 m sensor lead?

#5

For a lead that must be reliable, change the physical layer instead of tuning resistors. Bus buffer ICs designed for long I2C runs raise the drive current and the capacitance limit, and differential I2C extenders convert SDA and SCL to differential pairs at both ends of the cable, which suits twisted-pair cable.

The other common choice is to put a small microcontroller next to the sensor and send the data back over RS-485, which is built for long cables and noisy environments.

TEP COMMUNITY