Cable impedance profile with NanoVNA and TDR script

Browse By

We have gone over NanoVNA so many times in the past. I did a complete review of the inexpensive NanoVNA last month. Furthermore, I compared it with the super-expensive Keysight N9952A Vector Network Analyzer. Finally, I wrote a small script to compute the TDR response from the S-parameter data that NanoVNA gave us. Today, I wrote a small extension to the TDR script to plot the impedance profile of a cable. In this article, we will go over the basic mathematics involved to compute the impedance profile and finally, you all get the script to try it out.

Understanding the concept

Computing TDR (time domain reflectometry) from frequency domain data results in what we call as the "impulse response". In other words, it's the response of the DUT (device under test) when we inject an impulse. In our previous test case where we used a segment of a cable as the DUT, the impulse went through the cable and reflected back from the open end. Remember that in our case, this impulse is imaginary because we are never sending it in the first place, instead synthesising it using the Inverse Fourier transform.

According to a Keysight Application note, we can derive the impedance profile of the cable if we obtain a step response instead of an impulse response. Now, what is a step response? The step response is when we apply a sudden step signal at the input of the DUT. A step looks like the sharp square wave except that the voltage transitions from 0V to 1V (or whatever volts) and stays there forever.

Unit step function

For those of you who don't know, you can obtain a step response of the DUT if you already have the impulse response.

Finding impulse response and step response involve slightly advanced knowledge of signal processing. You can skip the following section.

In order to find the step response of any system, we need to convolve the impulse response with the step input.

\(y(n) = \sum_{k=-\infty}^\infty h(k)u(n-k)\)

Since, TDR response is \(0\) for \(n < 0\), the lower limit of the summation changes. Additionally, we are only interested in convolving up to \(N\) where \(N\) is the number of \(FFT\) points.  Thus, the equation changes to the following

\(y(n) = \sum_{k=0}^\infty h(k)\)

Once we obtain the step response, we are very close to plotting the impedance profile. Remember, that the \(S_{11}\) is return loss. We need to convert return loss into impedance \(Z\).

To do so, we follow a simple derivation below.

\(S_{11} = \frac{ Z_{in} - Z_o }{Z_{in} + Z_o}\)

Therefore, rearranging the terms gives us an equation to compute \(Z_{in}\) from the \(S_{11}\).

\(Z_{in} = Z_o \biggr(\frac{1 + S_{11}}{1 - S_{11}}\biggl)\)

Now, let us try to implement this in Python.

Python implementation

As mentioned earlier, the TDR script gives us the impulse response of the DUT. We now compute the step response by adding a few lines in the script.

The steps:

  1. Create a step waveform (Basically all ones in an array)
  2. Convolve it with the impulse response
  3. Transform \(S_{11}\) to \(Z\)
  4. Truncate the step response to \(NFFT\) points

The results

While testing this script, I created two test scenarios. One, with the open-ended cable. In another scenario, I terminated the cable ends with a \(100\Omega \).

nanovna impedance profile script

Open-ended cable

nanovna impedance profile

Cable terminated in 100 Ohm resistance

There are two things to observe above. The impulse response peak and the sudden spike in impedance align quite perfectly. The second thing to note here is that the open-ended cable shows a good \(50\Omega \) impedance until the point of an open circuit. From that point onward, the impedance spikes to very high levels; an indication of open circuit cable. Ideally, it should approach \(\infty\).

In the second image, we are looking at the second scenario, where I terminated the cable in \(100\Omega \) resistance. Instead of approaching \(\infty\), the impedance graph settles at \(100\Omega \). This indicates that our script is working as expected. If any of you have the time or means to do a multi-impedance plot, go ahead. All you need to do is attach different impedances along the length, and we should see a corresponding variation in the graph.

The cable terminated with a 100 Ohm resistance

The full script is below.

Let me know what you think about this script in the comments below.

If you haven't purchased a NanoVNA yet, go ahead and get one. It's worth it!

BUY nanoVNA - Amazon 

Incoming search terms:

If you liked this article, feel free to share it. It will help us a lot!
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

One thought on “Cable impedance profile with NanoVNA and TDR script”

  1. Neha says:

    Very nicely done …good job Salil

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.