I2C Range entenders

Over time we seem to have a few chats about I2C and its range.
We know the official range is very short and long range normally turns into an issue due to capacitance.

That said, if you search the web you do find some repeaters/extenders either as kits or chips that clam long range I2C.

e.g. https://www.aliexpress.com/item/1005012808555071.html

I am in no way saying that is a good product, simple an example of what I can see when searching.
e.g. * Supports Long-Distance Wiring (>20 meters)

I was wondering what people have found that works and ideal lets us know the ranger and data rates and anything else of interest like limitations found.

It would be nice to have some go-to for long range I2C if we can find some reliable boards/chips.

I think any cabling and methods should be consider… e.g. a direct inline 4 pin connection or maybe some from of differential signaling over cat5 cable and so on.

I look forward to any feed back and comments.

Hi Michael

Yes. I believe it is mainly the time constant formed by the pull up resistor and cable capacitance that is the bogey man here. The extra capacitance caused by longer cable extends the charge and discharge time until the signal is no longer useable. This I think is the reason that things are apparently improved when a “stronger” or lower value pull up is used. The time constant is made shorter so a bit longer cable can be used for the same result. This of course will come to a trade off point like most things and have to reach a maximum somewhere.

The solution. That is another matter. The clock would be easy as it is one direction and a schmidt trigger placed in the correct position would probably clean this up nicely.
The data is another matter as it is bi directional which raises other problems.

It the “old” days of analog TV there was a method of “cleaning up” sync pulses. This was called “pulse stretching” and was rather a brute force method consisting of simply driving a transistor (or valve) between cut off and saturation which pretty effectively got rid of any nasties at the extremities. Yes brutal but it worked.

It would be interesting to see a schematic of the linked device to see how the bi direction problem is overcome. This could be helped by the I2C system being pulled up with a resistor to rail voltage and pulled down by the master OR slave. Rather like ORing the output of several open collector comparators. This might be a bit of a clue. I will give it some thought.
Cheers Bob

Hi Michael,

This has indeed been discussed here several times before … and as it happens, I just finished posting about i2c.

I purchased a LT4311 and used it, but didn’t notice any difference … which probably means my total cable length wasn’t deteriorating the i2c signal noticably. I have not had reason to personally try the QwiicBus Endpoints yet.

BTW, when posting the URL to a AliExpress product, you only need up to the questionmark (?) with the remainder being extra marketing info about you - eg https://www.aliexpress.com/item/1005012808555071.html

Thanks, any chance I can get an appox distance and I2C clock speed over that distance.

Thanks for the aliexpress link advice.

Well, the LT4311 page includes

Adafruit ran a 400 KHz OLED over 3 meters of phone wire with ease.

With a 100KHz signal, Adafruit even ran a BME680 over 100 feet of Ethernet (about 3000pF round trip!), and had an OLED display the sensor details.

and the QwiicBus extender page includes

Extends I2C bus up to 100 feet

Hi Donald
about 3000pF round trip
That link quotes 52pF/metre which at 100ft (30.4m) works out to 1585pF. Now this is just 1585pF NOT a round trip of 3000pF. The cable has the same capacitance in both directions and in CAT whatever cable is 1585pF just like a capacitor of that value. this would be wire to wire capacitance of a pair.

Incidentally the capacitance is quoted at 800Hz. I am not aware of the frequency making any difference to that value. It is what it is irrespective of frequency.. It is a characteristic of that cable.
If anyone knows any different please enlighten me.
Cheers Bob

Hi Donald
Just re reading some posts and noticed this bit.

You are correct here. Since that post I have had a look at the LTC4311 data sheet. It does indeed just sit there not interfering at all until the slew rate or rise time gets to a point just before it would have an adverse effect on signal quality. The monitoring of the slew rate is done continuously.
Then it springs into action and partially bypasses the pull ups allowing more current to dump into the cable capacitance thus charging it up much quicker and decreasing the pulse rise time.
Although this time is very short the extra current has to be provided from somewhere. If the driving device (Arduono or RPi etc) can’t cope it will have to be provided externally.

This device looks OK but has a limit when the cable capacitance reaches a point when the time constant is just too long.
Then I think the SparkFun devices would be worth a look The end devices would be used at the cable run end points with the appropriate cable terminations. The midpoint devices used at any intermediate drop points. Rather like RS485.
Cheers Bob

Thank you Robert for confirming my non-technical suspicion. That is why I try to mention both options.

I still am wondering … if a LTC4311 extends the distance i2c can be used over, would 2 LTC4311 units be effective to gain a bit more distance ? My guess is … yes - but the amount of extra distance will reduce markedly, as the wire capacitance increases and the 5V source nears its max limit. Depends on too many unknown factors to be a serious recommendation.

My thoughts here was to start with a discussion, then see if we can follow-up with some sort of controlled field test.
In theory, if you move the plates apart on a capacitor, the capacitance reduces.
So, for example, using UTP but selecting a pair for “one i2c line” should mean the wires for +Vcc gnd clk and data should be more apart then if say, orange is ground, white-orange is clk … the same twisted pair will bring those wires closer, like the plates in a capacitor get closer, the capacitance goes up.

So if we can get some reliable tabulation of data from different controlled tests we should start to see what will work and what does not work.

Note: by controlled, at this point, I mean, only 1 thing changes.
e.g. Same Sensor, some controller, then test with lead X, lead Y etc.
We will need a way to test the effect of each test, I was thinking with a scope and rise/fall times. So to be consistant and controlled, the groups of tests should have (ideally) the same test gear, hooked up the same way.

Given all of that, i suspect Im kinda making it a bit to hard to have people test and contribute so we could break the results into test groups that a single use found improve or made worse the i2c data connection.

While we have been talking about rise times, I expect the fall time is as important. if you just provide a strong high current “fixed” power, this will make it hard for the transmitter to pull down the line. if it cant pull down, we cant change the bit state :slight_smile:

Hi Michael
I don’t like to put a dampener on what is ideally a good idea. But I don’t like your chances, too many variables.

Your open wires = less capacitance is sound but would only be practical for short wires or PCB. Which incidentally is what the I2C system was designed for.

Once you start using a “cable” as such all sorts of things come into play. The bit that concerns us here is capacitance. I think when you get to a couple or more metres to minimise stray induced problems you should run Clock and Data in 2 twisted pairs. like Clock/Ground and Data/Ground. The 2 ground wires connect together at the ends. I have used this technique coupled with low capacitance cable to extend RS232 to over 75 metres.
Cable capacitance where published usually refers wire to wire cap in a pair. Twisting the wires would not make a great difference to the capacitance but as stated above minimises induced interference.

If you want to help reduce the cap do not usePVC insulated cable. Use Polypropylene or Polyethylene insulation and you will halve the pF/metre figure or even better with Polyethylene.

As for experimentation I don’t see what is wrong using short connections with an external cap to simulate a length of cable. After all it is the total capacitance which is the important number here and I think there a quoted limits I saw somewhere for successful I2C operation. This method would be easier when looking at a particular extender operation.

By the way the statement

I have seen in a few places now is I think a mistake of some description. I think the cable cap is the same whichever direction the signal is travelling. 100ft of the cable in question is about 1585pF.

In all or most waveforms I have seen it is the positive transition which is causing a problem. This depends on the pull up value and cable cap. Reducing the pull up reduces the time constant so appears to improve operation which it does. That LCT4311 connects a Mosfet with limiting resistor across the pull up for a very short time thus speeding up the cable charging. You might have to find some extra current from somewhere depending on the parent device capabilities. But this has its limits too.

The negative going transition depends on cable cap and the capacity of the driving device to sink the charge current quickly and take the point to ground. Problems would arise when the charge is too great for the amp sinking capability add/or the output impedance is high. These 2 usually go together somewhat. I think the LCT4311 also momentarily switches a Mosfet to ground to assist here.

Sorry to be a bit long winded but I can’t see a simpler way to put my thoughts to paper.
Cheers Bob

Hi Donald

No. The LCT4311 has a limit. I forget what it actually is. The data sheet will tell you in amongst all that math. The IC does not change the time constant but only helps charge the cable a bit quicker.

When the time constant gets absolutely too long I think the LCT4311 ceases to work properly and I do’t think an additional device would help this.

This would be a case for looking at the SparkFun device.
Cheers Bob

1 Like

Yeah, I can 100% see that… I still think it would be good to see what tests people have done and their results.

Based on the following
src: https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000001EAc6CAG&l=en-AU

So if the stock cable has 400pF limit and the extender claims to allow 3000-4000pf that should give a fair boost in distance (assuming cable type is the same or better)

If we go with the 52pF for catv cable/m as per that link above, then
4000/52 = 76.92307692307692 M … I would like to see that :slight_smile:

Hi Michael
“the meter-to-capacitance ratio of your selected cable.”
Quote from that link. Whoever wrote it can’t even spell “metre” which it should be in that context.

Thar
That linked cable is Cat 5 cable. For ordinary multi pair PVC cable you are looking at 100pF to 150pF per metre. Those numbers taken from a Hartland cable catalog. From the same book you could do as I mentioned above and use low cap cable as I noted above. Polypropylene is 50pF/metre and polyethylene is quoted at 40pF/metre so I think maybe Cat5 cable could be polypropylene insulation

On another note that claim of 3000-4000pF should be accompanied by a pull up resistor value. As this has just as much influence as cable cap one should complement the other. The quoted number means nothing if the statement is not complete. This is the sort of thing I tend to disregard most of the time BECAUSE it means NOTHING.

That 76metres would be something wit I2C like you say. Although in the old days RS232 used to be considered 2m max. Then along came the low capacitance types so the spec changed from a cable length to maxim allowable capacitance which is really a better way to spec this sort of thing.
As I described above I have used RS232 over 75m using the altered wiring technique.
Cheers Bob

Yeah pull up.
An ESP32 GPIO pin can sink 28mA.
So to pull down the line, if the supply current is > 28mA it will either, just not do it or worse, cook something as it tries.

So 3.3V 28mA
R = V/I
= 3.3 / 0.028 = 117.857 ohms.
so any smaller then that we can start to have issues.
Any dynamic power supply to the pull up, would need to detect the pull down effort and cut its supply.

edit:
On the 28mA that should me max, recommended its 12mA- 20mA per pin..

Hi Michael
That 3000 - 4000pF is a fair bit of current to dump. Albeit for a very short time (hopefully). The damage to electronic bits is usually cumulative so any malfunction may take some time to appear which is the worst kind of problem.

Previously when I said I would think about this charge and discharge problem I had Mosfets in mind but I did not know how I would switch them at the correct time.

Then Donald I think it was linked a couple of devices. I discovered that the LTC4311 IC has done all this on one dedicated chip. Saves me a lot of headache. This chip monitors the slew rate /rise time of the positive going and negative going slope and if too slow switches one Mosfet to charge the cable and another to dump an existing charge quickly to ground. Depending on which way the signal is going at the time.

This however has its limits as detailed in the data sheet. I think for longer runs I would go for the SparkFun device which uses 2 pairs of a Cat 5 or similar cable and completely isolates the transmission line from the I2C system which only sees the bit of local short wire. Not unlike RS485.
Cheers Bob