Author Topic: NanoVNA Custom Software  (Read 524775 times)

0 Members and 4 Guests are viewing this topic.

Online radiolistener

  • Super Contributor
  • ***
  • Posts: 3826
  • Country: ua
Re: NanoVNA Custom Software
« Reply #275 on: September 08, 2019, 12:30:13 am »
hendorog, thanks. But what it means still is not clean for me. Needs reverse engineering of skrf source code, because python syntax very tricky. For example, it is not clean where IF statement ends... Also, algorithms are smeared through different classes and overloaded operators and it's hard to understand what is going on here with no need to diving into the rest of the code  :)

Any literature about math which is used under the hood in skrf?
 

Offline Bicurico

  • Super Contributor
  • ***
  • Posts: 1761
  • Country: pt
    • VMA's Satellite Blog
Re: NanoVNA Custom Software
« Reply #276 on: September 08, 2019, 07:36:12 am »
joeqsmith - May I abuse your patience and ask:

When using the DATA command I always get X and Y values. Are you doing it differently?
Yes, the frequency list is not necessary - one can compute it without having to download it. It is just (Fend-Fstart)/samples*step
What does X and Y really represent. This is the toughest question and possibly the most annoying to you. Sorry - I am still a noob in terms of VNA.
Regarding the low sample rate of just 101 samples per sweep, I have not tested if the SWEEP command accepts the sample number different than 101 as the third parameter.
If not my plan is to increase the sweep to 500 samples by just dividing the frequency span by 5 and getting the 101 samples for each of the 5 frequency segments.
Of course this will slow down the sweep rate by a factor of 5 but I have learned that refresh rate is not everything and there are quite expensive professional test equipment with rather slow sweep rates (a joke in my opinion - but that is another story).
It is not yet clear to me how to software-wise configure the NanoVNA to do S21 measurement so that I just hook the DUT on Port 0 and get a spectrum reading.

Regards
Vitor

Online radiolistener

  • Super Contributor
  • ***
  • Posts: 3826
  • Country: ua
Re: NanoVNA Custom Software
« Reply #277 on: September 08, 2019, 08:16:09 am »
What does X and Y really represent. This is the toughest question and possibly the most annoying to you. Sorry - I am still a noob in terms of VNA.

These X and Y are real and imaginary parts of S11 value (for CH1 S21). It is represented in complex form.

For exampel:
Code: [Select]
1.000334382 -0.012819038

means:
re (real part) = 1.000334382
im (imaginary part) = -0.012819038

So, it means that S11 = 1.000334382 - j0.012819038.

If you want, you can translate it to polar coordinate system in the following way:

magnitude = sqrt(re * re + im * im);
angle = 180 * atan2(im, re) / pi;

atan2(im, re) calculates angle, but the result represented in radians, so you're needs to convert it to degree by multiplying it with 180 / pi

S11 is very useful value, for exampel you can calculate VSWR value:

Code: [Select]
rr = re * re + im * im;

if (rr >= 1) then VSWR = infinite;

else VSWR = (1 + sqrt(rr)) / (1 - sqrt(rr));


Regarding the low sample rate of just 101 samples per sweep, I have not tested if the SWEEP command accepts the sample number different than 101 as the third parameter.

you can pass any number in sweep command. NanoVNA just ignore it. It always works with 101 points and there is no way to change it. I think this is memory limit of this microcontroller.

It is not yet clear to me how to software-wise configure the NanoVNA to do S21 measurement so that I just hook the DUT on Port 0 and get a spectrum reading.

Do you mean console commands? Just use data command:
data <channel>

for exampel, this command will get data for CH0:
data 0

and this command will get data for CH1:
data 1

it's pretty easy  :)

In order to setup frequencies, you can use sweep command:
sweep <start> <stop>

for exampel, this command will setup sweep range from 1 MHz to 150 MHz:
sweep 1000000 150000000

You can download PUTTY (this is terminal, it allows to connect to Serial port) and play with it. It's pretty easy. You're needs to specify Serial port for connection and com port name.  Here is putty session for exampel:
Code: [Select]
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> info
Kernel:       4.0.0
Compiler:     GCC 5.4.1 20160919
Architecture: ARMv6-M
Core Variant: Cortex-M0
Port Info:    Preemption through NMI
Platform:     STM32F072xB Entry Level Medium Density devices
Board:        NanoVNA
Build time:   Jul 22 2019 - 16:26:51
ch> sweep 1000000 30000000
ch> sweep
1000000 30000000 101
ch> data 0
1.000334382 -0.012819038
1.000619411 -0.014043334
1.000123381 -0.015157566
1.000514984 -0.016093827
1.000436782 -0.017410092
1.000501394 -0.018344996
1.000151395 -0.019588120
1.000253081 -0.020322881
0.999891698 -0.021273871
0.999914824 -0.022288246
0.999868750 -0.023332940
0.999770462 -0.024202115
0.999884128 -0.025404103
0.999833703 -0.026232335
0.999632596 -0.027013938
0.999499559 -0.028223698
0.999637365 -0.028801376
0.999387919 -0.029435977
0.999631226 -0.029972538
1.002218246 -0.029391391
1.004171252 -0.032068528
1.001608490 -0.034094724
1.000858068 -0.035458635
1.000560522 -0.036200754
1.000125050 -0.037087496
1.000095486 -0.038230843
1.000262737 -0.039139334
0.999750494 -0.039976678
0.999891042 -0.041104275
0.999784827 -0.042336892
0.999971687 -0.043484516
0.999799907 -0.045150741
0.999982059 -0.046216718
0.999493658 -0.047426808
0.999777674 -0.048748057
0.999688148 -0.049898017
0.999597012 -0.051182426
0.999525427 -0.052349578
0.999216139 -0.053816296
0.999178647 -0.054883997
0.999005794 -0.056154955
0.998820781 -0.057684507
0.999015092 -0.058685358
0.998871505 -0.059900578
0.998757004 -0.061241392
0.998712182 -0.062616705
0.998695135 -0.063646942
0.998613953 -0.064931072
0.998556375 -0.066254936
0.998585581 -0.067580714
0.998366594 -0.068778082
0.998310446 -0.070160925
0.998090565 -0.071184404
0.998218178 -0.072452932
0.998082041 -0.073820449
0.997873008 -0.075051650
0.997672736 -0.076362192
0.997864961 -0.077377557
0.997722983 -0.078763738
0.997510135 -0.080164059
0.997572302 -0.081403687
0.997310221 -0.082679249
0.997066974 -0.083944469
0.997346639 -0.085386037
0.997254550 -0.086459428
0.997277498 -0.087772250
0.997081696 -0.088958740
0.997002899 -0.090456649
0.996815264 -0.091620504
0.996773242 -0.092930428
0.996567785 -0.094331786
0.996562242 -0.095199465
0.996507167 -0.097060345
0.996266543 -0.097908206
0.996095418 -0.099269963
0.996342182 -0.100541479
0.995806276 -0.101831674
0.995640277 -0.103128492
0.995647966 -0.104465112
0.995308578 -0.105523049
0.995393931 -0.106829814
0.995034158 -0.108262822
0.995196044 -0.109290048
0.994729876 -0.110772430
0.995051443 -0.112008184
0.994862079 -0.113100029
0.994484126 -0.114403992
0.994411051 -0.116048157
0.994243025 -0.117027558
0.994225263 -0.118228457
0.994016349 -0.119506403
0.993956506 -0.120835222
0.993702173 -0.122295558
0.993651926 -0.123540185
0.993369281 -0.124662227
0.993133306 -0.125806242
0.992927193 -0.127351313
0.992799878 -0.128284811
0.992875814 -0.129809200
0.992461144 -0.130973890
0.992346584 -0.132136657
ch> data 1
0.000022881 -0.000034072
-0.000044930 -0.000003006
0.000001353 -0.000019715
-0.000053841 -0.000043194
-0.000004344 -0.000006963
0.000001772 -0.000007370
-0.000000086 -0.000014207
-0.000005251 0.000030388
0.000011967 -0.000017351
-0.000020198 0.000030180
-0.000004857 -0.000045057
-0.000020909 0.000002008
0.000010476 -0.000008191
0.000004981 -0.000037762
-0.000053258 0.000006323
-0.000023624 0.000023545
-0.000021935 -0.000011593
-0.000025896 -0.000000449
-0.000039536 -0.000018117
0.000018417 0.000040691
-0.000015518 -0.000064735
-0.000022360 -0.000048622
-0.000014705 0.000005838
0.000012554 -0.000030298
-0.000035040 -0.000004715
0.000017032 -0.000023722
-0.000012310 -0.000016603
0.000024222 -0.000042020
-0.000050025 -0.000037519
-0.000024725 -0.000024864
0.000012915 -0.000024808
0.000015194 -0.000008572
0.000012409 -0.000028297
0.000032538 0.000017843
0.000026463 -0.000013021
-0.000001025 -0.000037424
-0.000019795 -0.000044200
-0.000013177 -0.000036966
-0.000016448 -0.000019061
0.000003270 0.000000127
0.000045834 -0.000063594
-0.000008657 -0.000003194
0.000010901 0.000005717
0.000023127 -0.000009332
-0.000012275 0.000016109
0.000015946 -0.000023457
0.000012786 0.000031161
0.000002111 0.000011889
0.000023851 0.000024347
-0.000001895 0.000019804
0.000021308 0.000006177
0.000027474 -0.000015023
-0.000020845 -0.000027184
-0.000019241 -0.000042736
0.000046159 -0.000022540
-0.000023773 -0.000018934
0.000017447 0.000030827
0.000032983 -0.000004683
0.000000493 -0.000022111
-0.000006937 0.000028902
0.000043825 -0.000022563
0.000062209 0.000005554
0.000046276 -0.000050153
-0.000017177 -0.000012213
0.000033449 -0.000046718
-0.000002024 0.000019626
0.000041615 -0.000019849
0.000026992 -0.000000219
0.000014502 -0.000004934
0.000015049 0.000002597
-0.000033414 0.000004811
-0.000033238 -0.000052053
0.000026538 0.000015010
0.000009085 -0.000022117
-0.000025025 -0.000017477
-0.000002855 -0.000049975
-0.000008924 -0.000026126
-0.000000627 -0.000041066
0.000014821 0.000012632
0.000008421 0.000025136
0.000020770 -0.000022932
0.000021408 0.000012013
-0.000002280 -0.000019163
-0.000031954 0.000019613
-0.000012588 0.000018006
0.000011647 0.000022847
0.000030014 0.000008953
-0.000044193 0.000000472
0.000014898 -0.000047376
0.000015692 -0.000035619
-0.000000117 -0.000035395
0.000010286 -0.000003112
-0.000038924 -0.000028851
-0.000023267 -0.000004298
-0.000060468 -0.000020690
-0.000024815 0.000003858
-0.000012520 -0.000020648
-0.000003775 -0.000013356
-0.000001176 -0.000004715
-0.000015004 -0.000030841
-0.000015286 -0.000069948
ch>
« Last Edit: September 08, 2019, 08:24:30 am by radiolistener »
 

Offline Flynt

  • Newbie
  • Posts: 6
  • Country: it
Re: NanoVNA Custom Software
« Reply #278 on: September 08, 2019, 11:51:29 am »
Joeqsmith, you didn't understand anything ...
I HAVE NEVER THOUGHT THAT YOUR TIME DOES NOT APPLY, I ONLY REQUEST THE INSTALLER OF A PROGRAM YOU DEVELOPED ...

I think you didn't understand my intentions, and I'm not able to program.
However, not but nothing, the Gentile helped me
Radioman ...

On the other hand, these are the Americans ... We in Italy, among radio amateurs, help each other.

Bye Bye :( :( :(

I'm glad we finally understand one another.    It's too bad that your not getting my work for free upsets you to the point you feel the need to make such ignorant comment about an entire country but it speaks of your character.     

You do bring up a valid point that what I have been doing is of no help to you.  Others have posted similar comments,  which is something I can live with. 

Take care.

(TAKE CARE):Pay attention to what ?? To you'??? Should I be Afraid ???
 :-DD :-DD :-DD

I didn't want your job, for free, I also wrote you that I was ready to give you a Donation ...

We ITALIANS, we are not like that and among Radio Amateurs & Makers we help each other Free ...

And then a private reply message, you could send it !!!  :=\ :=\ :=\

Don't worry, thanks to the lovely RADIOLISTENEN User, I Solved ...

GOODBYE  :-X :-X :-X
« Last Edit: September 08, 2019, 12:00:17 pm by Flynt »
 

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11715
  • Country: us
Re: NanoVNA Custom Software
« Reply #279 on: September 08, 2019, 03:44:39 pm »
joeqsmith - May I abuse your patience and ask:

...

Of course this will slow down the sweep rate by a factor of 5 but I have learned that refresh rate is not everything and there are quite expensive professional test equipment with rather slow sweep rates (a joke in my opinion - but that is another story).
It is not yet clear to me how to software-wise configure the NanoVNA to do S21 measurement so that I just hook the DUT on Port 0 and get a spectrum reading.

Regards
Vitor
Interesting you say that about the speed.  I have a very old Tektronix SA that still uses analog filters that is very slow.    The old HP shown in the picture that I am using to compare with the Nano uses digital IF filtering.   From the plot you could see with a 100KHz span and RBW of 580Hz using the swept spectrum mode requires 154ms.

If I were to adjust the RBW to something lower, say 73 Hz, it would take 1880  seconds.  At the lowest RBW (1.1 Hz) it would require 1,720,000 seconds to sweep.   This analyzer has a narrow band mode that can improve the sweep time.   For example using the same 100KHz span and a 360Hz resolution it requires 10mSec.   

The HP uses 401 samples for all modes compared with the 101 of the Nano.   Looking at the same signal with the Signal Hound using the sweep mode requires 70mSec but it collects 5243 samples. 

As far as setting up the Nano,  CH1 would be set to thru, then LogMag.  In the case of this demo, the Stimulus is set to a Center of 20MHz and the Span set to 100K.  With it being a relative measurement,  just ignore the calibration.   Based on the bit of testing I did, keep the power below 0dBm to avoid compression and you should be fine.   

****

Forgot to mention that the old HP uses GPIB which is fairly slow where the Signal Hound is using USB3.   The Signal Hound can spit data out fast enough that they have a note in the manual that talks about if you plan to write your own software that you will need to keep up.     With the HP, I don't think that would ever be a concern.   
« Last Edit: September 08, 2019, 03:50:16 pm by joeqsmith »
 

Offline Bicurico

  • Super Contributor
  • ***
  • Posts: 1761
  • Country: pt
    • VMA's Satellite Blog
Re: NanoVNA Custom Software
« Reply #280 on: September 08, 2019, 03:52:05 pm »
@radiolistener: Thanks for your valuable explanations.

If you notice my previous posts, I do know some parts of it, like the DATA command, but I did not know that I could use the 0/1 argument to get only the required data. That is great and now I understand what joeqsmith meant.

Also, while I do understand that the X/Y data that is received with the DATA command represent a complex number, with real and imaginary component.

What I do NOT understand at this point is for instance how to calculate the dB figure that the NanoVNA shows on the LCD for CH1.

Finally, one of the things I want to achieve is to use the NanoVNA as a spectrum analyzer. I understand it was not designed for this, but I got the impression that it would be a possible thing to do. It is here where I need help!

The communication part is already working, as can be tested with my tool, though it is an initial draft implementation.

I will bear in mind to separate communication from processing, as suggested by OwO.

@Owo: Do you know further details, like retail price, LCD size and resolution, additional functionality (like spectrum analyzer)?

Kind regards,
Vitor

Offline Bicurico

  • Super Contributor
  • ***
  • Posts: 1761
  • Country: pt
    • VMA's Satellite Blog
Re: NanoVNA Custom Software
« Reply #281 on: September 08, 2019, 04:38:18 pm »
The HP uses 401 samples for all modes compared with the 101 of the Nano.   Looking at the same signal with the Signal Hound using the sweep mode requires 70mSec but it collects 5243 samples. 
...
Forgot to mention that the old HP uses GPIB which is fairly slow where the Signal Hound is using USB3.

I own a HP8594E (actually I own three units, but two are lacking a working PSU).

I made a special version of my "VMA Simple Spectrum Analyser" software for this series (HP/Agilent 859x) and indeed they use 401 samples per sweep and you are right, using GPIB to transfer these samples takes quite some time, compared for instance with the R&S CMU200/CRTU.

Feel free to take a look at my blog and download the software, in case your HP is of the 859x series. You will require a free license.

I am considering adapting this software for the NanoVNA, in order to use it as a spectrum analyzer (first goal) and then eventually add VNA measurements to my software. So that is the big picture.

And once again, because VNA is totally new to me, I might be wrong about what I imagine is possible to do, but unless I understand that it is indeed impossible, I will try as time allows.

Also note, that hobby-wise I come from TV/CATV/SAT, reception, multiplexing, broadcasting and of course field meters, got into spectrum analysis and am now looking at VNA, which is a bit of a different field to what I am used to.

regards,
Vitor

Online radiolistener

  • Super Contributor
  • ***
  • Posts: 3826
  • Country: ua
Re: NanoVNA Custom Software
« Reply #282 on: September 08, 2019, 05:09:46 pm »
What I do NOT understand at this point is for instance how to calculate the dB figure that the NanoVNA shows on the LCD for CH1.

dB figure is a just magnitude of that complex number in logarithmic scale:

magnitude = sqrt(re*re + im*im);

dB = 20 * log10( magnitude );

magnitude value is a Linear S11 plot
dB value is a Logmag S11 plot

The same for S21.
« Last Edit: September 08, 2019, 05:12:51 pm by radiolistener »
 

Offline Bicurico

  • Super Contributor
  • ***
  • Posts: 1761
  • Country: pt
    • VMA's Satellite Blog
Re: NanoVNA Custom Software
« Reply #283 on: September 08, 2019, 05:57:38 pm »
Thanks!

I was being stupid - I somehow was thinking in dBm and not dB.

Anyway, I was doing some hacking and indeed the stitched sweep works!

My software now uses 500 samples (505 to be exact), by running the sweep/data commands 5 times in sequence to cover the selected frequency range.

Speed wise it is OKish - right now I am doing one sweep on every button click. For a continuous mode, I would optimize my code, so that the trace is updated with each individual segment, which would give the illusion of higher sweep rate (much like my VMA Simple Spectrum Analyser software does it for the cheap ADF4351 devices).

Note how the curves are much smoother on the graph and please ignore the rudeness and wrongness of the graph!

Regards,
Vitor


Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11715
  • Country: us
Re: NanoVNA Custom Software
« Reply #284 on: September 08, 2019, 06:58:55 pm »
The HP uses 401 samples for all modes compared with the 101 of the Nano.   Looking at the same signal with the Signal Hound using the sweep mode requires 70mSec but it collects 5243 samples. 
...
Forgot to mention that the old HP uses GPIB which is fairly slow where the Signal Hound is using USB3.

I own a HP8594E (actually I own three units, but two are lacking a working PSU).

I made a special version of my "VMA Simple Spectrum Analyser" software for this series (HP/Agilent 859x) and indeed they use 401 samples per sweep and you are right, using GPIB to transfer these samples takes quite some time, compared for instance with the R&S CMU200/CRTU.

Feel free to take a look at my blog and download the software, in case your HP is of the 859x series. You will require a free license.

I am considering adapting this software for the NanoVNA, in order to use it as a spectrum analyzer (first goal) and then eventually add VNA measurements to my software. So that is the big picture.

And once again, because VNA is totally new to me, I might be wrong about what I imagine is possible to do, but unless I understand that it is indeed impossible, I will try as time allows.

Also note, that hobby-wise I come from TV/CATV/SAT, reception, multiplexing, broadcasting and of course field meters, got into spectrum analysis and am now looking at VNA, which is a bit of a different field to what I am used to.

regards,
Vitor

That's a nice setup with the tracking generator.    The HP shown is a 3589A.  Where you have 2.9GHz to play with, this one is limited to 150MHz.  HP calls it a spectrum/network analyzer.  It's a bit of a hybrid.  You can use it with an external coupler and it has software to support down conversion.   

Pictures showing my home made 50 ohm standard with Mini-Circuits coupler.  They did offer a test set for this instrument.

Also shown for fun is two signal generators connected to a splitter and to the 3589A.   The generators are set to 10MHz, separated by 100Hz and 10dBm.     Using the swept mode, you can see it requires 104.86 seconds to sweep.   Using the narrow mode requires 1.28 seconds.   Note the resolution does change but its never caused me a problem.   

For my electronics hobby, I really can't justify the cost of new TE in most cases.  I do a fair amount of projects below 100MHz into the KHz and this system works really well for this.

Offline rhb

  • Super Contributor
  • ***
  • Posts: 3490
  • Country: us
Re: NanoVNA Custom Software
« Reply #285 on: September 08, 2019, 11:58:26 pm »
Would you mind explaining the calibrator?  The short, open, load and thru are obvious, but I don't understand the 5th.  There appears to be a "pi" network of some type.  Is that an attenuator?
 

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11715
  • Country: us
Re: NanoVNA Custom Software
« Reply #286 on: September 09, 2019, 12:09:37 am »
Yes, 10dBish. 

Online radiolistener

  • Super Contributor
  • ***
  • Posts: 3826
  • Country: ua
Re: NanoVNA Custom Software
« Reply #287 on: September 09, 2019, 12:35:06 pm »
joeqsmith, could you please explain some details about your cal kit design?

The distance between ground and signal wire is not the same along signal wire path. For example, there is too small gap between resistors and the ground on the left side (according to photo orientation). It definitely should affect impedance, isn't it?

Also, there is too small gap between signal wire on PCB and ground on SMA connector...
« Last Edit: September 09, 2019, 12:51:35 pm by radiolistener »
 

Offline N2CUA

  • Newbie
  • Posts: 9
Re: NanoVNA Custom Software
« Reply #288 on: September 09, 2019, 03:43:27 pm »
Hey Rune .. can you clear some items from your inbox on here so I can send you that list?  ;)

( Sorry for this being kind off topic, but the list does relate to the nanovna software being developed in python )
 
The following users thanked this post: 5q5r

Offline rhb

  • Super Contributor
  • ***
  • Posts: 3490
  • Country: us
Re: NanoVNA Custom Software
« Reply #289 on: September 09, 2019, 04:06:44 pm »
The frequency spacing determines how long the time domain trace is.  The Nyquist frequency determines the sampling.  If you sweep to 900 MHz at 1 MHz spacing you have data for 1 microsecond.  If you pad the end of the frequency series to raise Nyquist to 2 GHz you will have 250 ps sampling.

So, the time interval after IFFT is from 0 to 1/[frequency step] is it correct?


If by "time interval" you mean Tzero to Tmax, yes. 
 

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11715
  • Country: us
Re: NanoVNA Custom Software
« Reply #290 on: September 09, 2019, 04:59:47 pm »
joeqsmith, could you please explain some details about your cal kit design?
Depends

The distance between ground and signal wire is not the same along signal wire path. For example, there is too small gap between resistors and the ground on the left side (according to photo orientation). It definitely should affect impedance, isn't it?
Yes

Also, there is too small gap between signal wire on PCB and ground on SMA connector...

A better question is, does any of this cause a problem in the frequency range I use them at.   The board was designed using Sana many years ago.  There was a tradeoff staying with this geometry.   The goal was to use the boards at 1G max, which they have been fine for.  I've used them a little over this.  I would never suggest they would perform at the higher frequencies I have been showing, which is why I posted that disclaimer a few times.
« Last Edit: September 09, 2019, 05:06:21 pm by joeqsmith »
 

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11715
  • Country: us
Re: NanoVNA Custom Software
« Reply #291 on: September 09, 2019, 05:05:27 pm »
I have been thinking about the Nano TDR and if there is a way to combine the phase information.   I think the problem is going to be noise.   In all but a worst case condition where we have a lot of signal being returned, I'm not sure there would be enough information in the phase to use it.   I have yet to try any sort of experiment but my later post showing the RF signal generator attached to channel 1 gives me an idea that it wouldn't work very well.   

Maybe I am missing something, which would be the norm. 

Offline rhb

  • Super Contributor
  • ***
  • Posts: 3490
  • Country: us
Re: NanoVNA Custom Software
« Reply #292 on: September 09, 2019, 06:26:10 pm »
Depends on the nature of the noise.  If it is random, it's not a problem.  You can significantly increase the dynamic range by summing measurements.  It the noise is not random it gets more complex, but if you can accurately characterize the noise you can suppress it.  The reflection seismic community has a vast array of tricks for suppressing noise in multichannel data.

I once walked a Scripps PhD candidate through suppressing noise which was probably 40-60 dB *greater* than the signal.  I was quite blown away by his final result as all I had done was demonstrate the rudiments of the process.  Once he grasped the concept, he did an exquisitely meticulous  job of it.

I'm jammed up with an HVAC repair today, so not sure I'll have time to play.  First order test is to do a cal, attach a cable and read the magnitude and phase for S & O.   In theory they should be 180 degrees out of phase, but with a linear delay equal to twice the electrical length of the cable.

Then try some loads which are not 50 ohms and see how small a reflection it can detect.

I *think* that if the test cable has an adjustable attenuator in series, that by placing a S & O at the end and adjusting the attenuator one can directly measure the dynamic range for TDR.  It should be 2x the attenuator setting as the reflection passes through the attenuator twice.

I'm a seismic guy, so at times I bungle the translation from elastic to electromagnetic waves.  Also I'm used to going from time to frequency rather than from frequency to time.  So I generally take a time case, transform to frequency and then transform back.  That way I start with the answer I'm looking for.

Have Fun!
Reg
 
The following users thanked this post: radiolistener

Online radiolistener

  • Super Contributor
  • ***
  • Posts: 3826
  • Country: ua
Re: NanoVNA Custom Software
« Reply #293 on: September 10, 2019, 02:48:46 am »
This is my TDR results taken with NanoVNA :)

SHORT and LOAD terminators from cal-kit
831081-0831087-1

500 Ohm and 5 Ohm terminators through SMA-SMA adaptor (adaptor delay is 0.247 ns):
831093-2831099-3

This is CH0 => cable => T adaptor with 50 Ohm terminator => cable => CH1. I'm used two 0.32 meter cables which came with NanoVNA. So, in total we have 25 Ohm in the middle of transmission line. This result may be affected with CH1 input impedance, which drops down to 40 Ohm at 900 MHz, so needs to perform it again with good 50R terminator at the end of line.
831105-4

Now let's try more complex transmission line, here is a sequence:
1) 0.5 meters RG316 (SMA-SMA)
2) SMA to SO239 adaptor
3) 1 meter LMR195 (PL259-PL259)
4) SO239 to SMA adaptor

And this is how it works with open end. And with 50R terminator on the end:
831111-5831117-6

Here is zoomed and commented last image (50R at the end of sequence):
831123-7
« Last Edit: September 10, 2019, 03:15:55 am by radiolistener »
 

Offline rhb

  • Super Contributor
  • ***
  • Posts: 3490
  • Country: us
Re: NanoVNA Custom Software
« Reply #294 on: September 10, 2019, 03:12:33 am »
It's late, I've had a couple of drinks and am headed for bed, but that looks very reasonable.

A triangle window in frequency will suppress the sinc(t) sidelobes a lot, so I suggest trying that.  Squaring the sidelobes makes them rather small.  All window functions have side effects.  At the moment, I prefer a triangular aka Bartlett window as being the best compromise, at least for TDR work.

I'd also suggest preserving the sign of the time domain amplitude so that it's easy to tell capacitive and inductive discontinuities apart.

Have Fun!
Reg
 
The following users thanked this post: radiolistener

Online radiolistener

  • Super Contributor
  • ***
  • Posts: 3826
  • Country: ua
Re: NanoVNA Custom Software
« Reply #295 on: September 10, 2019, 03:53:56 am »
A triangle window in frequency will suppress the sinc(t) sidelobes a lot, so I suggest trying that.  Squaring the sidelobes makes them rather small.  All window functions have side effects.  At the moment, I prefer a triangular aka Bartlett window as being the best compromise, at least for TDR work.

This is comparison for Rectangular, Triangular, Blackman and Blackman-Harris-7 window functions:
831141-0831147-1831153-2831159-3

This picture shows complex components with Blackman window
831165-4

It seems that the Blackman window is the best choice here, because all other window function have high side lobe distortions.

Note: all these pictures are the same reflections from connectors and adapters between different pieces of cables connected together in a line with 50 Ohm load on the end (taken from the last test, see my previous post).

I'd also suggest preserving the sign of the time domain amplitude so that it's easy to tell capacitive and inductive discontinuities apart.

If I understand correctly, in time domain we have reflection coefficient Γ in complex representation. So, I just calculated VSWR in the following way:

VSWR  = (1 + |Γ|) / (1 - |Γ|)

And it works pretty good. But I'm not sure, is it correct?

If you're talking about |Γ| it is always have positive sign. So I'm not sure what did you mean with "time domain amplitude"?


I want to get a chart with absolute impedance along the transmission line. Something like this:

831171-5

Is it possible?
« Last Edit: September 10, 2019, 04:54:12 am by radiolistener »
 

Offline rhb

  • Super Contributor
  • ***
  • Posts: 3490
  • Country: us
Re: NanoVNA Custom Software
« Reply #296 on: September 10, 2019, 07:41:19 pm »
That's a very nice comparison.  The price for the Blackman window is the inability to separate adjacent reflections.  There are a great many different windows, each having particular strengths and weaknesses.  I thought I knew *all* the windows until I looked at the wikipedia entry.

The Fourier transform of the last figure exists.  So all that is needed to do it is to acquire that data in the frequency domain and find a good heuristic for the DC component.  A sparse L1 (aka basis) pursuit should do an excellent job of solving for DC.

If you compare a TDR trace for an open and short you will see what I mean about preserving the sign of the reflection coefficient.  Knowing that the impulse response is a series of impulses of alternating sign tells you that one discontinuity is inductive and one is capacitive.   This makes it possible to measure the values of the discontinuities.

Have Fun!
Reg

BTW I'd like to suggest using inline full size figures for things like the window comparison.  That would let people see all of them by scrolling up and down.
 

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11715
  • Country: us
Re: NanoVNA Custom Software
« Reply #297 on: September 11, 2019, 05:14:05 pm »
The data shown seems about right for time/length.  If you wanted to compare software with others,  you may want to consider using a standard test file that you could then share with other to compare your results,  rather than using the Nano and cables.  Or maybe stay with the bits included with the Nano.

As far as the windows,  currently I have everything fixed in my software for the Nano but it's not problem to overlay the standard ones in LabView.    Shown with the data I had taken off that small section of coax I used to make my Beatty standard for that last video.   

I haven't tried to do anything more with the Nano.  I have no doubt that the phase would be very sensitive to an open/short and I am sure if you wanted to do a relative long cable measurement for an open cable it would be fairly simple.  But measuring a mm on a 10meter cable is an interesting problem to try and tackle. 

Online radiolistener

  • Super Contributor
  • ***
  • Posts: 3826
  • Country: ua
Re: NanoVNA Custom Software
« Reply #298 on: September 11, 2019, 07:46:22 pm »
joeqsmith, how did you calculated that figure?

S1P => apply window => IFFT => ? ? ? => plot


Here is my test S1P file for pictures above:
 

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11715
  • Country: us
Re: NanoVNA Custom Software
« Reply #299 on: September 12, 2019, 02:27:46 am »
pad to ifft to lp to plot

**
That's LP impulse.  For step, its the integral.  Found most of this in HP app notes.  Still could be wrong.

   
« Last Edit: September 12, 2019, 02:35:53 am by joeqsmith »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf