I think this question is asked a lot, but i can't seem to find a straight forward answer.
What is the maximum SPI length?
I want to control 6803 LED strips, and place the controller about 15-25ft (3-5 meters) away from the LEDs, I will be driving about 400 LEDs connected end to end (but the power is separate).
Or would i be better off getting another arduino and somthing like two xbee wireless controllers to send a couple of a variables from the controller to an arduino really close to the LEDs, and send data too the LED's from the slave Arduino?
This is not quite the right question as the distance between the 2 devices has nothing to do with wither you use SPI or not. You would have the same situation if you used RS232 or 20mA or any other transmission protocol.
One of the reasons why RS232 is specified to use +3 to +25 for one "level" and -3 to -25 for the other is so that you can get a detectable voltage difference by the time the signal gets to the other end of the wire, taking in to account all of the losses (due to the impedance of the cable) along the way. 20mA loops work slightly differently in that you need a complete circuit of the 20mA current but it relies on the fact that you can drive the line with sufficiently high voltages to sustain 20mA through the circuit and still detect whether there is a current flow or not at the far end.
Now, SPI is a data exchange protocol and does not say anything about the way the SPI master and slave are connected together. When they are on the same circuit board (and therefore typically the distance is measured in a few centimeters) you can use the normal data voltages of the devices (often 3.3v or 5v etc.). You might be able to drive those voltages over a length of cable a few meters long but you will probably need to add in w=something to boost the signal to overcome the cable losses - in other words you will have the same problems that the RS232 and 20mA transmission standards are designed to overcome.
Personally, I would use a couple of MAX232 (or similar) line drivers at either end of the cable to sole the transmission protocol issue, and then use SPI or whatever other data transmission protocol you want.
Susan
AussieSusan:
This is not quite the right question as the distance between the 2 devices has nothing to do with wither you use SPI or not. You would have the same situation if you used RS232 or 20mA or any other transmission protocol.
One of the reasons why RS232 is specified to use +3 to +25 for one "level" and -3 to -25 for the other is so that you can get a detectable voltage difference by the time the signal gets to the other end of the wire, taking in to account all of the losses (due to the impedance of the cable) along the way. 20mA loops work slightly differently in that you need a complete circuit of the 20mA current but it relies on the fact that you can drive the line with sufficiently high voltages to sustain 20mA through the circuit and still detect whether there is a current flow or not at the far end.
Now, SPI is a data exchange protocol and does not say anything about the way the SPI master and slave are connected together. When they are on the same circuit board (and therefore typically the distance is measured in a few centimeters) you can use the normal data voltages of the devices (often 3.3v or 5v etc.). You might be able to drive those voltages over a length of cable a few meters long but you will probably need to add in w=something to boost the signal to overcome the cable losses - in other words you will have the same problems that the RS232 and 20mA transmission standards are designed to overcome.
Personally, I would use a couple of MAX232 (or similar) line drivers at either end of the cable to sole the transmission protocol issue, and then use SPI or whatever other data transmission protocol you want.
Susan
interesting. Why do rj45/cat6 Ethernet cables have ranges of 100m while spi (or other meathods you mention) are restricted to a few meters? Voltage?
Why do rj45/cat6 Ethernet cables have ranges of 100m while spi (or other meathods you mention) are restricted to a few meters?
Not just voltage but protocol and specilist hardware at both ends.
You have not found a definitive answer because there is not one.
All maximum length questions depend exactly on the individual circuits involved and your defination of "working". That is over what temprature range and what levels of external interference, what capacity of cable and what data rate error you can tolerate.
You are confusing two separate things: the data protocol (which is the SPI, I2C etc.) which defines the interpretation of the bits as they are passed from one device to another, and the transmission protocol which defines how the bits are actually sent from one device to another.
The type of cable you are using has only a small impact on the ability to send a signal through it. The reason Ethernet signals can go for long distances is, as Grump-Mike has said, they have specialised hardware at both ends that drive the signal in such a way that it can be reliably received at the far end. This has almost nothing to do with the nature of the signal being sent.
What is the hardware that you are using to connect to the cable? If it is coming straight from the Arduino board then it is probably not enough to travel many meters. However if you use some line drivers, then you will probably get a reliable signal to the far end.
You ask about the reason why this is so, and the answer is to do with the impedance of the line. The wires connecting the two devices has resistance, inductance and capacitance (collectively known as impedance) with the inductance and capacitance having a frequency-dependent component. While the resistance of a piece of wire is generally quite small, as the frequency of the signal increases, the inductance and capacitance can grow to be rather large. This is why you were asked about the speed of the transmissions - the losses in the cable might be small for a 10KHz signal but can rapidly rise for a 10MHz signal.
You need to think of the device doing the sending as a (say) voltage source, the wire going to the other device as an impedance, the other device also as an impedance and finally wire coming back (after all you need a complete circuit for the current to flow) as also being an impedance. Therefore the source sees all of these impedance's as begin in series which makes a voltage divider. Therefore the receiving device only ever sees a portion of the sending voltage.
In order to tell if the signal being sent is a 0 or a 1, the voltage that is seen must be within certain limits. Typically, a zero is represented by a voltage that is between 0 and 1/3x the maximum defined voltage, and a 1 is represented as between the 2/3x and 1x the maximum defined voltage.
Putting this all together, you can see that the device might only ever see a small portion of the signal that is being sent (the impedance of the cable taking the rest) and the variation if the signal that it does see might not be enough for it to reliably detect the difference between a 0 and a 1.
Transmission protocols try to solve this in several ways. RS232 for example uses a voltage difference from between -3 and -12 volts for a 0 and between +3 and +12 volts for a 1. The difference between the two is much greater than (for example) a 5V system (used with some Arduino systems) and therefore the signal is received more reliably, even over a longer distance which has greater impedance.
Hope this gives you some idea of what is going on and why you are getting the answers you are to your question.
Susan
Qdeathstar:
interesting. Why do rj45/cat6 Ethernet cables have ranges of 100m while spi (or other meathods you mention) are restricted to a few meters? Voltage?
I suspect one of the reasons for this is that they use a "balanced" protocol (like RS485) which is fairly tolerant to noise (and I believe USB is similar).
However I also suspect that AussieSusan know more about this than I do.