# SDA/SCL Distance

Hello All,

I've got my NANO based project working on a breadboard - its a simple reed switch and oLED display like this one:

and I've used two 4.7K pullup resistors across Vcc of the oLED and SDA and SCL. All working OK, but when I extend the oLED display cable to about 2m the screen becomes scrambled. I've checked the supply voltage and its 3.3v at the oLED so I think it must be something to do with the value of the pullups. Ive tried 10k but no joy and Im worried about damaging it.

So questions:

Is I2C distance limited?
What end of the cable should I put the pullups?
How to I calculate the best resistor value?

Also I'd like to eventually move this to a 3.3v based system (using an Ardulog) using the same cabling - how do I calculate what value pullup resistors to use?

TIA

Hi,
The best place to learn about I2C is at Nick Gammon's page HERE:

Is I2C distance limited?

What end of the cable should I put the pullups?

Doesn't matter.

How to I calculate the best resistor value?

Based on the voltage of 5V it is 4K7, there is nothing to calculate. You get a pull down current of about 1mA.

For a 3V3 system use 2K7.

Thanks both,

2 feet! Oh dear, I guess that rather scuppers my plans for a remotely mounted display!

Thank you for the help and links, it's much appreciated.

I2C can be extended try a google search on ‘I2C Extender’

What you kills you is the capacitance of the cable slowing down the edges of the signals.

Yes a bus extender will increase the range, also slowing down the bus will help.

Thanks everyone,

I managed to shorten my cable (by drilling a another hole in my ceiling!) by about 0.75m to make it about 2.2m long and it now works!

Brilliant, thanks guys. I was wrong footed by thinking about pull up resistor values when I should have been thinking about the cable length.

For info, Im using CAT6 network cable and 4k7 pullups now.

Thanks,

There are lots of different transmission protocols than Serial, SPI, and I2C. Twisted pair cable is perfect for a differential signaling method, so you might want to look into RS-485.

For high speed long distance data transmission you have to move to using some sort of transmission line(*)
or use wireless.

(*) this means a cable with well defined characteristic impedance and proper termination, such as used
in wired ethernet, RS485, USB, RF coax, LVDS and probably many more schemes. You can also consider
waveguide and optic fibre as transmission lines of a more general kind too. This is an area where you can
no longer ignore Maxwell's equations to understand electronics - the lumped-component model doesn't work.
The pioneer behind transmission lines was Oliver Heaviside, who used his insights to make undersea
telegraph cables work at usable speeds (the same problem on a very different scale).

Grumpy_Mike:

Standard I2C (100kHz) works well here 24/7 with more than 5meters of cat-6 in between.
Combined pull up resistance can be as low as ~1k8 (3mA) for standard I2C.
Clock and data must be separated (different pairs).
Leo..

Wawa:
Standard I2C (100kHz) works well here 24/7 with more than 5meters of cat-6 in between.
Combined pull up resistance can be as low as ~1k8 (3mA) for standard I2C.
Clock and data must be separated (different pairs).
Leo..

That's interesting - I stuck them in same twisted pair.

Groan, I'm still learning.....!

Thanks for the tip.

Now you know the difference between balanced and unbalanced transmission lines. Twisted pair doesn’t magically fix transmission problems.

Yes, for long distance you'd assume anti-phase differential signalling with no net DC bias.

For instance ethernet does this with a 10/8 coding scheme (remove DC bias). The point is to
eliminate any common mode signal and to allow passage through transformers (which block
DC)

The problem with twisted pairs for I2C is that they have a much higher capacatance per foot than ribbon wire and it is the capacatance that ultimately limits the I2C distance.

Grumpy_Mike:
The problem with twisted pairs for I2C is that they have a much higher capacatance per foot than ribbon wire and it is the capacatance that ultimately limits the I2C distance.

Agreed (for short unterminated cables).
But cat-6 is only 53pF/meter, cheap, and maybe easier to get than 6-ribbon cable.
Standard I2C should stay under 400pF/3mA.
Leo..

2 feet? I'm using an OLED without pullups at a distance of around 5 feet. I'm using (and don't laugh) keyboard cable, which is highly shielded. I've tried cat5 and too much interference.

Maybe wire type has a big part in it?

I don't know...

KrisKasprzak:
I don't know...

Yes that's right you don't know. Just because you have something that functions does not mean you have something that is correct and will work under all circumstances and is repeatable.
Have you examined the signal's clock edges rise and fall times?
Have you tested it over a range of temperatures?
Have you made more than one?

I suspect the answer to all question is no.
Two feet is what the standard was designed to cope with, for god sake look at the name, Inter Intergrated Circuit - does that not suggest on the same circuit board, not a remote bus?

I've sent 1Mbaud signals over >1km using audio screened balanced pairs - using the old Texas 75n108/110 drivers/ receivers - similar to RS485. Appropriately sourced and sunk in 120 ohms ( the characteristic impedance ) it worked fine.

Note : the characteristic impedance of a line is sqrt(L/C) - the L and C being per unit length.

And apart from resistive and dielectric losses, could be of infinite length.

regards

Allan

Grumpy_Mike:
Two feet is what the standard was designed to cope with, for god sake look at the name, Inter Intergrated Circuit - does that not suggest on the same circuit board, not a remote bus?

Don't know where you got that "two feet" from. Never seen that in an I2C datasheet.
AFAIK 400pF/3mA is the basic standard.
That might well be two feet on a circuit board with ground planes and a dozen connected chips.
But that doesn't mean that you can't send signals more than two feet over a low capacitance cable.
Leo..

And apart from resistive and dielectric losses, could be of infinite length.

Yes bloody reality getting in the way.

Mind you it doesn't stop some people who reply to this thread.