# Matching impedance using NanoVNA v2, NanoVNASaver and SimSmith

03 Jun 2021 - tsp
Last update 03 Jun 2021
16 mins

In the following blog post I provide a short summary of impedance matching of the deflection optics of an electron deflection system (would work the same way for antenna matching networks though) using the NanoVNA v2 to measure characteristics, NanoVNASaver to capture the measurements and SimSmith to simulate the responses and generate Smith charts for matching networks. The same type of tooling can also be used to measure characteristics of any two port network using the same devices and tools - one just has to use two port Touchstone files between NanoVNASaver and simsmith in this case. I’ve also used this approach for antenna matching previously. If you’re curious about why there are complex impedances and how inductors and capacitors are influencing waves I’ve already written a short summary on that previously.

## Hardware used

The network analyzer that has been used to perform the measurements has been a cheap NanoVNA v2. These devices are sufficient for most applications in the lower frequency ranges from around $50 kHz$ up to around $3 GHz$. Since the deflection system is a single port device only one port of the network analyzer will be used - thus only the S11 scattering parameter will be measured. This parameter describes the energy reflected back into the analyzer.

Since my analyzer provides connection via N connectors (these are weatherproof high frequency connectors usually specified up to 11 or 18 GHz) I’m using a simple N to SMA adapter followed by a SMA to BNC converter. The last one has been used since we’re using mainly BNC connectors in the laboratory and I had to build an own coax cable that’s then connecting to the deflection plate - and only BNC crimp connectors had been currently lying on the shelf.

Then I used a 1.5m BNC cable that was then attached to the plates via an RG178 cable stub attached to a simple BNC crimp connector. This stub then has been attached using a custom crimp connector to the device socket.

To account for this whole cabling chaos a network analyzer has to be calibrated. There are two ways one can do this:

• Calibrate on the device using a calibration kit
• Calibrating in the readout software

I did both. Calibration is done using three measurements for single port measurements:

• Measuring a open cable
• Measuring a cable shorted at the end
• Measuring a cable terminated with a perfect matching ohmic resistor (50 Ohms)

In case one does measure a two port network one would also measure the through connection where one perfectly attaches port 1 and port 2 cabling at the place the device under test will be located at. Using this data the network analyzer can compensate for any cabling effects. One should note that this way it’s also possible to manufacture cheap network analyzers anyways - their whole hardware design isn’t perfect either, the effects are just removed by clever calibration of the devices. This is of course also required for high end devices that we’re usually using.

I’ll write a little bit more on calibration including smith charts a little bit later.

## Software used

The software used (described for FreeBSD in this blog post) has been:

• comms/nanovna-saver to communicate with the NanoVNA, perform measurements and output Touchstone 1 port files (also see the corresponding webpage)
• science/simsmith can then be used to simulate and calculate matching networks attached to the measured device by importing the Touchstone 1 port (or in case a two port network also the 2 port Touchstone files - when one also wants to include the model of an real matching network). See their website for further details on the many capabilities and way better descriptions of this program. I’ll limit myself to the parts required for the given task.

Installation works as usual either from packages or from ports:

sudo pkg install comms/nanovna-saver
sudo pkg install science/simsmith


SimSmith should work out of the box as usual for proper Java software, as usually for Python software SimSmith is a little bit more tricky to get up and running - but in this case this ad been resolved easily. I just had to apply a little patch found in a mailing list discussion by copying the proposed content to /usr/local/lib/python3.8/site-packages/NanoVNASaver/Hardware/Sysctl.py (note that the location of this file is of course dependent on your local setup - if you require such a patch one see’s this in the exception report during the crash). This patch resolved a problem with nanovna-saver directly parsing sysctl output which is a bad habit unfortunately.

One also has to make sure the current user is able to access the USB port. The NanoVNA is recognized as an serial device as usual for cheaper USB gadgets which makes it’s usage rather simple. One can either manually change the access permission or user/group of the VNA using traditional commands such as:

chown USERNAME /dev/ttyU0


or by using devd to automatically assign all recognized devices to a fixed group that the user is a member of - which is a good idea. A possible /usr/local/etc/devd/usbserial.conf could look like this:

notify 100 {
match "system"    "DEVFS";
match "subsystem" "CDEV";
match "type"      "CREATE";
match "cdev"      "ttyU[0-9]+";
action            "chgrp SERIALGROUP /dev/$cdev && chmod g+rw /dev/$cdev";
};


After creating the file one just has to restart the devd service using /etc/rc.d/devd restart to take effect.

One should then be able to attache the VNA and start NanoVNASaver. On the left hand side one sees the section Serial port control where one can connect with the specific device. This will put the VNA into USB MODE.

## Calibration

Now one has to perform device calibration with the attached cabling but without the attached device under test (DUT). This is required to compensate for any effects like reflections, propagation delay, etc. by cabling. This calibration can then technically be saved and restored later on though it’s a good idea to perform a new calibration after each assembly and disassembly of the setup.

The initial calibration should be done with the device being in standalone mode using the Menu on the VNA itself:

• Select the CAL menu and CALIBRATE sub menu
• Attach the perfect open calibration kit element or leave the connector to which the DUT will be attached open and tap OPEN, wait while it’s shown in green. As the step finished the text will be marked black
• Attach the perfect short calibration kit element or short the inner conductor and ground as good as possible. Tap short
• To perform the load calibration attach a perfect termination ($50 \Omega$) to the end of the cabling.
• In case you want to perform measurements on a two port network or using a reference antenna (i.e. S12, S22 and S21 parameters in addition to S11) connect both ports with a perfect match and tap thru

The other calibration that is available can be done in nanovna-saver. I’m usually also performing this calibration that’s then applied by the application after readout of the data and do perform a reference measurement after that to verify the calibration succeeded. To do this one has to:

• First configure the frequency range one is going to measure. This is crucial! Set the Start and Stop parameters or Center and Span - and don’t forget to set the Segments parameter that is required to set the number of sampling steps (i.e. the resolution).
• Then select the Calibration Menu in NanoVNASaver. There one can select the Calibration assistant that will guide one through the calibration steps - basically it’s again measuring perfect short, open and load for all measurements and thru connection for any two port measurements.
• It’s a good idea to write a short comment about the cabling used and then storing the calibration together with the data files.

In case one want’s to verify the calibration really worked one can then perform a measurement leaving the cabling shorted, open and perfectly matched (in this case from $1 MHz$ to $25 MHz$):

Measurement Smith plot Phase plot Return loss
Short
Open

Basically measuring will be pretty simple: Connect the DUT to the cable assembly after calibration.

## Matching conditions

Basically there are two useful matching conditions that one can aim for:

• Maximum power transfer when source impedance matches the complex conjugate of the load impedance ($Z_s = Z_l^{ * }$). This means no reflections in terms of power waves.
• Minimum reflection in case source impedance exactly matches the load impedance ($Z_s = Z_l$). This means no reflection in terms of traveling waves.

Note that a different approach often used in measurement and audio systems is impedance bridging in which $Z_l \gg Z_s$ ensures that maximum voltage transfer is targeted instead of maximum power transfer.

The amount of reflected signal in a RF system is usually determined using the reflection coefficient $\Gamma_{12} = -\Gamma_{21} = \frac{V_{refl}}{V_{in}} = \frac{Z_L - Z_0}{Z_L + Z_0}$. This reflection coefficient is also what we’re measuring using the network analyzer when measuring the scattering parameter $S_{11}$. Another quantity often used for antenna engineering is the standing wave ratio SWR (or voltage standing wave ratio VSWR) that’s basically defined as $SWR = \frac{1 + \mid \Gamma_{12} \mid}{1 - \mid \Gamma_{12} \mid}$. For a perfectly matched network the voltage standing wave ratio should be 1.

To perform matching using a Smith chart one basically tried to find a - ideally lossless - path to purely resistive unit load (usually 50 Ohms) which is the point seen above when measuring the perfectly matched load.

### Using the smith chart

Using the smith chart provides an efficient way of designing or at least estimating matching networks. One basically has to follow some simple rules. First off the smith chart is either one single chart that represents impedance as a polar plot as shown here:

Or it consists of two mirrored charts (Impedance and admittance picture):

The center line is a path with zero reactance - thus only ohmic loads. The most right point equals to infinite impedance, the most left point to zero impedance. The upper half of the graph represents inductive, the loader capacitive loads. It’s also often useful to extend the plot by a mirrored smith chart that’s representing the admittance (i.e. $Y = Z^{-1}$). If one doesn’t use such a plot one can move between impedance and admittance descriptions by simply mirroring the points on the unit load point - but then one has to keep track if one’s working currently in admittance or impedance picture.

In the impedance picture paths on the closed circles that all touch the point of infinite impedance vertically are paths with constant ohmic resistance. Paths along the curved lines that touch the point at infinity horizontally are paths with constant reactance. Note that the extreme points with $Z=\infty$ and $Z=0$ at the leftmost and rightmost points are also equivalent to $\Gamma=-1$ for $Z=0$ (i.e. the short) and $\Gamma=1$ for $Z=\infty$ (i.e. the open circuit). The origin at the matched condition $Z=1$ equals to $\Gamma = 0$. When moving along the vertical axis one would also move $\Gamma$ to $+j$ and $-j$.

The rules to match the impedance are now pretty simple. Adding the basic elements either in series or as shunt basically moves along the circles of constant real parts or impedance or admittance:

Element Picture Direction Visualization
Series Inductor Impedance picture Clockwise
Series Capacitor Impedance picture Counter clockwise
Shunt Inductor Admittance picture Counter clockwise

Note that one’s usually using a normalized smith chart in which all impedances are divided by $Z_0$ and all admittances are multiplied by the same value.

The standing wave ratio (SWR) can easily be determined by following a circle centered at the origin of the perfect match in clockwise direction. The value along the real axis is equal to the SWR.

For example the following shows a simple narrowband matching using a series capacitor and shunt inductor:

## Measuring the device characteristics

First of I was interested not only in designing the matching network for a specific drive frequency but also was curious about the performance at various frequencies. Thus I captured the S11 parameter for all frequencies from 1 MHz to 500 MHz in 100 segments - this takes some time. Note that one has to do the previously mentioned calibration for the same frequency range and the same number of segments. To verify successful calibration I usually also measure the calibration states load, open and short again - this also gives one a feeling if there is any larger influence on the results by incorrect attached connectors, broken wires or missing ground.

Deflection plate Smith chart (S11) Return loss Real/Imaginary parts (S11) Phase
Calibration (open)
Calibration (short)
Y1 axis
Y2 axis
X1 axis
X2 axis

For each axis I also stored the Touchstone 1 port file. This allows one to import the characteristics of the measured device into simsmith later on.

## Matching network in SimSmith

Second I usually try to think about the matching network I’m going to design using the Smith chart and the values for the frequency range I’m going to match. First one looks up the value or range of values that one’s aiming for from the measurements. When working manually one then normalizes the measured impedances and notes them in the chart. When using simsmith one can import the load characteristics by clicking onto file below the source diagram

.

Then one has to insert values for the target frequency at the generators frequency setting as well as the output impedance at $Z_0$. One might also introduce own ABCD parameters but usually that’s not required.

When building a matching network using passive inductance and capacitance only one then selects the topology by deciding on a path that one wants to move along, That’s pretty simple for a narrowband match for a single frequency:

For most applications that’s sufficient. One can simulate the steps in simsmith by simply picking components from the user interface and putting them into the circuit diagram on the top.

In addition the tool also exports a chart of the calculated standing wave ratio:

For many applications one could also use a different procedure to design a matching network by following curves having a constant quality factor - to design more wideband matching networks one also has to put limits on the areas one can go into with one’s impedance. It’s a good idea to use numerical tools to design wideband matching networks though since they get really complex pretty fast.