The NanoVNA

This is a vector network analyzer in a small form factor -- a touchscreen about the size of a credit card, behind which there is a controller and hardware to measure magnitude and phase of reflection (S11) and transmission factors (S21) of two ports of an electrical network.

The two measuring ports are SMA female connectors. Power and data is through an USB-C connector; then there are two LEDs, a power switch, and a rocker-switch, like half a joystick, which is used for menu-selections, range adjustments, etc.

Some useful links

Where I bought mine

Users group discussion

Opening the package, first impressions

My NanoVNA came inside a neat rectangular plastic case, and besides the unit itself, there were some cables and terminators:

ItemConnectorEnd
RF CableSMA-MSMA-M
RF CableSMA-MSMA-M
barrel connectorSMA-F SMA-F
Short-circuit referenceSMA-MShort
Open-circuit referenceSMA-MOpen
50-Ohm match referenceSMA-M50 Ohm
Power and data Cable, USB-A USB-C

The NanoVNA itself is constructed like a sandwich of three boards, top board is the bezel around the touch-screen; middle board is the circuit board of the device itself, where the touch-screen is attached on the top, the connectors around the edges and components mostly at the bottom. There are two brass screens one each over the SMA connectors and associated chips. At the bottom there is another thinner card for the back plate board. In the corners four M3 screws and spacers hold the set together. Initially, the top screws were loose, but I had to remove the top bezel in order to pull the protective plastic off the touchscreen itself.

For reasons of shipping, there was no battery included, so I have to use it tethered to a power source of some kind. For field use, a standard USB power pack should work. Presumably a suitable battery can be found somewhere, when and if I desire one.

Trying it out

The two measuring ports are labeled CH0 and CH1. CH0 is where signal output from the NanoVNA is, and where reflection, S11, is measured. CH1 is an input for measuring the transmission factor, S21.

There is a quite informative marking on both the top bezel and the bottom plate, with arrows labeled S11 and S21 showing signal flow direction out from CH0 and the returns to CH0 and CH1.

On powering up, the frequency sweep goes from 50 kHz to 900 MHz, and there is a marker and four traces shown, labeled:

Text shown Meaning
CH0 LOGMAG 10dB/ # dB20 * log10(|S11|) Related to return loss, same magnitude, opposite sign.
CH0 SMITH 1.0FS # Ohms # H/F Re(S11) and Im(S11) are converted to resistance and reactance; then reactance is converted to inductance or capacitance
CH1 LOGMAG 10dB/ # d20 * log10(|S21|) Insertion gain or loss
CH1 PHASE 90*/ #* Phase Angle of S21
1: 50.000 kHzThis is the frequency where the marker is sitting and which is where values above are applicable.

The marker, a triangle with a number 1 inside it shows on all four curves, and can be moved up and down in frequency, and the values shown are where the marker is located for each of the 4 traces. Capacitance and inductance readings are scaled with appropriate decade prefixes (pF, nF, nH etc), and shown with 3 digits. This is very nice.

The three plots are overlaid on the screen, Log magnitude has 0 dB at the top and -70dB at the bottom; Phase has 0 degrees in the middle and 90 degrees per division, and the Smith chart shown, is centered on the screen, but its resistance and reactance arcs and interesting points are away from the graticule lines of the rectangular plot.

With nothing connected to the ports, CH0 shows close to 0 dB and a large and fluctuating resistance and reactance. The traces marked in yellow are flat at 0dB and bunched-up at the right end, infinite-impedance, of the Smith Chart. CH1 shows a quite random phase and a level around -70 dB, below the bottom of the visible range.

Just as expected, really. Calibration register 0 which is the one selected on startup, initially is for terminations at the SMA connectors.

I connected the supplied RF cables to the two ports, and put a 20dB attenuator in between them, so the connections are CH0, cable, attenuator, barrel, cable, CH1.

Now, as the reference planes are still at the SMA ports, what I see is the S11 spirals around the center of the Smith Chart, the phase of S21 is a continuous function of frequency, and both |S11| and |S21| show to be decreasing with frequency as the loss in the cables increase slightly with frequency. The cables look similar to RG-174, though they have no markings. I have some other cables with SMA connectors here that I might want to try.

Performing the calibration steps:

Connect open to CH0 - Calibrate Open

Connect short to CH0 - Calibrate Short

Connect match to CH0 - Calibrate Load

Leave the match on CH0 connect open on CH1 - Calibrate ISOL

Connect through from CH0 to CH1 - Calibrate Through

Store

Now the plots show my attenuator at |S21| = -20dB, |S11| < -40 dB, <S21 (angle of S21) approx 0, S11 close to 50 Ohms, though slightly capactive, also evidenced by the phase of S21. These numbers makes sense.

Data IO

The USB cable provides power and a data connection. When the NanoVNA is turned on and powered from the USB port of a computer, it shows up as a USB device, ID 0483:5740 STMicroelectronics STM32F407. dmesg tells us that this is identified as a ChibiOS/RT Virtual COM Port, and there is also a device node /dev/ttyACM0 created for it. Once the NanoVNA is powered off, this USB device is disconnected and the device node goes away.

As could be expected from its name and identifiation, this device node is created to operate as a tty, a serial terminal, and I should then be able to talk with the NanoVNA through it.

So I open up a terminal-emulator on it. It greets me with

ChibiOS/RT Shell
ch>

and expects a command. Some experimentation showed it wants the command terminated with a carriage-return, ASCII 0x0d, (\r), it doesn't seem to accept newlines at all.

ch> ?
? ?
ch>

No, looks like it didn't understand that

ch> h
h ?
ch>

Neither this

ch> help
Commands: help exit info echo systime threads reset freq offset time dac saveconfig clearconfig data dump frequencies port stat sweep test touchcal touchtest pause resume cal save recall trace marker edelay 
ch> 

Yes! Much better.

I went and found some code for the firmware. It is not quite the same as the one I have here but there was enough there to serve as a guideline as to what these commands would do.

Main purpose will be to control and download readings from the NanoVNA, so I found the most useful commands for that.

Reading:

ch> sweep
50000 900000000 101
ch> 

These 3 numbers are the start frequency, stop frequency, and number of frequency steps.

ch> data 0
0.017453338 -0.000475565
0.018129128 0.001321983
0.018672000 0.002172176
0.019588720 0.002908543
(...  snip the next 95 data points ...)
0.027758769 -0.009428260
0.027483787 -0.009392650
ch> 

This is a set of 101 data points from channel 0, one for each frequency point. Each pair is the Re(S11) and Im(S11). Note that the sign of Im(S11) indicates the inductive or capacitive nature of whatever is connected.

ch> data 1
0.107351727 -0.000190303
0.107192724 -0.002279529
0.107023984 -0.003533160
0.106878437 -0.004740763
(...  snip the next 95 data points ...)
0.045746058 -0.095961444
0.044663630 -0.096416473
ch> 

Similarly, this is a data set of 101 values from channel 1, Each pair is Re(S21) and Im(S21). My attenuator shows the magnitude of S21 to be close to 0.1, which is what we will expect from a 20dB attenuator. By definition, this should reduce the voltage by a factor of 10

There are more data sets, these are calibration storage so they may be somewhat less interesting at this point. The values coming from data 0 and data 1 are the same as the ones used to make the plots on the screen, and changing calibration changes them both there and on the data output lists. Changing to the calibration so that the cables are included as the DUT makes this obvious, as the phase of S21 now changes much more with frequency.

the command frequencies shows a list of the 101 frequencies of the frequency points, in a list similar to these for the data. Frequencies are integer values of frequency in Hz.

Control, set the sweep with:

sweep start #f-start[Hz]
sweep stop #f-end[Hz]
sweep center #f-center[Hz]
sweep span #f-span[Hz]
sweep cw #f-cw[Hz]
sweep stop 10000000 

thus changes the sweep to end at 10 MHz. changes to sweep parameters also appears to select the calibration-data set 0, even if another was being used before that. As I had stored the cable compensation into calibration-data set #3, something like

recall 3

will change the calibration-data set in use back to #3. These numbers correspond to the ones in the menu.

pause

This puts the sweep on hold, for example so that a stable set of data can be read out. Not to be confused with the sweep stop as that has to do with setting the end frequency.

resume

This makes the NanaVNA resume sweeping after it has been paused.

Markers:

There are 4 markers defined, identified as marker 1, 2, 3, and 4. They can be turned on or off, or set to one of the frequency points, indexed from 0 to 100 inclusive. The actual frequency associated with this will be returned with the marker command. This frequency is the index into the list of frequencies returned from the frequencies command.

The marker command by itself returns info on those markers that are turned on, showing three integers: number, index, frequency in Hz.

marker 3 off turns marker 3 off.

marker 2 50 moves marker 2 to the middle of the sweep range, and turns it on if it wasn't on already.

Traces:

There can be 4 traces, identified as trace 0, 1, 2, and 3.

For a demonstration I might want to use all 4 traces for S11, as the device under test is a 1-port device, and the S21 data when nothing is connected is just irrelevant noise that no-one cares about.

trace with no arguments shows the active traces:

0 CH0 LOGMAG 
1 CH0 SMITH
2 CH1 LOGMAG
3 CH1 PHASE

and with arguments are on the form:

trace {0|1|2|3|all} [logmag|phase|smith|linear|delay|swr|off] [0|1]

will set the indicated trace number 0,1,2,3, or all of them, to the format indicated or turn it off, and using data from channel 0 (S11) or channel 1 (S21).

logmag shows the magnitude in logaritmic form, in decibels, as a function of frequency. This is also known as a Bode Plot.

phase shows the phase in degrees, from -90°ree; to 90°ree;, as a function of frequency.

smith shows the magnitude and phase in a polar plot, with the Smith Chart-style constant resistance and constant reactance lines.

linear shows the magnitude in a linear form as a function of frequency.

swr shows the SWR as a function of frequency.

delay isn't implemented it says in the manual? (I would expect it to show something like the phase translated to travel time as a function of frequency.)

Notice that the keywords for what to show (logmag, smith etc.) have to be passed in as lowercase, but they are emitted as uppercase. Also, you can get SWR and a Smith chart plot for S21 if you want to, but these make little sense...

so for example:

trace 3 swr 0

will make trace 3 show the SWR measured on the CH0.

Programs

I made a simple driver program for the NanoVNA, which reads its lists of frequency points and the two data sets, for the two channels, expecting terminations to make them S11 and S21. This program and presents them in a tabular form as text. The magnitude is shown in dB, (20*log(|S|) since these are voltage ratios), and angle is shown in degrees. I called it vnacom, the code is here in vnacom-01-20190829.tar.gz.

This program issues the command pause to hold the sweep, then freq to determine the number of data points. With the number of points now known, it then issues frequencies, data 0, and data 1 in order to read the values while the sweep is on pause, then finally it issues resume to re-start the sweeping.


Powered by Apache

Valid XHTML 1.0 Transitional