Length of I2C and One Wire Buses (CMM2)


Author Message
Nimue

Guru

Joined: 06/08/2020
Location: United Kingdom
Posts: 427
Posted: 10:01am 18 Feb 2021      

Via Dr Internet it seems like I2C busses can be from 3-100m depending on the speed.  Slower = longer.

One Wire seems to be about the same length restrictions.

Is anyone here using I2C / one wire devices on a bus of 20 - 30m?

Nim

jirsoft

Guru

Joined: 18/09/2020
Location: Czech Republic
Posts: 533
Posted: 10:13am 18 Feb 2021      

I have used it on 20m without problem and my friend used 100m... But just DS18b20 (more of them), nothing else. And it was no parasite power used.

Nimue

Guru

Joined: 06/08/2020
Location: United Kingdom
Posts: 427
Posted: 10:31am 18 Feb 2021      

  jirsoft said  I have used it on 20m without problem and my friend used 100m... But just DS18b20 (more of them), nothing else. And it was no parasite power used.


Thank you.

Looking to move my DS18B20 x 2 (inside and outside temps), CCS811 (Classroom CO2) and BME280 (pressure / humidity) away from the CMM2 into a nice ventilated case.

Cheers
N

Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 8964
Posted: 12:26pm 18 Feb 2021      

It depends on your cable and site. Max bus capacitance can be regarded as 400pF for use at 100kHz. For long distances you may need low capacitance cable to keep it below that. Also, pull-up resistor value changes the range. It can be advantageous to use constant current sources rather than resistors.

This NXP document has a lot of info:
http://www.nxp.com/documents/user_manual/UM10204.pdf

lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3809
Posted: 01:24pm 18 Feb 2021      

I've run 10 meters on Dollar Store 3-wire mini-stereo cable for DS18B20s (5V).

For extra-long I2C I've used the P82B715PN DIP PHILIPS i2c extender (on 50 feet (15 meters) of CAT6).

Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 5994
Posted: 07:04pm 18 Feb 2021      

I2c stanard is developped by Philips to communicate between ic's on a printed cicuit board. This is a controlled environment with limitted bus length. The i2c bus design is not robust per design. Compare i2c to ethernet to understand the difference. Ethernet knows collision detect, retries, cable compensation.

Although every situation and location is different, i would never use i2c outside its controlled environment (read: closed box) , especially not if the application is mission critical.

Just to give some background info on this: i am a senior electronics engineer and have been fighting the lack of immunity of an i2c bus sytem for ESD for the last weeks. If you have a noisy environment (esd or surges or eft) the i2c bus is a baby that requires very soft gloves.....outide the house is a typical uncontrolled environment with lightning, esd, power grid, ground loops, motorcyles(ignition ), belt grinders, milking machines, radio and tv transmitters, whatever your environment has.

In short: if you want to measure humidity outside for fun: go ahead and use i2c sensors.
If you plan to control your heating system, or solar farm with sensors, please dont use i2c but look at 20ma sensors (industrial) or rs485 serial with preferably a modbus protocol.

Volhout
Edited 2021-02-19 05:05 by Volhout

TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6546
Posted: 08:27pm 18 Feb 2021      

I have used I2C over a few metres in quiet locations as a short term fix but my preferred method is use a satellite Micromite 170 with the sensors and run RS422 over cat 5 or 6 cabling. I have runs up to 50-60 metres. The same cable also supplies the power to the sensor module.

I have lost some of the equipment due to lightning strike but seeing that I did loose just about every electronic device in the house with one strike a few years ago, I do expect the occasional loss.

Jim

lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3809
Posted: 09:05pm 18 Feb 2021      

Another alternative is to go wireless if you have power at the sensor location. An esp-01 or d1 mini can control the sensors and write their readings to a web page. The CMM2 with an esp-01 can read the web page and harvest the data.

I've just done that sort of thing with an F4--posting later today.