# Computing stuff tied to the physical world

## What if the signal lines are very long?

In Hardware on Jun 19, 2013 at 00:01

Welcome to the weekly What-If series, also available via the Café wiki.

This question came from figuring out how to drive an SPI chip over a few meters distance. Normally, you’re not supposed to do that: I2C and SPI in particular are designed for use on a PCB, i.e. distances in the order of dozens of centimeters at best. Fortunately, in this case speed was not an issue, so what if we simply take the clock signal way down, to say 10 KHz (50 µs on + 50 µs off). Can we create a solid SPI setup across a few meters of wiring?

To try this out, I decided to take a reel with some 70 to 80 meters of multi-core wire:

Being untwisted and unshielded, this is probably as bad as it gets for signalling purposes. Then I started with a clean 10 KHz square wave of 0..5V from the signal generator:

Here’s what happens to the signal on the signal generator side (i.e. same probe placement), when simply connecting the open wires of the above cable to signal and ground:

This is caused by the load and the reflection of the signal on the end of that long cable. Think of it as an echo of that voltage change, propagating back and forth and colliding with the signal – causing this fairly substantial change in signal rise time and shape..

But to really see the effects, we have to also look at the signal at the other end, where it’s going to be picked up and used. I made the following setup, with three different probes:

(sorry for the confusion: “B” and “M” were mixed up in this drawing)

• YELLOW probe on the incoming signal generator end
• MAGENTA probe on the outgoing signal
• BLUE probe on the outgoing ground connection
• RED is the MAGENTA minus the BLUE level (as math function)

All the vertical scales are set to the same 1V per division from now on:

Note that there are some really strange effects in there: the magenta output signal is “ringing”, as is to be expected with such a long coil of wire and lots of stray capacitance, inductance, and resistance. But the blue “ground” level is also ringing, almost as much in fact! And the yellow input is funny, too. Let’s zoom in a bit on that rising edge:

What does this mean for signal propagation? Well, as you can see, everything rattles and shakes in situations like these. It really makes a difference for example as to how the end is connected to power. If you use the (blue) output ground as reference, then the signal will appear as the difference (i.e. the red line), which has less extreme ringing than if you use the (magenta) output referenced to the incoming ground pin.

None of these effects are problematic at this 10 KHz signalling rate. If you need to pass signals like these, it definitely pays to A) keep the signalling rate low, B) reduce the steepness of the edges, and C) add a fairly substantial load resistance at the end of the wire (between signal and ground, say 330..1000 Ω). The reasons and details of all this will have to wait for some future posts.

What I do want to mention, is that you can actually see the speed of light in action here. Let’s zoom even further into that rising edge (sorry, blue and magenta are reversed now):

It takes over 400 ns for the yellow rising edge to reach the other end. In vacuum, light travels some 120 meter in that amount of time – not so very different from the 80 meter or so of cable the electricity has to traverse. Pretty amazing what you can do these days, with nothing more than a signal generator, a modern oscilloscope, and a coil of wire!

1. I hope you left the wire curled up while doing the experiment. (<- sarcasm)

;)

2. If I understand correctly what you have there is a really large inductor, from the occiloscope graph you could probably even calculate how many Henries it is. Interesting test setup, because you could also watch the effect of putting a peice of iron in the coil.

I imagine a lot of the ringing would go away if it wasn’t coiled up but just scattered over the floor. And if it was stretched out it would start working like an antenna? You’d probably keep the signal reflection though.

Nice writeup!

• You’d still get ringing, and there also is considerable stray capacitance.

Think of a piece of string lying on the floor, while “sending” a square wave down the string by moving one end. The other loose end will “snap” around much further than the original amplitude. The only way to stop this effect is to terminate the wire on both ends with its characteristic impedance – that’s why 50 Ω BNC cable is normally matched by 50 Ω impedances on both ends.

As for antenna use: keep in mind that the return wire is essentially in parallel with the signal going out. So every electron going one way is paired up with an electron going the other way right next to it. That more or less cancels all electromagnetic emission.

I’ll need to dig deeper (and read up on it) to further analyse this topic, food for some future posts I hope.

3. The propagation speed of an electrical signal through copper is only about 2/3 of the vacuum speed. That means ~5ns per meter, where light takes only ~3ns.

• Great – so theory meets practice nicely in this case!

• It is a bit more complicated than that.

For a high frequency signal you have to take the parasitic inductance and capacitance into account. The result is then called a velocity factor and you can usually find it in the datasheet (if the manufacturer intended the cable to be used that way..).

The propagation speed is also influenced by the insulation, because it acts as dielectric and modifies the capacitance.

But I only deal with radio frequencies so 10kHz might be a bit different because of almost no skin effect for example. (My VNA does not even measure such a low freq)

4. The last ‘scope capture is a fascinating glimpse into signal propagation ‘for real’ with the transit time clearly visible. But it also poses another teaser: if nothing can happen at the remote end until the source ‘edge’ wavefront has traversed the length of the cable, why can you see activity within ~10 nanoseconds?

The key is that the ‘length’ is for convenience still just unscreened cable rolled on a drum. Some energy from the wavefront takes a capacitive short cut from one layer of winding on the drum to the next and so on through to the output.

At the risk of festooning JCW’s workarea with a giant spiders web of unspooled cable, those ‘pre-event’ artifacts would be attenuated by unwinding from the drum.

An easier demonstration is done with a drum of co-axial cable: the screening suppresses the interlayer coupling interference and the time delay fits c x velocity factor (always in the spec sheet for good quality coax cable)

5. I would love to see captures of twisted pair in the same situation to see the difference. Its one thing to know in theory that it helps and another to see the actual waveform.

6. I’m too am interested what a twisted pair screened cable would be like.

7. Me three… but it will have to wait, I’m afraid. I’ve got some other work and posts queued up, and have the summer break coming up at the end of this month. This whole topic deserves more attention and experimentation, IMO.