Author Topic: NanoVNA Custom Software  (Read 471258 times)

0 Members and 7 Guests are viewing this topic.

Offline N2CUA

  • Newbie
  • Posts: 9
Re: NanoVNA Custom Software
« Reply #300 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: 3483
  • Country: us
Re: NanoVNA Custom Software
« Reply #301 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. 
 

Online joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11793
  • Country: us
Re: NanoVNA Custom Software
« Reply #302 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 »
 

Online joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11793
  • Country: us
Re: NanoVNA Custom Software
« Reply #303 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: 3483
  • Country: us
Re: NanoVNA Custom Software
« Reply #304 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

Offline radiolistener

  • Super Contributor
  • ***
  • Posts: 3433
  • Country: ua
Re: NanoVNA Custom Software
« Reply #305 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: 3483
  • Country: us
Re: NanoVNA Custom Software
« Reply #306 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

Offline radiolistener

  • Super Contributor
  • ***
  • Posts: 3433
  • Country: ua
Re: NanoVNA Custom Software
« Reply #307 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: 3483
  • Country: us
Re: NanoVNA Custom Software
« Reply #308 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.
 

Online joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11793
  • Country: us
Re: NanoVNA Custom Software
« Reply #309 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. 

Offline radiolistener

  • Super Contributor
  • ***
  • Posts: 3433
  • Country: ua
Re: NanoVNA Custom Software
« Reply #310 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:
 

Online joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11793
  • Country: us
Re: NanoVNA Custom Software
« Reply #311 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 »
 

Online joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11793
  • Country: us
Re: NanoVNA Custom Software
« Reply #312 on: September 12, 2019, 03:03:43 am »
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.

Doing an FFT from time to frequency, padding with zeros and inverse transforming is the standard way to resample data to finer sampling rates.  There are other ways of doing it, but the FFT is the fastest.

.......

Have Fun!
Reg

I need to say, I owe you a big thanks for posting this little bread crumb.  This technique was shown in those last couple of plots.  I added it to my Nano program as well and tried it out with hardware.  The is a really nice improvement.  Google came through with the linked article.   
     
https://dspguru.com/dsp/howtos/how-to-interpolate-in-time-domain-by-zero-padding-in-frequency-domain/

Offline rhb

  • Super Contributor
  • ***
  • Posts: 3483
  • Country: us
Re: NanoVNA Custom Software
« Reply #313 on: September 12, 2019, 03:07:43 am »
The key to high quality scientific software is identifying cases for which a precise analytic answer is available.  Actually doing that can be staggeringly difficult.

I have spent many days wracking my brain looking for even one.  And I can think of many cases where none is known.  Wave propagation in anisotropic media is staggeringly difficult to verify correctness.

If you cannot solve the analytic equation, why should you trust the numerical solution?  This problem dominated my career in the oil industry.  Once in a great while you wake up in the morning and realize that there is a problem with a known answer that you can use to test a numerical simulation.  But such mornings are depressingly rare.  This is very seriously difficult.  A complete novice can pose a test case that an expert with many years of experience never thought of.

If you're trying to validate the results from a program on which a $100 million decision is going to be made it will drive you crazy.

Reg

BTW Joe,  that was a very basic breadcrumb.  I had the good fortune to be abused by several old men into learning it ;-)
 

Offline radiolistener

  • Super Contributor
  • ***
  • Posts: 3433
  • Country: ua
Re: NanoVNA Custom Software
« Reply #314 on: September 12, 2019, 03:37:34 am »
pad to ifft to lp to plot

I know that, but my question is what you're doing with data after IFFT?

This is just a sum of real and imaginary part?
 

Online joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11793
  • Country: us
Re: NanoVNA Custom Software
« Reply #315 on: September 12, 2019, 03:53:04 am »
I have no problem with it being basic for you.  Its still a very nice bit of information, at least for me.  So a big thanks for that one.    The only down side is that I didn't have it implement it before making any videos.     

Test jig for trying out some of these bones you're tossing out.

***
Resolution should be sub 0.001". 
« Last Edit: September 12, 2019, 11:24:40 am by joeqsmith »
 

Online joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11793
  • Country: us
Re: NanoVNA Custom Software
« Reply #316 on: September 12, 2019, 03:55:00 am »
pad to ifft to lp to plot

I know that, but my question is what you're doing with data after IFFT?

This is just a sum of real and imaginary part?

Note, it's backwards from what you had posted.    After LP, I just plot it.   

Offline radiolistener

  • Super Contributor
  • ***
  • Posts: 3433
  • Country: ua
Re: NanoVNA Custom Software
« Reply #317 on: September 12, 2019, 07:19:02 am »
After LP, I just plot it.   

Could you please share S1P file for this screenshot?

Or just another S1P and screenshot with TDR impedance for this S1P...

For step, its the integral.  Found most of this in HP app notes.  Still could be wrong.
what HP app note exactly you're talking about?
« Last Edit: September 12, 2019, 07:22:08 am by radiolistener »
 

Offline in3otd

  • Contributor
  • Posts: 19
  • Country: it
Re: NanoVNA Custom Software
« Reply #318 on: September 12, 2019, 07:28:38 am »
I know that, but my question is what you're doing with data after IFFT?
This is just a sum of real and imaginary part?

After the IFFT you should have a purely real response, i.e. the imaginary part should be zero - so you will need to plot just the real part.
Your frequency-domain data (S-parameters) are complex data and when you do an IFFT on them you need to input also the negative frequencies part, as the complex conjugate of the positive frequency data you have, so that the IFFT results will be real.
 

Offline radiolistener

  • Super Contributor
  • ***
  • Posts: 3433
  • Country: ua
Re: NanoVNA Custom Software
« Reply #319 on: September 12, 2019, 09:06:33 am »
After the IFFT you should have a purely real response, i.e. the imaginary part should be zero - so you will need to plot just the real part.

Both input and output of FFT or IFFT are complex.

Your frequency-domain data (S-parameters) are complex data and when you do an IFFT on them you need to input also the negative frequencies part, as the complex conjugate of the positive frequency data you have, so that the IFFT results will be real.

The input (S-parameters) are complex, so the information about negative frequency is already present. And the output of IFFT is complex value with real and imaginary part.

Here is example of IFFT output for S1P that I shared here (LMR195-RG31605-LMR195-RG58-LOAD.s1p). This is measurement of three different piece of coax cable connected together through adapters and terminated with 50 Ohm at the end of transmission line.
« Last Edit: September 12, 2019, 09:10:32 am by radiolistener »
 

Online joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11793
  • Country: us
Re: NanoVNA Custom Software
« Reply #320 on: September 12, 2019, 11:52:22 am »
After LP, I just plot it.   

Could you please share S1P file for this screenshot?

Or just another S1P and screenshot with TDR impedance for this S1P...

For step, its the integral.  Found most of this in HP app notes.  Still could be wrong.
what HP app note exactly you're talking about?

See attached
 
The following users thanked this post: radiolistener

Online joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11793
  • Country: us
Re: NanoVNA Custom Software
« Reply #321 on: September 12, 2019, 12:16:54 pm »
You may find this app note of interest as well. 

Offline radiolistener

  • Super Contributor
  • ***
  • Posts: 3433
  • Country: ua
Re: NanoVNA Custom Software
« Reply #322 on: September 12, 2019, 12:26:51 pm »
See attached

Thanks, but I'm failed to get the same result, I cannot get such picture like your from this s1p  ???

Could you please show also picture with IFFT result (before LPF and other processing) for this s1p file?  Just a plot of real and imaginary parts...

Also what is units along X axis on your picture? If these are nanoseconds, it seems that they are multiplied by two for some reason.

I see that the pulses in provided S1P file are located at 13.762 ns and 18.679 ns. Isn't it?
« Last Edit: September 12, 2019, 12:34:11 pm by radiolistener »
 

Online joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11793
  • Country: us
Re: NanoVNA Custom Software
« Reply #323 on: September 12, 2019, 04:41:41 pm »
There are many possible reasons for this.  There could be bugs on both sides and miscommunications on both sides....   Certainly what I am showing shouldn't be considered a gold standard.   We almost need someone with a known working setup to provide some test cases that people could then use to validate their math. 

The Touchstone file I provided was from the current setup which is different from the previous plots.  There is a phase trimmer between the Beatty standard and the Nano.  The Beatty standard was terminated to 50 ohms.   I assumed you just wanted to see the 50-25-50 ohm transitions which this file would have, assuming there isn't a bug.   

On previous plots, the X-axis is in samples or inches.  I'm not sure where the phase was set for the file I sent but is is not so long as to be outside of the window.  The Beatty is about 22ish inches of 25 ohm. 

Offline rhb

  • Super Contributor
  • ***
  • Posts: 3483
  • Country: us
Re: NanoVNA Custom Software
« Reply #324 on: September 12, 2019, 06:03:10 pm »
Real to complex and complex to real in place FFTs are very popular because the negative frequencies are the complex conjugate of the positive frequencies.  Back when  room size computer had 4 MB of memory and multiple users, these were essential to seismic processing.  But there are lots of FFTs which do *not* fill in the complex conjugate part.  So it matters what algorithm you use.

I'll post TDR to 20 GHz BW using an 11801 & SD-24 later.  Setup will be SMA-M to BNC-F cable open, same with Chinese 50 ohm BNC-M terminator, then SMA-F to BNC-F cable  to BNC-M to SMA-M cable to SMA-F to N-F adapter and Anritsu 50 ohm N-M calibrator load.  The cables are very high quality made for me by a friend.  So it will be a canonical test case.  I can also sweep them to 3 GHz on an 8560A w/ TG option in addition to my nanoVNA results.

The SMA to BNC cables are about 10-12" so it gives good separation in the time domain.

For testing software,  multiply a complex series with a real part of 1.0 and an imaginary part of 0.0 by exp(j*2*pi*f*t) for t equal to 1/2 the reciprocal of the frequency spacing.  Do this with the DC part [0,0]  and with the DC part [1.0,0].  In both cases you should get a spike in the middle of the TDR trace.  Without the DC, the base of the spike will be offset from zero.

Another canonical test is a cosine in frequency.  That will be a pure real spike in time.  A sine wave will be a pure imaginary spike in time.

I've got some headaches to take care of, so it might be a day or two before I have time to do the physical tests.

Attached below are a few pages from Bracewell with pictures of important transforms in both domains.  Most of these are excellent test cases as both domains are obvious.  Some are more complex, but I thought I'd leave them.

What matters are impulse, sine, cosine, "boxcar" (sinc) and some of the variations.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf