Hi

 

As I am naturally curious about RF Tech, I tend to collect devices that quantify certain aspects of the RF hobby.

This device is, by far been the most interesting one.

 

Some time ago, I wrote morfeusQt, which is still somewhat active...

So I contemplated writing a similar python application for this device.

Fortunately, I was searching GitHub for "nanovna" one night and this popped up.

It was Python, and it worked on first load and omg...

It's opensource! 

It is written by Rune B. Broberg / 5Q5R.

 

In the following blog post will go through some vigorous screenshotting and brief texting to explain my process,

please bear with me as I run through its use cases, some of which I will cover in the next article as my understanding

on the matter deepens.

 

The steps that follow are:

 

I will forego going through the software repository cloning process and jump straight to usage.

 

This should yield the most satisfying results from this little USB serial device.

 

Firstly let's download the application:

Please follow this link for the latest release page.

Once downloaded, let's have our nanoVNA device plugged in via the USB cable before firing up the application.

Once opened, we have a screen that looks like this.

Annotation 2019-09-15 120443.png

We then click on Connect to NanoVNA to initiate our device and get the first scan.

Annotation 2019-09-15 120553.png

Here we are presented with a beautiful presentation of our data.

 

I am going to customise this display, and I do this by clicking on Display Setup and by changing the Sweep Color.

Annotation 2019-09-15 120952.png

That's a little better...

 

Firstly, we need to calibrate.

 

Short

IMG_20190916_054112.jpg

Open

IMG_20190916_054027.jpg

Load

IMG_20190916_054142.jpg

Through

IMG_20190916_054203.jpg

Isolation 2x 50Ω dummy loads

IMG_20190916_054244.jpg

 

Annotation 2019-09-15 150457.png

We click on calibration, and then we set our segments to 10 to have more points, after which we click sweep.

Once the sweep completes with our Short in place, we click the "short" button in the calibration screen.

We follow this process for each step (Short, Open, Load, Through and Isolation) of the calibration process.

Then after the OSL calibration is complete, we can click apply and then if we'd want we can save the calibration for later loading.

We then close our calibration screen.

 

Filter #1

First up a 2.6MHz HPF from RTL-SDR.

IMG_20190915_151001.jpg2.6MHz HPF

We sweep from 50KHz - 30MHz with ten segments for some excellent resolution(1010 data points)

Annotation 2019-09-15 163305.png

I've also added three markers to peak at values, to match the first markers in the chart below.

Markers points can be highlighted by selecting the appropriate radio box in the markers section.

It matches nicely with what s found on the RTL-SDR website

Return Loss

Next, we sweep from 50KHz-6MHz, for a closer look

Annotation 2019-09-15 164200.png

It also pairs nicely with what is on RTL-SDR

Filter #2

The 88-108MHz bandstop filter

IMG_20190915_170310.jpgIMG_20190915_170310.jpg

 

We sweep from 50KHz-300MHz

Annotation 2019-09-15 170833.png

Again this matches quite nicely with what is on RTL-SDR

 

EDIT 17-09-2019

Here I tested a new master branch firmware update which expands the frequency range by 600MHz to 1.5GHz.

Here are some device captures with a 50Ω load

pew.png

pew1.png

DFU can be entered via software switch

pew2.png

As can be seen below, the hardware limitations of the device are being met above 900MHz.

This is a sweep of the bandstop filter in place with a new calibration made for the new range in the latest firmware.

Annotation 2019-09-17 181229.png

Here is the Open sweep with extended range

Annotation 2019-09-17 182150.png

Here is the Short sweep with extended range

Annotation 2019-09-17 182339.png

Here is the Load sweep with extended range

Annotation 2019-09-17 182756.png

Here is the through sweep with extended range

Annotation 2019-09-17 181648.png

Perhaps the device would need a hardware upgrade shortly?

 

Just for science, how would it look with 10k points?

A sweep of 10100 points with the bandstop in place

Annotation 2019-09-17 205000.png

:)

 

Conclusion

 

So for me being a radio amateur and loving building things, it's nice having a device that can quantify specific theoretical parameters.

 

I am also still learning a bunch, so much so that I decided to contribute to the GitHub project.

It is lovely to see the application grow with every iteration and Rune is definitely on the fast track to making

one of the most top-notch VNA applications for this device.

 

I would also like to thank the author of this article and Rune for pointing it out, it always great learner things from others in the same domain.

 

I'll get to measuring some antennas on the next Part, for now, if you'd be interested here

are some build instructions for the firmware in Ubuntu 19.04

 

Kind Regards

Ohan Smit

ZS1SCI

 

 

Hi

This will be a guide to building the NanoVNA source code from a fresh Ubuntu machine.

First off, we need git.

In a terminal window run the following:

sudo apt-get install git

Following the guide available on GitHub we generate and add an ssh key:

ssh-keygen -t rsa -b 4096 -C "your_email@domain.com"

eval "$(ssh-agent -s)"

ssh-add ~/.ssh/id_rsa

We need to copy this key to the clipboard with xclip:

sudo apt-get install xclip

xclip -sel clip < ~/.ssh/id_rsa.pub

Login to GitHub to add ssh key:

Click the green New SSH Key button

Give it a Title and paste the copied key in this window

Once that is done we can add some prerequisites:

In a terminal window run the following:

wget https://developer.arm.com/-/media/Files/downloads/gnu-rm/8-2018q4/gcc-arm-none-eabi-8-2018-q4-major-linux.tar.bz2

sudo tar xfj gcc-arm-none-eabi-8-2018-q4-major-linux.tar.bz2 -C /usr/local

$ PATH=/usr/local/gcc-arm-none-eabi-8-2018-q4-major/bin:$PATH

sudo apt install -y dfu-util

 

Once that's dusted off we can clone the repo :

In a terminal window run the following:

git clone https://github.com/ttrftech/NanoVNA.git && cd NanoVNA

git submodule update --init --recursive

Type yes when asked

 

If you see something like this 

Submodule path 'ChibiOS': checked out '669d4bbc8da1ee0e4ccdf93a472b06d183922320'

 

All is good!!!

 

Build the library with:

 make

That's a successful build right there!

 

Flash by setting the device to DFU boot, either in software or by short of pins :

Update :

Short the two pins in the red circle with the device powered off, then with the pins shorted power on the device.

This will enter DFU mode, with a blank white screen.

The device can now be flashed.

Clipboard02.jpg

Software Reset to DFU 

Untitled.png

Then to flash: 

make flash

This is what to expect when flashing the device.

Windows Flashing:

For conversion to dfuse dfu file format for Windows flashers:

In the ubuntu terminal still:

dfu-tool convert dfuse ./build/ch.hex test.dfu

Set PID, VID:

dfu-tool set-product test.dfu df11

dfu-tool set-vendor test.dfu 0483

dfu.PNG

 

Experimental build from a branch that enables Time Domain Stuff

f7b19879-3ad4-40b2-9bf2-ba61c4800977.jpg

Added menu items

f7b19879-3ad4-40b2-9bf2-ba61c4800977.jpg

Hopefully, this will help some folks get to building the firmware of this device.

 

Kind Regards

Ohan 

ZS1SCI

I recently bought a NanoVNA of amazon following the article on RTL-SDR.

Yes, I got the bad model, no shielding, no QC, I had to fix the short to GND on the USB-C header, but after getting it working, its a very nifty tool for the RF shack.

 

My friend ZS1ARB told me about this article written by Salil aka nuclearrambo.

It goes into detail on how to calculate the length of a cable using the NanoVNA as a Time-domain reflectometer

This animation explains it rather elegantly.

 
Signal transmitted through and reflected from a discontinuity

I highly recommend you start there.

 

This blog would just to show how I used this technique to measure the length of coax cable rather accurately.

 

Here he provides us with a Python script for calculating the distance of a given coax cable. I've modified his original a bit.

import skrf as rf
import matplotlib.pyplot as plt
from scipy import constants
import numpy as np
import sys
 
raw_points = 101
NFFT = 16384
PROPAGATION_SPEED = 78.6 #For RG58U
plt_filename = sys.argv[1]
_prop_speed = PROPAGATION_SPEED/100
cable = rf.Network(plt_filename)
print(plt_data)
 #Read skrf docs
print(cable)
s11 = cable.s[:, 0, 0]
print(type(s11))
window = np.blackman(raw_points)
s11 = window * s11
td = np.abs(np.fft.ifft(s11, NFFT))
#print(s11)
 
#Calculate maximum time axis
t_axis = np.linspace(0, 1/cable.frequency.step, NFFT)
d_axis = constants.speed_of_light * _prop_speed * t_axis
 
#find the peak and distance
pk = np.max(td)
idx_pk = np.where(td == pk)[0]
cable_len  = d_axis[idx_pk[0]]/2
#print(cable_len)
#print(d_axis) 
# Plot time response

plt.plot(d_axis, td)
plt.xlabel("Distance (m) Length of cable(%.5fm)" % cable_len)
plt.ylabel("Magnitude")
plt.title("Return loss Time domain")
plt.show()

Instead of saving a file, running a python script and then only seeing this script's results, I decided to glue these two together for the time being.

 

I modified some parameters for my use. Here I just took the filename and sent that path to the python script.

plt_filename = sys.argv[1]
cable = rf.Network(plt_filename)

I also happen to find that Roger Clark had also conveniently reverse engineered the windows C# app for NanoVNASharp that's on the email groups

So I cloned his repo, added some C# code to make the Python script run.

 

If you'd like to make this run.

  • Have python installed, and Visual Studio 2017 or greater.
  • Please clone the project from my GitHub repo. 
  • Open the solution, then navigate to line 249 in the MainForm.cs file.

 

Here you would have to change the python path in the below code

...
psi.FileName = @"YOUR FULL PATH HERE";
...
var script = @"CLONED DIR PATH\tdr.py";
...

and the script location to the cloned repository directory path it should look something like this.

 public void RunPython(string filename)
 {
            var psi = new ProcessStartInfo();
            psi.FileName = @"C:\Users\SomeUser\AppData\Local\Programs\Python\Python36\python.exe";
            var script = @"C:\NanoVNASharp\tdr.py";
            psi.Arguments = $"\"{script}\" \"{filename}\"";
            psi.UseShellExecute = false;
            psi.CreateNoWindow = true;
            psi.RedirectStandardOutput = true;
            psi.RedirectStandardError = true;
            var errors = "";
            using (var process = Process.Start(psi))
            {
                errors = process.StandardError.ReadToEnd();

            }
            Console.WriteLine("ERRORS");
            Console.WriteLine(errors);
}

and voila now when you save the s1p file in NanoVNASharp it will open the python script after the save dialogbox has been closed.

So my first course of action for getting the Velocity factor of the cable I was measuring was to physically measure the cable first.

It came out to 4645 mm, excellent now let's try some various velocities on line 8 the Python script and see what we get. 

 

Velocity: 75% and Length calculated: 4432 mm, not quite what we want.

Velocity: 79% and Length calculated: 4669 mm, mmmh to much hey...

 

Eventually, it came to a velocity factor of 78.6% with a calculated distance of 4645.71mm

So I cut off a piece of wire about 10cm in length.

I then pressed the Get Data button clicked Save s1p, gave it a file name and then was presented with a pretty cool finding XD

4545.03mm XD that is pretty neat!

 

I will see if how far I'd take this reverse-engineered project, for now, this was just an informatory post.

 

Might have to build some other interface to add a few things.

 

This is me sharing my discovery.

 

ZS1SCI

Hi and welcome

 

My name is Ohan Smit a radio amateur from Cape Town South Africa with the call sign ZS1SCI.

 

My friend recently found an iMet-54 weather balloon that landed on his farm.

He sent me the following picture picture 

4dd09110-fab8-4704-ab7d-36ded9e4ae8c.jpg

I was naturally intrigued by this discovery.

So assuming he would only bring the RF unit, I was very surprised when he bought the whole kit, parachute, balloon, string loom the works.

 

I've in the meanwhile tried to reverse engineer the balloon, I got GPS messages, and everything was looking peachy.

 

Then I accidentally fried the MCU by hooking up a cheap logic analyzer. 

 

My goal had now become to try and simulate its behaviour like before it broke, using the same MCU and transmission chip as the original PCB.

 

The L76 GPS chip is still in working order.