Matching impedance using NanoVNA v2, NanoVNASaver and SimSmith

03 Jun 2021 - tsp
Last update 03 Jun 2021

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

Note: All Links to Hardware are Amazon affiliate links. This pages author profits from qualified purchases.

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.

Connectors used on the ports of the VNA

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:

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

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:

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/ (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
chown USERNAME /dev/cuaU0*

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.

Device selection with NanoVNA



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:

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:

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 Shorted cable Shorted cable Shorted cable
Open Open    cable Open    cable Open    cable
Load Loaded  cable Loaded  cable Loaded  cable

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:

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:

Loaded  cable

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

Impedance and admittance plot

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 inductor in smith chart
Series Capacitor Impedance picture Counter clockwise Series capacitor in smith chart
Shunt Inductor Admittance picture Counter clockwise Shunt inductor in smith chart
Shunt Capacitor Admittance picture Clockwise Shunt capacitor in smith chart

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:

Example narrowband match using a simple series C and shunt L

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 (load) Load calibration Load calibration return loss Load calibration real/imaginary parts Load phase
Calibration (open) Open calibration Open calibration return loss Open calibration real/imaginary parts Open phase
Calibration (short) Short calibration Short calibration return loss Short calibration real/imaginary parts Short phase
Y1 axis Y1 axis Y1 axis return loss Y1 axis real/imaginary parts Y1 axis phase
Y2 axis Y2 axis Y2 axis return loss Y2 axis real/imaginary parts Y2 axis phase
X1 axis X1 axis X1 axis return loss X1 axis real/imaginary parts X1 axis phase
X2 axis X2 axis X2 axis return loss X2 axis real/imaginary parts X2 axis phase

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

Selecting file in SimSmith.

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:

Example narrowband match using a simple series C and shunt L (Smith)

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.

Example narrowband match using a simple series C and shunt L (Circuit)

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

Example narrowband match using a simple series C and shunt L (SWR)

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.

This article is tagged: Physics, Electronics, LoRA

Data protection policy

Dipl.-Ing. Thomas Spielauer, Wien (

This webpage is also available via TOR at http://jugujbrirx3irwyx.onion/

Valid HTML 4.01 Strict Powered by FreeBSD IPv6 support