Author Topic: NanoVNA Custom Software  (Read 479860 times)

0 Members and 5 Guests are viewing this topic.

Offline DiSlord

  • Regular Contributor
  • *
  • Posts: 108
  • Country: ru
Re: NanoVNA Custom Software
« Reply #1500 on: December 26, 2021, 04:41:40 pm »
I use cheap fixture like this, just for test
For this fixture need set Rl = 50 Om
1360652-0

Also i see this variant:
For this need set Rl = 12.5 Om
https://www.ph2lb.nl/blog/index.php?page=xtal-adapter-for-nanovna

I have H / H4 / V2Plus4 / LiteVNA / modded V2Plus from V2 / LibreVNA
Also have v3.6 board H variant (last board revision show very good results)

PS i try add in firmware all features as on CPU side, for stand alone use
 

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11890
  • Country: us
Re: NanoVNA Custom Software
« Reply #1501 on: December 26, 2021, 06:10:54 pm »
I tried it but was lost.  For starts, the terms you use do no match the paper you provided.  I'm not sure what equations you use.  Q for example could mean different things.   If I used the simple fixture, cal the VNA, the software will not detect the crystal.  I have to manually zoom in.  Eventually it starts to show some numbers.  As I continue to zoom in, these change a fair amount.   I would need some sort of written procedure before I could evaluate it. 



Offline DiSlord

  • Regular Contributor
  • *
  • Posts: 108
  • Country: ru
Re: NanoVNA Custom Software
« Reply #1502 on: December 26, 2021, 07:50:05 pm »
Yes, need manually (this measures semi automatic) select range for good see both resonances on screen (on calculation i search resonances/phase shifts on current measured data), i use bilinear interpolation for get data between poins so bigger points count reduce errors (also selecting good range allow get more closest results)
Also better select bigger avg settings (Display->AVG = 10 for example)

w2aew made video:


How i made calculations:
I search Max linear value in S21 (k = |S21| at this point) value and get Fs frequency
k - linear value (not in dB, for dB value Rs = 2*Rl * (10^((S21 in dB)/20) - 1)
Rs = 2*Rl * (1/k - 1)
Reff = 2*Rl + Rs

Next i search pase shift -45 degree and get frequency f2 and pase shift +45 degree and get f1
After i correct measured Fs frequency by made geometry average
Fs =sqrtf(f2*f1)
dF = f2 - f1
Ls = Reff / (2 * Pi * dF)
Cs = dF / (2 * Pi * Fs * Fs * Reff)
Q =  2 * pi * Fs * Ls / Rs not remember why, need search (look like Need use Reff? not Rs, in this case Q = Fs / dF)

After i search min linear value in S21 and get Fp frequency
Cp = (C0 + Cstray)
There C0 is the holder capacitance, Cstray - shunting capacitance of the test fixture

Cp = Cs * Fs / (2*(Fp - Fs))

PS SHUNT LC measure allow measure XTAL connected as shunt, need also manually select range for see peak (this measure critical to good calibration)
1360808-0

PS need rename Rs to Rm, Ls to Lm and Cs to Cm

PS you store calibration in 0 slot (better use DONE in RAM for temporary calibrations, calibration reset after power off, if you change range calibration data interpolated), this slot loaded on startup and apply to sended to CPU data. After all experiments better clear all calibrations by CONFIG->EXPERT SETTINGS->CLEAR CONFIG. This reset device to default state.
I made this (apply internal calibration on sended to CPU data) as option on next.
« Last Edit: December 26, 2021, 09:37:34 pm by DiSlord »
 

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11890
  • Country: us
Re: NanoVNA Custom Software
« Reply #1503 on: December 26, 2021, 10:53:48 pm »
>PS need rename Rs to Rm, Ls to Lm and Cs to Cm
Right, I wasn't sure if you had used the paper you linked because of this. 

> (look like Need use Reff? not Rs, in this case Q = Fs / dF)
According to the paper you linked yes.   I used Chris Bowick RF Circuit Design.

>... this slot loaded on startup and apply to sended to CPU data.
Good to know.  Normally, I would just leave them calibrations blank and assumed the CPU would just send the raw no matter if I used them or not. 

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11890
  • Country: us
Re: NanoVNA Custom Software
« Reply #1504 on: December 27, 2021, 04:10:13 pm »
Rs = 2*Rl * (1/k - 1)
Reff = 2*Rl + Rs
Q =  2 * pi * Fs * Ls / Rs not remember why, need search (look like Need use Reff? not Rs, in this case Q = Fs / dF)

Looking at my software, I also use Rs for Q.   I warn people about my software possibly not being correct.  I find a lot of errors in published papers and sometimes it is difficult to determine which are correct.   We could both be wrong!  This was one reason I tried to procure a standard crystal to perform some sort of sanity test. 

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11890
  • Country: us
Re: NanoVNA Custom Software
« Reply #1505 on: December 27, 2021, 04:18:53 pm »
From another paper, again confirming your calculation.   I suspect it's just a mistake in the paper you linked. 

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11890
  • Country: us
Re: NanoVNA Custom Software
« Reply #1506 on: December 27, 2021, 04:34:04 pm »
When looking at my software, I saw that I had names it Serial Freq.   WTF is serial?  The person who had first asked me about using the NanoVNA to make  a crystal filter was planning to use the DISHAL software.   I ended up using that software to double check my software (not that it is right).   

To try and make it easier for that person to follow along, I used the same name. 

Offline galileo

  • Contributor
  • Posts: 45
  • Country: cs
Re: NanoVNA Custom Software
« Reply #1507 on: December 29, 2021, 08:44:23 pm »
now i got your point. about Hugen tries to monopolized the market thats the problem, not that he copied your design... but i guess similar happened to outsides countries such as US with China. US businesses have become unsustainable due to competition and low production cost of China, i cant imagine how many businesses in US have to close or scaled down due to this. now the fight has become domestic within China itself ;D how about bring this kind discussion to the NanoVNA 6GHz thread i have no problem with you over there and leave this thread to its original intention ;) and i'm sorry to say you wont be able to stop people from buying what they want. like me for example, i need cross compatibility with NanoVNA-QT i told you, and LiteVNA is the only option for me now and no other else afaik. cheers.

No one put a gun to USA manufacturers and forced them to move to China.
The rest is a claim, repeated a thousand times, by a single person without any evidence.
 

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11890
  • Country: us
Re: NanoVNA Custom Software
« Reply #1508 on: December 31, 2021, 01:29:15 am »
For the few of you who come to EEVBLOG for the tech rather than the politics...


Offline DiSlord

  • Regular Contributor
  • *
  • Posts: 108
  • Country: ru
Re: NanoVNA Custom Software
« Reply #1509 on: December 31, 2021, 12:41:40 pm »
V2Plus4 not have CW output mode as i remember.
Output switch for measure reference signal, in this case output off.

You can see this on oscilloscope as output switch on/off

In last V2 firmware added special cw mode, in this case output not switch (can enabled in sweep settings).
LiteVNA also have this mode (auto enabled on user select cw)

About square output, for measure used IF frequency  (use mixer for switch F to IF frequency, value depend from device and measure range, anyway IF < 150kHz), and filter IF from harmonics after go to ADC and made DSP.
« Last Edit: December 31, 2021, 01:01:02 pm by DiSlord »
 

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11890
  • Country: us
Re: NanoVNA Custom Software
« Reply #1510 on: December 31, 2021, 05:36:52 pm »
V2Plus4 not have CW output mode as i remember.
Output switch for measure reference signal, in this case output off.

You can see this on oscilloscope as output switch on/off

Yes, you can see it in this video and we have discussed it here a few times. 


In last V2 firmware added special cw mode, in this case output not switch (can enabled in sweep settings).
LiteVNA also have this mode (auto enabled on user select cw)

I noticed that and was going to ask you if the firmware you created for the V2+4 also works this way? 

About square output, for measure used IF frequency  (use mixer for switch F to IF frequency, value depend from device and measure range, anyway IF < 150kHz), and filter IF from harmonics after go to ADC and made DSP.
Yes, I remember the poor performance of the H4 at lower frequencies.   When we purchased the LiteVNA, this was my biggest concern.   I have not gone back to look at the low frequency performance after installing the firmware you linked above.   The original firmware supplied (sadly not archived from what I see and I blew it away) seems to perform well.  Actually, overall the firmware for that product has worked well. 

After making that video, someone commented about problems with the square wave drive.  I wonder if any of the members who have access to a commercial grade VNA have experienced problems when using it due to the square wave drive.   

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11890
  • Country: us
Re: NanoVNA Custom Software
« Reply #1511 on: December 31, 2021, 06:27:18 pm »
Looking at the LiteVNA P1 with my vintage LeCroy 5GHz WaveMaster (w/ SSD that was going to fail after a few weeks and added Ethernet that wasn't going to improve data rates.  As I said, lots of misinformation).     Lite first set to swept mode, then to CW.  Finally, setting the VNA to 500MHz and looking at the edges. 
 
The following users thanked this post: TheBay

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11890
  • Country: us
Re: NanoVNA Custom Software
« Reply #1512 on: December 31, 2021, 06:28:37 pm »
Showing the V2Plus4 set to 500MHz CW.
 
The following users thanked this post: TheBay, realfran

Offline DiSlord

  • Regular Contributor
  • *
  • Posts: 108
  • Country: ru
Re: NanoVNA Custom Software
« Reply #1513 on: December 31, 2021, 06:57:40 pm »
Sorry. In last code i add power change option in cw mode, and made typo - apply power option for max/adf synthenizer for si5351. I found and fix it later.

I work on use calibration standart coefficients on LiteVNA calibration. This can improve measure quality if use known standarts.
Main problem, how made this calculation more simple for allow real time calculations on device (need calculate 3 complex variables for calibrations, and use additional 3 measured data in huge size formulas).


 

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11890
  • Country: us
Re: NanoVNA Custom Software
« Reply #1514 on: January 01, 2022, 01:00:55 am »
Is the new version released on the official site? 

If you find a good book on calibration, let me know.  Outside of learning how little I know, I haven't made much progress.

I blew the dust off of my old 7200.   
 
The following users thanked this post: DH7DN

Online gf

  • Super Contributor
  • ***
  • Posts: 1295
  • Country: de
Re: NanoVNA Custom Software
« Reply #1515 on: January 01, 2022, 11:35:26 am »
I work on use calibration standart coefficients on LiteVNA calibration. This can improve measure quality if use known standarts.
Main problem, how made this calculation more simple for allow real time calculations on device (need calculate 3 complex variables for calibrations, and use additional 3 measured data in huge size formulas).

Even if the known S parameters of the calibration standards are not specified directly, but in parametric form, isn't it still possible to pre-calculate the 12 (?) error terms for each frequency point, and apply the pre-calculated error terms as usual to the measurements? Then only the pre-calculation of the error terms is affected by the higher computational complexity (whenever start freqency, stop freqeuncy, or #ponts are changed).

Edit: Or do you also have a memory shortage, so that you can't afford a pre-calculated table?
[ I remember, when I compiled the NanoVNA V2 firmware from github for a V2.2 device, there was not too much RAM free. I have not yet tried your firmware variant. I think I need to try when I find some free time. ]
« Last Edit: January 01, 2022, 11:50:35 am by gf »
 

Online gf

  • Super Contributor
  • ***
  • Posts: 1295
  • Country: de
Re: NanoVNA Custom Software
« Reply #1516 on: January 01, 2022, 12:15:47 pm »
If you find a good book on calibration, let me know.  Outside of learning how little I know, I haven't made much progress.

A helpful resource for implementing VNA calibration is IMO scikit-rf. It supports various VNA calibration methods.
This toolkit is written in Python, but it should not be too difficult to transcribe the NumPy stuff to Matlab.

Edit: Sorry, I think I mixed it up -- you are using LabView, not Matlab, right?
Anyway, I guess it should be possible to transcribe the implemented algorithms.

Docs for the calibration module:
https://scikit-rf.readthedocs.io/en/latest/tutorials/Calibration.html
Edit: More details are in the API docs:
https://scikit-rf.readthedocs.io/en/latest/api/calibration/index.html

Git repository:
https://github.com/scikit-rf/scikit-rf

The core of the calibration-related stuff is located in this module:
https://github.com/scikit-rf/scikit-rf/blob/master/skrf/calibration/calibration.py
« Last Edit: January 01, 2022, 12:42:32 pm by gf »
 
The following users thanked this post: hash

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11890
  • Country: us
Re: NanoVNA Custom Software
« Reply #1517 on: January 01, 2022, 04:54:18 pm »
The last book I purchased was not helpful.  While Dunsmore's book dedicates a chapter to calibration and error correction, Bonaguide & Jarvis have only a few pages.    Both books would make a very good reference and I wish I had them when I was first introduced to a VNA. 

Offline Alextsu

  • Contributor
  • Posts: 42
  • Country: ru
Re: NanoVNA Custom Software
« Reply #1518 on: January 01, 2022, 05:11:30 pm »
The last book I purchased was not helpful.  While Dunsmore's book dedicates a chapter to calibration and error correction, Bonaguide & Jarvis have only a few pages.    Both books would make a very good reference and I wish I had them when I was first introduced to a VNA.

Hi, Joe,
Wish You Happy New Year!
Trying a very basic search with the "Unknown Through Calibration" gives some hits

http://www.microwave.fr/publications/149.pdf

http://coppermountaintech.com/wp-content/uploads/2018/05/Conducting-Calibration-with-the-SOLR-Unknown-Thru-Method.pdf



There's much more, of course


« Last Edit: January 01, 2022, 05:42:35 pm by Alextsu »
 

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11890
  • Country: us
Re: NanoVNA Custom Software
« Reply #1519 on: January 01, 2022, 07:19:59 pm »
Hello Alex.  Most of my searches didn't yield very useful information (at least for me).  Some of the better papers will talk about the need for different approaches depending on the hardware.  Dunsmore's book glosses over this and you may find equations during your searches not covered.   You can try terms like "VNA delta match" to narrow your search.   The best resource I have found have been patents.  Sadly, what is obvious to one skilled in the art is not so obvious to me.     

I've contacted others who have wrtiten their own software but have not ran across anyone who has implemented anything beyond the 12-term model on something like the NanoVNA. 

The only reason I started to look into it was OWO had mentioned the V3 supporting it along with other advanced calibration techniques.  This made me wonder if it could even be done with the hardware and if so, would there be any advantage.   My old PNA supports unknown thru and TRL but it's a four receiver system.  While I use them, I know very little about how they work.  Even if these were well documented,  the Nano's hardware isn't the same.   

https://nanorfe.com/nanovna-v3.html

Its been an interesting rabbit hole.   
« Last Edit: January 01, 2022, 08:06:13 pm by joeqsmith »
 

Online gf

  • Super Contributor
  • ***
  • Posts: 1295
  • Country: de
Re: NanoVNA Custom Software
« Reply #1520 on: January 01, 2022, 09:19:47 pm »
My understanding is that "unknown thru" is based on the 8-term error model for a full two-port VNA. So I have doubts, that it can be used with the 1.5 port NanoVNA (whose 2nd port cannot transmit and has no directional coupler). OTOH, the V3 was initially announced as full two-port VNA, in this case "unknwon thru" were an option. But in the meantime the actual features of the V3 seem to be not so clear any more.

With the NanoVNA as is, your options for S21 calibration are basically response normalization (suffers from both, source and load mismatch - both are not corrected), or Enhanced Response Calibration (which corrects source mismatch, but still cannot correct load mismatch). Enhanced Response Calibration is obviously supported by the NanoVNA V2 firmware and can be enabled in the menu.

I'm unsure whether Two Port One Path Calibration can be used with the NanoVNA. This calibration model enables full S11,S21,S12,S22 measurement and full error correction with a 1.5 port 3-receiver VNA, but the DUT needs to be flipped and measured twice. Therefore the DUT must have either two male, or two female connectors of the same type, in order that you can still insert the flipped DUT w/o additional adapters. My doubts regarding usability of this model is the switched receiver of the NanoVNA V2 (it does not have 3 receivers).
 


Offline rf-messkopf

  • Regular Contributor
  • *
  • Posts: 156
  • Country: de
  • Mario H.
    • Homepage
Re: NanoVNA Custom Software
« Reply #1522 on: January 02, 2022, 12:56:38 am »
My understanding is that "unknown thru" is based on the 8-term error model for a full two-port VNA. So I have doubts, that it can be used with the 1.5 port NanoVNA (whose 2nd port cannot transmit and has no directional coupler).

For true SOLR (aka "unknown thru") you do not only need a fully bidirectional two-port test set that can measure the full S-matrix (i.e. S11, S21, S12, S22), but actually a four receiver VNA.

There is no way around these hardware requirements. However, on a three receiver VNA, you can do a full two-port calibration (i.e. by a SOLT cal), and then determine certain parameters from the calibration data, the so-called switch terms. With the assumption that the switch terms are constant (this is usually a very good assumption), you can use them subsequently to do SOLR calibrations, even on a three receiver VNA. If I'm not mistaken this approach essentially is what Keysight calls "delta match method" which is available on their older or lower cost VNAs without four receivers.

A four receiver VNA has the ability to measure the switch terms directly. It does not need to assume that they are constant, and does not need to measure additional cal standards in a previous step to determine them.

Some more background about this: As you correctly say, SOLR is defined in terms of the 8-term error model. This model consists of two so-called error boxes at each port that correct for all imperfections. That means that it is assumed that the impedance of the physical VNA port does not change if it is switched from source to load configuration (the error boxes are constant and thus are unaware of the current port mode). The quantification of this model can be done in terms of measuring short, open, and load at each port, together with an unknown reciprocal thru. All that remains is a sign ambiguity, which essentially is due to the phase ambiguity in the thru of unknown length. Also, this step does not need a four receiver VNA. All of this is laid out in the original paper by Ferrero and Pisani which introduced the method ("Two-port network analyzer calibration using an unknown 'thru'", IEEE Microwave and Guided Wave Letters Volume 2, Issue 12, 1992).

To get rid of the assumption of a constant port match, commercial VNAs then transform the 8-term model to the conventional 12-term model (which is usually only a 10-term model by neglecting the crosstalk error terms which also do not exist in the 8-term model). The 12-term model has separate source and load port match errors for each direction. This of course, due to the larger number of unknowns, requires additional measurements: the switch terms.

The switch terms are defined as the ratio of outgoing wave and the incident wave at one port, while the other port is configured as a source. Notice that a three receiver VNA has no way of measuring them. On four receiver VNAs they are usually measured along with the thru.

An implementation of SOLR will therefore consist of several steps: First quantify the 8-term error model by measuring SOL at each port as well as the unknown reciprocal thru. Then measure the switch terms (or recall them from memory if unable to measure them on a three receiver unit). Finally convert everything to the 12-term error model. Then the DUT can then be corrected in the usual way. Unfortunately this requires a bit more implementation effort than just using a single formula.

The switch terms only depend on the test set and should not vary much over time, at least in commercial lab grade VNAs. I have checked that with my VNA, they seem to be indeed very stable.
« Last Edit: January 02, 2022, 12:59:56 am by rf-messkopf »
 
The following users thanked this post: JohnG, gf

Offline rf-messkopf

  • Regular Contributor
  • *
  • Posts: 156
  • Country: de
  • Mario H.
    • Homepage
Re: NanoVNA Custom Software
« Reply #1523 on: January 02, 2022, 01:30:11 am »
The last book I purchased was not helpful.  While Dunsmore's book dedicates a chapter to calibration and error correction, Bonaguide & Jarvis have only a few pages.    Both books would make a very good reference and I wish I had them when I was first introduced to a VNA.

As I already said in a private mail, I have it on my to do list to check Michael Hiebel's book ("Fundamentals of Vector Network Analysis", the German version from 2006 is titled "Grundlagen der vektoriellen Netzwerkanalyse").

Unfortunately, the most comprehensive and mathematically complete exposition on VNA calibration in textbook form that I know is in "Grundlagen der Hochfrequenz-Messtechnik" by Burkhard Schiek, and there is only the German original, with no English translation.
 

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11890
  • Country: us
Re: NanoVNA Custom Software
« Reply #1524 on: January 02, 2022, 01:39:25 am »
Hope you had a nice trip.  Outside of looking at that book I mention, I have not done anymore with the project.  I am hoping that walking away from it for a while will help.   You were correct about that particular book. 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf