• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

I2C Max cabel lengh?

Status
Not open for further replies.

large_ghostman

Well-Known Member
Most Helpful Member
I have some temperature and humidity sensors that are I2C, while I could use different sensors, these ones only come in I2C. I have used them with upto 1m cable length without issue. What is the maximum practical cable length for I2C? My latest use would require 3-5m. input voltage is 3.3V.
 

Pommie

Well-Known Member
Most Helpful Member
If you are using cat5 cable then it will probably work fine if you reduce your pullups to 2.2k and reduce your baud rate to something like 50k. If you have reliability problems then consider reducing the baud rate further. Note that i2c is not time dependant and will work at any baud rate.

Mike
 

Mosaic

Well-Known Member
You can prob. get more range using some tristate buffers or transistor drivers to handle the longer cabling capacitance. Perhaps up to a dozen meters or more.
 

JonSea

Well-Known Member
Most Helpful Member
Mike,

"Reducing pullups" is always one of those terms I have to read carefully to understand and my first reading was wrong I believe (I just had a total knee replacement so I blame it on the drugs).

You mean reduce the value of the pullup resistors (I typically use 4k7) to increase the pullup current. Now that makes sense.
 

JimB

Super Moderator
Most Helpful Member
my first reading was wrong I believe (I just had a total knee replacement so I blame it on the drugs).
Just a knee jerk reaction? :D

JimB
 

large_ghostman

Well-Known Member
Most Helpful Member
Thanks, actually I wasnt using cat5 cable, but I will switch it over.
 

schmitt trigger

Well-Known Member
I've been using up to 3 mts for the same purpose (external temp/humidity monitor), but I would get bus hangups sporadically (at least once every 24 hrs).

I had to incorporate a bus hangup test, and perform a bus clearing routine, which consists of toggling the clock line 9 times. This trick is described on the NXP webpage.

I know that I should go back and improve the hardware, but so far the software "patch" has been saving my bacon.
 

JonSea

Well-Known Member
Most Helpful Member
Why not just do the clearing exercise periodically, even before each read?
 

Nigel Goodwin

Super Moderator
Most Helpful Member
I have some temperature and humidity sensors that are I2C, while I could use different sensors, these ones only come in I2C. I have used them with upto 1m cable length without issue. What is the maximum practical cable length for I2C? My latest use would require 3-5m. input voltage is 3.3V.
This is a classic case of trying to use an inappropriate connection method, I2C was designed for interconnecting IC's on the same PCB.

If the sensor is only available as I2C?, then simply use an 8 pin PIC (or other controller) to read the sensor via I2C and communicate back via a more suitable system.

My temperature/humidity sensors, while not I2C, do just that - they connect via a 16F1827 PIC to an HC-12 wireless module. Each module has an address (in my case just a single letter, but you could easily use more), and is read in turn by a PC program wirelessly, but the 'master' device could just as easily be a PIC or anything else.
 

large_ghostman

Well-Known Member
Most Helpful Member
This is a classic case of trying to use an inappropriate connection method, I2C was designed for interconnecting IC's on the same PCB.

If the sensor is only available as I2C?, then simply use an 8 pin PIC (or other controller) to read the sensor via I2C and communicate back via a more suitable system.

My temperature/humidity sensors, while not I2C, do just that - they connect via a 16F1827 PIC to an HC-12 wireless module. Each module has an address (in my case just a single letter, but you could easily use more), and is read in turn by a PC program wirelessly, but the 'master' device could just as easily be a PIC or anything else.
This was my first thought, but the sensors are inside an incubator. Having said that, it might well save me some issues, seeing as i am going to use a hub for data logging.
 

large_ghostman

Well-Known Member
Most Helpful Member
Handy little chip that KISS, cheers, I have saved that for future reference!! I would use it for this, but if I end up using the pi as the data logger and web interface, I might as well go wireless direct to the pi.

But I will order a couple of those chips, handy things to have around.
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top