NanoVNA setup for shunt matching task – scripting the setup

NanoVNA setup for common antenna system measurement tasks showed a display configuration better suited to those tasks.

It is tedious to set the display up using the device menu, and setups may vary with different NanoVNA hardware and firmware.

The firmware I used was NanoVNA.H.v1.2.20 which allows some setup using serial port commands. This article describes the technique.

The command used is the trace command

trace {0|1|2|3|all} [logmag|phase|delay|smith|polar|linear|swr|real|imag|r|x|z|zp|g|b|y|rp|xp|sc|sl|pc|pl|q|rser|xser|zser|rsh|xsh|zsh|q21] [src]
trace {0|1|2|3} [lin|log|ri|rx|rlc|gb|glc|rpxp|rplc|rxsh|rxser]
trace {0|1|2|3} {scale|refpos} {value}

For this exercise, I used Teraterm5 which allows setting delays after each character and after each line so that the NanoVNA is not overrun.

Above, the Teraterm serial port setup.

The commands to perform the setup follow, they can be pasted into teraterm in one go,

trace 0 swr s11
trace 0 scale 0.2
trace 0 refpos 0
trace 1 smith s11
trace 1 gb
trace 1 scale 1
trace 1 refpos 0
trace 2 g s11
trace 2 scale 0.005
trace 2 refpos 0
trace 3 b s11
trace 3 scale 0.01
trace 3 refpos 4

Here is capture of the console session.

ch> trace 0 swr s11
ch> trace 0 scale 0.2
ch> trace 0 refpos 0
ch> trace 1 smith s11
ch> trace 1 gb
ch> trace 1 scale 1
ch> trace 1 refpos 0
ch> trace 2 g s11
ch> trace 2 scale 0.005
ch> trace 2 refpos 0
ch> trace 3 b s11
ch> trace 3 scale 0.01
ch> trace 3 refpos 4
ch> trace
0 SWR S11 0.200000000 0.000000000
1 SMITH S11 1.000000000 0.000000000
2 G S11 0.005000001 0.000000000
3 B S11 0.010000001 4.000000000

In this firmware, display settings are saved as part of the calibration data, so if the instrument is setup full (incl calibration) when you run the above script, you could save it to slot 5 with the “save 5” command.

The original / default trace setup follows.

ch> trace
0 LOGMAG S11 10.000000000 7.000000000
1 LOGMAG S21 10.000000000 7.000000000
2 SMITH S11 1.000000000 0.000000000
3 PHASE S21 90.000000000 4.000000000

This may or may not work on other versions of hardware and firmware, try it entirely at your own risk.