SPI and I2C long distance?

Hello i was wondering for SPI and I2C how far can i run a sensor without having some problems with it? I been searching online and getting some mix results online on how far i can run a Sensor on SPI or I2C. Can someone help me to figure this out.

P.s.s I'm running some temperature sensor Dht22. I need to run it upto 15Ft in any direction. Is this possible or would i have some problem with Data traveling that far?

Edit: I'm sorry i forgot to ask one Question. Would i need thing to run long distance Externally?

Joseph

A few meters is long distance for SPI and I2C. Reportedly it's possible to get it to work over 5-10m cables but whether it works depends on the overall project.

I don't know the limits for the DHT22. That's a different thing. Again the overall project layout will matter - so try it!

Hello wvmarle, Thank you for that information. I'm trying to setup 4 Dht22 sensors about 10FT to 15FT the most apart from each other. Being the arduino is in the center of it all.

Joseph

I have I2C working reliably over about 25 to 30m.
Use low value pull up resistors, maybe 1k.
Set the clock frequency as low as possible, 10kHz if the board you are using will allow it.
Use twisted pairs. I use telephone cable, not tried cat 5. There is a significant difference in characteristic impedance between telephone cable and cat 5, I don't know if this will matter.
I suggest:
1 pair ground and SCL
1 pair ground and SDA
1 pair both wires Vcc
Probably helps to put pull up resistors at both ends, so 2k resistors at each end instead of 1k at one end.
Put a capacitor across the power at the remote end to clean up any noise it picks up, maybe 10uF.

What happens if I use a temperature sensor that is 3.3v compare to a 5v sensor, Would that make a difference in how far i can push the data?

Joseph

Try it!

I am using DS1624 temperature sensors, I seem to be the only person who uses them. Currently on 3V3, no problems.

Hello thank you i will try it. The only problem is i have no phone wire just only network wire. Because that is all i do all day is setup network systems. I will try it on a short length of wire and then work my way upto the lenght i need it to be,

Joseph

I suggest you go straight to the length you want. I've not experienced any significant problems with using I2C over the distances I mentioned.

PerryBebbington:
Use twisted pairs. I use telephone cable, not tried cat 5. There is a significant difference in characteristic impedance between telephone cable and cat 5, I don't know if this will matter.

I thought for I2C it's mostly the stray capacitance that matters - the specs say no more than 400 pF allowed. Stronger pull-ups and slower clock will allow for higher capacitance, as long as rise times are fast enough

wvmarle:
I thought for I2C it's mostly the stray capacitance that matters - the specs say no more than 400 pF allowed. Stronger pull-ups and slower clock will allow for higher capacitance, as long as rise times are fast enough

Yes, I agree.

I actually have SCL and SDA on the same pair, but this is wrong because of the possible crosstalk and that the return path for the pulse is a different pair. However, it works and it doesn't give me any problems.

It is so reliable that at one time I was getting intermittent errored readings from one of the DS1624s, note that I was getting good date some of the time, it had just become unreliable. When I checked I found the +ve supply wire had come off at the particular DS1624, so it was being phantom powered from SCl and SDA. It still worked, just not very well. The other DS1624s were unaffected.

Hello i have tested the i2c using 6 of the sensors i need to they are the si7021 temperature and humidity sensor.

I needed two sensors at 1ft from the arduino that worked with no problem.

I needed two sensors at 6ft from the arduino that worked with no problem.

I needed two more sensors at 12ft from the arduino that worked with no problem.

all sensors had two resistors on the i2c lines coming from each device. Also i have used Telephonecord they come in 4 wires. That was enough for what i needed. I couldn't use jacks on them because i don't have any of the Rj11 jacks or end connectors. So what i did was i solider the wiring to a prototype pcb board and then some male header pins to sit on top of the arduino. It looks like everything is working so far. Thank you very much for the help. I wish i can post some pictures but I didn't take any and I'm writting up everything. When I'm done with testing i will post some images.

Joseph

Hello do you think there might be some problems also with using a Ds18b20 one wire temperature sensor over long distance? About 20ft to 30ft? I'm going to try it also but i just wanted some feedback if anyone has anyproblem with it and what should i look out for?

Joseph

I've never used DS18B20 so can't comment, sorry. Try it, then you will be the expert!

Glad you got your other stuff working ok.

There is a whole application note on how to use that sensor with long wires (where 20-30 ft is not even particularly long). Note that it's about the total length of the wire, not the individual strands. Wire network topography (if using more than one sensor) matters as well.

josephchrzempiec:
Hello i was wondering for SPI and I2C how far can i run a sensor without having some problems with it? I been searching online and getting some mix results online on how far i can run a Sensor on SPI or I2C. Can someone help me to figure this out.

P.s.s I'm running some temperature sensor Dht22. I need to run it upto 15Ft in any direction. Is this possible or would i have some problem with Data traveling that far?

Edit: I'm sorry i forgot to ask one Question. Would i need thing to run long distance Externally?

Joseph

High speed SPI is definitely deisgn for the same PCB - like any high speed logic signal it
won't tolerate long runs.

I2C is typically used at a lowish bandwidth, and would tend to fare better as a result, but its
still designed for same PCB use.

long runs are best done with something tolerant of signal reflections such as serial which doesn't
use a clock line. Double-clocking is one of the first problems you are likely to encounter if
trying to run a logic signal too far, alongside crosstalk.

For very long runs an impedance matched connection, such as RS485, is recommended.

The DHT22 doesn't use SPI or I2C - in fact its protocol is explicitly designed for low bandwidth
and should be pretty robust over long runs.

Note that with long runs you need to be careful to protect the chips at either end from noise pulses
caused by mains switching and lightning - make sure the ground wire is solidly connected, and
adding a series resistor of 100 ohms or so to the signal line is useful both for protection and to
reduce reflections from the sending end.

I will try the 100ohm resistors in series wit it when i try it out. Keeping the project protected i like a lot. I'm reading up well watching a video on about reduce reflections.

Thank you

Joseph

josephchrzempiec:
Hello do you think there might be some problems also with using a Ds18b20 one wire temperature sensor over long distance? About 20ft to 30ft? I'm going to try it also but i just wanted some feedback if anyone has anyproblem with it and what should i look out for?

Joseph

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.