LibreVNA Calibration

py
equipment
Published

November 4, 2026

LibreVNA Calibration

Calibration steps

Usually a simple calibration consists of a short, open and load measurement for each of its ports, added by a through measurement while connected port 1 and port 2 by a straight line.

So the previous tested script needs to be modified about the missing items.

import time
from libreVNA import libreVNA

# Create the control instance
vna = libreVNA('localhost', 19542)

# Quick connection check (should print "LibreVNA-GUI")
print(vna.query("*IDN?"))

# Make sure we are connecting to a device (just to be sure, 
# with default settings the LibreVNA-GUI auto-connects)
dev = vna.query(":DEV:CONN?")
if dev == "Not connected":
    print("Not connected to any device, aborting")
    exit(-1)
else:
    print("Connected to "+dev)
LibreVNA,LibreVNA-GUI,374B347C3435,1.6.5
Connected to 374B347C3435
# Create measurement boundaries and number of points
# I found these commands in the integration tests, so they should fit
# reminder: explicit is better than implicit
vna.cmd(":DEV:MODE VNA")                    # other modes are possible!
vna.cmd(":VNA:SWEEP FREQUENCY")             # other valid value: POWER is possible!
vna.cmd(":VNA:STIM:LVL -10")                # -10 dBm is default, more or less, see manual
vna.cmd(":VNA:ACQ:IFBW 10000")              # IFBW wtf is that=   
vna.cmd(":VNA:ACQ:AVG 1")                   # more than 1 measurement possible for every value
vna.cmd(":VNA:ACQ:POINTS 501")              # maximum is 4501 !
#                             500000000  ==  500.000.000 just to find the size ;-)
vna.cmd(":VNA:FREQuency:START 500000000")   # always in Hertz, here 0.5 GHz
vna.cmd(":VNA:FREQuency:STOP 1500000000")   # always in Hertz, here 1.5 GHz
#vna.cmd(":VNA:FREQuency:ZERO 1500000000") ???
#
# Create the calibrations measurements. 
# This is necessary because the GUI starts with no calibration measurements by default.
# In case the GUI was already running, we clear the calibration measurements first.
vna.cmd("VNA:CAL:RESET")
vna.cmd("VNA:CAL:ADD OPEN")
vna.cmd("VNA:CAL:ADD SHORT")
vna.cmd("VNA:CAL:ADD LOAD")
vna.cmd("VNA:CAL:ADD OPEN")
vna.cmd("VNA:CAL:ADD SHORT")
vna.cmd("VNA:CAL:ADD LOAD")
vna.cmd("VNA:CAL:ADD THROUGH")

# Set all three measurements to port 1 (just for clarity, 1 is already the default value)
vna.cmd("VNA:CAL:PORT 0 1")
vna.cmd("VNA:CAL:PORT 1 1")
vna.cmd("VNA:CAL:PORT 2 1")
vna.cmd("VNA:CAL:PORT 3 2")
vna.cmd("VNA:CAL:PORT 4 2")
vna.cmd("VNA:CAL:PORT 5 2")
vna.cmd("VNA:CAL:PORT 6 1 2")


def take_measurement(vna, cal_num):
    # start the measurement
    vna.cmd("VNA:CAL:MEAS "+str(cal_num))
    # wait for the measurement to complete
    while vna.query(":VNA:CAL:BUSY?") == "TRUE":
        time.sleep(0.1)
# Take the measurementss
input("Connect the OPEN standard on port 1 and press ENTER to continue")
take_measurement(vna, 0);
input("Connect the SHORT standard on port 1 and press ENTER to continue")
take_measurement(vna, 1);
input("Connect the LOAD standard on port 1 and press ENTER to continue")
take_measurement(vna, 2);
input("Connect the OPEN standard on port 2 and press ENTER to continue")
take_measurement(vna, 3);
input("Connect the SHORT standard on port 2 and press ENTER to continue")
take_measurement(vna, 4);
input("Connect the LOAD standard on port 2 and press ENTER to continue")
take_measurement(vna, 5);
input("Connect the through standard (port 1 <==> port 2) and press ENTER to continue")
take_measurement(vna, 6);
Connect the OPEN standard on port 1 and press ENTER to continue 
Connect the SHORT standard on port 1 and press ENTER to continue 
Connect the LOAD standard on port 1 and press ENTER to continue 
Connect the OPEN standard on port 2 and press ENTER to continue 
Connect the SHORT standard on port 2 and press ENTER to continue 
Connect the LOAD standard on port 2 and press ENTER to continue 
Connect the through standard (port 1 <==> port 2) and press ENTER to continue 
# Activate the calibration
vna.cmd("VNA:CAL:ACT SOLT_12")   #_0.5-1.5GHz-501pts")

# Readback active calibration type
print("Active calibration: "+vna.query("VNA:CAL:ACTIVE?"))
#vna.cmd(
input("To save this calibration as NewCalibration.cal press enter or press CTRL-C for abort")
vna.cmd("VNA:CAL:SAVE " + "NewCalibration.cal")
Active calibration: SOLT_12
To save this calibration as NewCalibration.cal press enter or press CTRL-C for abort 
0

This seems a better calibration than before and it worked after some investigations inside the integrationtests.

The calibration itself is valid until the next calibration happend or the gui is powered off. For now it is saved to disk as file NewCalibration.cal

Still the unkown seems to be much more than the known

Have Fun!