Pi Day has been and gone for this year but I can't resist doing one more very simple electronics

experiment. I'm going to do it quickly, without a great deal of precision, simply to look at the

basic ideas involved. If you want to see it done better, and you have a Pi and a reasonable

oscilloscope, you could try it for yourself. This is a follow-on from my Pi Day blog, which you

can find here Experimenting with a Raspberry Pi GPIO Pin  .

 

OK, what simple experiment can I do with this collection of items? A Raspberry Pi 3 Model B+, a

couple of 1m 50 ohm coax cables [RG58C cable], a 22R resistor, and a SIL connector.

 

 

Yes, I'm going to experiment with a transmission line. (Hopefully you already knew that from

reading the title.) There are various ways we can drive a transmission line. One popular way, in

the situation where we have transmission from one output to one input and the input at the end of

the line is a high impedance load, is to series terminate. This has a single resistor at the

transmit end. Here's how my experiment looks on paper:

 

 

Having previously determined that each of the pair of MOSFETs in the pin driver has a resistance

of about 30 ohms when turned on, the output will, crudely speaking, look like a voltage source in

series with 30R. To series terminate that to a 50 ohm cable, I'll need about 20 ohms of

additional resistance in series. That's where the 22R resistor comes in.

 

Here's what it looks like connected up to the Pi.

 

 

As before, I'm going to use a simple Python program to drive the pin. This time it will take the

pin high, immediately take it low, and then wait for a while. The wait between the high pulses

that I generate is there in case I accidentally short the output after the 22R - it will keep the

average pin driver dissipation down to something fairly safe, even though it would be sourcing

something like 66mA for the short time that the pin was high.

 

This is how the output looks with no coax connected to the BNC socket.

 

 

The Python program manages to take the pin high and then low again in about 4uS, though the width

is very variable (which we'd expect as interrupts aren't disabled). It is fine for what I want

here. I'm not interested in the pulse width itself: I'm going to be looking at the start of the

pulse and what happens over the first few tens of nanoseconds.

 

Here's the leading edge in more detail. I'm probing this without the probe's flying ground lead,

using the collar for the ground connection instead. Ideally, I'd use a connector or some handmade

'springy clips', but, being lazy, I'm just precariously holding the probe in place and trying to

operate the 'scope with the other hand. Don't worry, trust me, it'll work! There's a small amount

of ringing evident on the trace, but it's not too bad [this is all going to be less than perfect

because of the signal having to find it's way across the Pi board and through the connector,

before encountering the 22R, but it's good enough for my purposes here].

 

 

Now. What I'm going to do is I'm going to connect the two lengths of coax to the output, with a

'T' piece connecting the two together. BTW there's nothing significant about two cables and a 'T'

piece: I just wanted something a bit longer than a metre to work with. The T piece will have very

little effect: it maintains the 50 ohms impedance of the cable nicely through the junction and

the stub it adds is so short that I probably won't even be able to see the effect on the trace.

 

So I have a 2m length of coax on the output, with nothing at the other end. The far end is just

an open circuit.

 

The result is this

 

 

Initially, the characteristic impedance of the cable (50R) forms a potential divider with the

series-termination resistance (50R). Since they're equal, the level we see is half of the supply

voltage. The signal propagates along the cable at a steady rate, charging the incremental line

capacitance, as it goes, to half the supply. The charge current is 3.3V/(2 x 50R) = 33mA. The

reason that the voltage doesn't change, like it would with a lumped capacitor is that the

capacitance involved is steadily increasing as the signal propagates along.  When the signal

reaches the other end, it discovers that there's nothing there. But it doesn't stop. Instead it

reflects from the end and propagates back along the cable, now charging the distributed

capacitance to double what it was before which, if we've got it right, will be approximately the

rail voltage. When it gets back to the start, everything finally stops because the series

termination resistor now has no voltage across it, so there's no longer a charging current to

keep everything going. Hope I got that more or less right [please tell me in the comments

if I have it wrong].

 

Note that the characteristic impedance isn't a resistance. The line isn't dissipating power,

instead it has stored the energy in the electric field that's established between the inner and

outer conductors.

 

For a much better treatment, read a text book or look at the Wikipedia article linked below.

 

With cursors measuring the interval between the two edges it's like this

 

 

and from that I can see that the 'there and back' time is 25.44ns. The one-way distance is 2.47m

(when I measured them, the cables turned out to be longer than the nominal 1m that they were sold

as), so the time per metre for the signal works out to be 5.15ns. The wave velocity is then

3.333ns[time for photon to travel 1m]/5.15ns x 100% = 64.7%. The value given on a datasheet is

around 66% for RG58C, so I'm in the right sort of area.

 

What else can I work out about the cable? How about the capacitance per unit length? I know the

length, the time, the voltage that we charge to, and the current, so I can work it out from

C = i dt/dV = 33mA x 25.44ns / 3.3V = 254.4pF total or 254.4pf/2.47m = 103pF/m.

I've got a datasheet that gives 101pF/m for RG58C/U, so close enough given a very simple

experiment [hmm, I suspect I was a little bit lucky there].

 

So, what does the signal look like when it reaches the other end? From all of the above, you

might be worrying that it's a mess, but it all works out right. At the far end, when the signal

reaches that point, the signal reflects and immediately doubles, so the waveform seen by anything

with a high impedance (like a CMOS gate input) will look very like the original signal coming

from the IO pin.

 

Here it is. The signal at the start of the line is yellow again, the signal at the other end is

blue. I did that by simply plugging the end of the BNC cable into the second channel connector,

so the termination is 1MEG and 11.5pF.

 

 

Um, except that's wrong. The signal is emerging before it should do. [It appears to be getting to

the end faster than a photon in free space could, which is going some! Hang on just a minute

whilst I run off and patent my faster-than-light gadget.] On second thoughts, the reason is

really that the two channels of the scope are only time-balanced if we have similar probes

attached to both channels. Here it is again with the cable output being probed by another 10x

probe, identical to the first.

 

 

Now the output is in the right place, halfway along. Whilst not perfect, the signal at the far

end isn't too bad given that it has travelled a couple of metres and the series termination at

the start is far from perfect anyway [ideally, the resistor would be right next to the processor

pin].

 

Update 24th March 2020

 

I found a short length of CAT-5E cable, 2.11m in length [no screen, just the four twisted pairs], so I thought I'd try the same test as I did with the 50R coax on a single pair in the cable.

 

 

The characteristic impedance is apparently 100R, so I've used a 68R series resistor for the termination. Here's how it looks at the sending end.

 

 

That works out to be a velocity factor of 63.7%, so a little slower than the coax.

 

Here's what emerges at the other end [blue trace].

 

 

It's not as nice as the coax: the probe connected at the end seems to be having more effect on the waveshape than what I saw with the coax.

 

I hope that was all of some interest. Not sure the Pi area was quite the right place for it, but

never mind.

 

[1] https://en.wikipedia.org/wiki/Transmission_line
[2] High-Speed Signal Propagation. Johnson and Graham. 2003. Prentice Hall
[3] Transmission Lines for Communications. C. W. Davidson. 2nd Ed. 1989. Macmillan Education.

 

If you found this interesting and would like to see more blogs I've written, a list can be found

here: jc2048 Blog Index