Author Topic: NanoVNA Custom Software  (Read 526990 times)

0 Members and 5 Guests are viewing this topic.

Offline ALW

  • Contributor
  • Posts: 33
  • Country: fr
Re: NanoVNA Custom Software
« Reply #1200 on: August 09, 2021, 03:58:20 pm »
What I need would be similar to a touchstone s2p file:
Columns
Freq Re{S11}  Im{S11}  Re{S21}  Im{S21}
or alternatively
Freq MagS11 PhS11 MagS21 PhS21

Lines
Freq1
Freq2
...
Freq1
Freq2
...
for continuous sweeps

If it is ASCII or binary doesn't matter, I could read both as long as I know the header / offset and byte structure of the binary.
 

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11758
  • Country: us
Re: NanoVNA Custom Software
« Reply #1201 on: August 09, 2021, 04:23:53 pm »
Which software are you are using?  I may add it to the main program is why I ask. 

Let's assume ASCII, do you want the frequency in Hz?  SI units?  What?    Same for Mag in dB and phase in degrees? 

Are you wanting to use a SPACE, 0x20 for the delimiter as shown? 

How do you want to mark the end of line?  CR?  CRLF?  LF?


***
Also, I don't understand the Freq1 showing up twice in your example.
« Last Edit: August 09, 2021, 04:26:30 pm by joeqsmith »
 

Offline ALW

  • Contributor
  • Posts: 33
  • Country: fr
Re: NanoVNA Custom Software
« Reply #1202 on: August 09, 2021, 04:41:07 pm »
First, thanks a lot for your help! I really appreciate it.
I am using a software called IgorPro, that I am familiar with. It is similar to Mathlab, but is more powerful in doing complex math in (almost) real time, therefore cool for prototyping, later I am planning to retrieve the data directly using the com port of the Nanovna. Igor can read any data structure as long as I can tell it the structure.
So for your questions, anything that is most convenient for you when programming. Freq in Hz Mag in dB and phase in ° would be fine. It is however no problem to convert from other units if this would save your time. Space as delimiter and CR EOL would be fine too. Or if binary the byte structure of the float and the indexing / header length would be all that is required to read it.
With the freq1 showing twice (looping) I mean the recording should loop through the frequencies for multiple repeated sweeps... Of course it would be enough to have the frequencies only once, they do not need to be repeated

« Last Edit: August 09, 2021, 04:59:15 pm by ALW »
 

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11758
  • Country: us
Re: NanoVNA Custom Software
« Reply #1203 on: August 09, 2021, 04:56:38 pm »
When I asked
Quote
Which software are you are using?  I may add it to the main program is why I ask. 
  I am referring to my software.  I would have no way to add anything to IgorPro.   No matter as it sounds like you shouldn't have any problems then working with the binary file directly. 

FREQ (double)
CHANNEL0&1 (double complex)

The data is contiguous.

Offline ALW

  • Contributor
  • Posts: 33
  • Country: fr
Re: NanoVNA Custom Software
« Reply #1204 on: August 09, 2021, 05:10:09 pm »
Sorry, I misunderstood you. Using your latest release r2.0.3 with a NanoV2+4.
Should be able to read your binary, but do not understand yet. Your bin file seems to have a header, do you know how long that is / where the data block starts?
FREQ (double)
CHANNEL0&1 (double complex)
means
FREQ (double)
CHANNEL0(double complex)
CHANNEL1(double complex)
?
I am reading the Labview specs right now, I think I am finding the definitions. Looks like double complex is 64bit real 64bit imaginary. Will try to figure it out, thanks a lot!

edit: With the freqs being repeated I should be able to find the data block/ header end. Will bug you only again if I can't figure it out
« Last Edit: August 09, 2021, 05:19:42 pm by ALW »
 

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11758
  • Country: us
Re: NanoVNA Custom Software
« Reply #1205 on: August 09, 2021, 05:29:57 pm »
Yes, channe0 followed by channel 1.  Yes, double is 64-bit.  Yes complex will store both the real and imaginary component to two separate 64-bit numbers.    The header is from prepending the array size.  Data is stored big-endian.

Offline ALW

  • Contributor
  • Posts: 33
  • Country: fr
Re: NanoVNA Custom Software
« Reply #1206 on: August 09, 2021, 07:22:52 pm »
Thanks a lot. That will do
 

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11758
  • Country: us
Re: NanoVNA Custom Software
« Reply #1207 on: August 09, 2021, 08:16:22 pm »
If you get stuck, let me know.  It would only take a few minutes to write a translator.   

***
Good to see someone attempting to use it for something other than VSWR.    I was trying to measure various liquids with the V2Plus4 using a simple home made coaxial probe. 

https://www.mdpi.com/2075-4418/8/2/40/pdf

https://www.keysight.com/us/en/product/N1501A/dielectric-probe-kit.html
« Last Edit: August 09, 2021, 08:31:37 pm by joeqsmith »
 

Offline ALW

  • Contributor
  • Posts: 33
  • Country: fr
Re: NanoVNA Custom Software
« Reply #1208 on: August 09, 2021, 08:55:11 pm »
Your remark about prepending array size put me right on track  :-+
I guess it goes like: Uint size, frequencies, Uint size, Ch1 complex, etc.
I started with VSWR too, was fun to try-and-error a Vivaldi out of copper tape. When the Smith chart shows a bit too much inductance, cut some tape and make the coupling capa larger... Works like a charm, got the SWR below 1.2 in the entire 2.4 G ISM band  (need  directional antennas for the radar). Now I have the rough shape, will cut it out of copper sheet and put it in a can (side lope suppression) to reduce direct path reception.
Its amazing what this little thing can do, but your software is definitively the icing on the cake. Reference subtraction, all the options for stimulus, automatic marker placement, ... incredible.  :-+ :-+ :-+ :clap:
« Last Edit: August 09, 2021, 09:31:45 pm by ALW »
 

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11758
  • Country: us
Re: NanoVNA Custom Software
« Reply #1209 on: August 09, 2021, 09:35:31 pm »
In the case of this software, I've used Touchstone which isn't going to work for cases like this where we want to look at continuous sweeps.   If I need to interface with another program, I will normally use CSV.  Normally when I want to look at the trends (for example watching how the wife's nail polish cures), I just load it into that 3D viewer.   It slices up the data by sweeps over time.   Besides surface, you can also select scatter plots.   

In your case, you need to know how many samples make up a single sweep, then parse the data.  Easy enough to look for the frequency to repeat.   

Offline ALW

  • Contributor
  • Posts: 33
  • Country: fr
Re: NanoVNA Custom Software
« Reply #1210 on: August 09, 2021, 09:48:18 pm »
Nail polish curing control by RF  :-DD You made my day!
I am planning to fft the sweep data and then digitally filter out a certain radar range / frequency window. Then look at phase shift in this window.
It's late here now, with the hexeditor I do understand the structure of the file now. The sample number seems to be written in front of each data block as UINT32. Will try to read the binary tomorrow.
« Last Edit: August 09, 2021, 09:54:20 pm by ALW »
 

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11758
  • Country: us
Re: NanoVNA Custom Software
« Reply #1211 on: August 09, 2021, 10:45:35 pm »
Just copy the file and unzip it.  It will prompt you for a binary input file and a CSV output file. 

Output will be freq(Hz), real,img,real,img


2360000000.000000,0.454178,0.164357,-0.000022,-0.000037
2360050000.000000,0.454497,0.164947,0.000059,-0.000095

****
Moved to Github
« Last Edit: August 10, 2021, 01:24:13 am by joeqsmith »
 
The following users thanked this post: ALW

Offline ALW

  • Contributor
  • Posts: 33
  • Country: fr
Re: NanoVNA Custom Software
« Reply #1212 on: August 09, 2021, 10:56:20 pm »
Wow. I am speechless. I owe you a case of good beer or a good bottle of Bordeau, your choice! Thank you so much. Will try to make that happen with my next trip to the US!
You saved me a day of programming, min...
Tomorrow I will use your translator. Cheers
 

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11758
  • Country: us
Re: NanoVNA Custom Software
« Reply #1213 on: August 09, 2021, 11:07:17 pm »
 :-DD  If I showed you the software in LabView, you would laugh.  This was maybe 10 minutes of work, really!   Of course, it also looks like a 10 minute program.  Let me know how it works out.   

Offline ALW

  • Contributor
  • Posts: 33
  • Country: fr
Re: NanoVNA Custom Software
« Reply #1214 on: August 09, 2021, 11:19:47 pm »
Doesn't matter how long it took you. I am using your software, and now you're even cooking extra dishes...
I tried it of course right away, with data where I recorded the radar echo from my body. Raw data already show some action in a certain frequency band which probably translates to a range distance. Now it is 1am here and I need to get some sleep. Thanks and I will keep you posted on my adventures...
 

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11758
  • Country: us
Re: NanoVNA Custom Software
« Reply #1215 on: August 10, 2021, 01:23:22 am »
Good to hear it may do what you need.   I have created a branch named Utilities and have included the EXE there as others may find it helpful.   I made a small change where it now just asks for the binary file and will use the same name for the output but with the CSV extension. 

***
Almost forgot, 

https://www.eevblog.com/forum/rf-microwave/fingernail-polish-and-rf-front-ends-do-they-mix/msg3079836/#msg3079836
« Last Edit: August 10, 2021, 01:35:06 am by joeqsmith »
 

Offline ALW

  • Contributor
  • Posts: 33
  • Country: fr
Re: NanoVNA Custom Software
« Reply #1216 on: August 10, 2021, 11:00:58 am »
Now with your tool removing any of my lame excuses the old brain is fuming with complex calculus...

A humble suggestion for the user interface of your SW if I may. I find it all super self explaining, except what was confusing to me was that there are two separate stimulus ranges/modes: the first one center/span, the second min/max. If you click on either of these titles or numbers, you activate that range. Only visible by the freq scale in the graphs, not where you click.
And when you load a calibration, it (reasonably) activates the min/max range that was active during that calibration, I find very cool, after I got it :o.
So if I may suggest to draw a frame around each of the two stim range value blocks and somehow indicate which one is currently active, would help dummies like myself. Took me a while to figure this out, I inadvertently switched stim freq range more than once. You wrote about it somewhere in the manual, but it is a bit hidden in the deep.
« Last Edit: August 10, 2021, 11:23:25 am by ALW »
 

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11758
  • Country: us
Re: NanoVNA Custom Software
« Reply #1217 on: August 10, 2021, 02:41:43 pm »
Wow, that looks like total ass.  I assume that is on your 10" Surface Pro.   If you don't change the settings
Quote
Select "High DPI scaling override" option "System (enhanced)"
, is is still mangled up like this? 

Quote
except what was confusing to me was that there are two separate stimulus ranges/modes: the first one center/span, the second min/max.
It's not that simple.  There is also CW and segmented sweeps.  For segmented, there is quasi log and linear.    In segmented, the Span will have a different purpose and the order that the data is entered will become very important.    In some cases the transmission graph will not reflect the current sweep range. 

I have no doubt that all of these settings can pose a huge problem for the random button pusher who just wants to try things without taking the time to learn how they work.  I fully understand that we are living in the age of expertise.   I doubt very much that adding a simple box around a few widgets will do anything to help and may even further confuse this group.   Not to mention, a change like this needs to be tested, documented and maintained.   

Quote
You wrote about it somewhere in the manual, but it is a bit hidden in the deep.
No doubt that manual is very sparse and non-professional.  Your dealing with a home project, not a commercial product.

Good book on the subject:
« Last Edit: August 10, 2021, 02:43:14 pm by joeqsmith »
 

Offline ALW

  • Contributor
  • Posts: 33
  • Country: fr
Re: NanoVNA Custom Software
« Reply #1218 on: August 27, 2021, 05:29:32 pm »
Joe, thanks a lot again. Got it to work. Using your software recording breathing and heartbeat with RADAR using a NanoVNA V2+4. I transmitted CW 2.4 GHz using my makeshift Vivaldi antenna at port 1, receiving the reflected wave (doppler effect for movement of my chest wall) with a simple stub at port 2. Calculated phase of S21 with atan2(i,r). Range was about 1 m.
Pics:
Setup

Unfiltered moving in, three breath, holding breath, three breath, moving out.

filtered with a 3 Hz lowpass, showing the heartbeat. Same data.
« Last Edit: August 27, 2021, 07:00:29 pm by ALW »
 
The following users thanked this post: joeqsmith, harrimansat, horo

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11758
  • Country: us
Re: NanoVNA Custom Software
« Reply #1219 on: August 27, 2021, 11:48:13 pm »
Thanks for the update.   It's maybe the most bizarre use of a VNA I have come across.

I am still curious about the poor front panel layout being tied to your scaling settings.  If you turn that off, does everything look lined up, buttons the same size, no over lap....     I suspect that it causes the OS to choose a different font which is causing the alignment problems.     

Offline ALW

  • Contributor
  • Posts: 33
  • Country: fr
Re: NanoVNA Custom Software
« Reply #1220 on: August 28, 2021, 10:51:41 am »
Hi Joe,
would you have an idea what the actual sampling rate is when recording raw CW data with the V2+4 and if it can be changed without going into the firmware?
Edit: I noticed that when I reduce in your SW / CW mode the "Points" to 20 the refresh of the SW gets very fast, when I reduce it further it does not accept any input anymore, seems too busy refreshing the graphs and numbers, need to kill it with task manager. I did not see any difference when I changed the "Sam/Dec" entry.

(As for my scrambled screenshot since I know most labels by heart now I do not need geezer glasses anymore and went back to the original un-garbled magnification)
My application is not so bizarre for a medical person, since it can measure vital parameters without touching the patient and from a distance through clothing and bedding. Medically extremely valuable...
Cheers
Albrecht
« Last Edit: August 28, 2021, 02:15:14 pm by ALW »
 

Offline harrimansat

  • Regular Contributor
  • *
  • Posts: 229
Re: NanoVNA Custom Software
« Reply #1221 on: August 28, 2021, 11:25:52 am »
Joe, thanks a lot again. Got it to work. Using your software recording breathing and heartbeat with RADAR using a NanoVNA V2+4. I transmitted CW 2.4 GHz using my makeshift Vivaldi antenna at port 1, receiving the reflected wave (doppler effect for movement of my chest wall) with a simple stub at port 2. Calculated phase of S21 with atan2(i,r). Range was about 1 m.
Pics:
Setup

Unfiltered moving in, three breath, holding breath, three breath, moving out.

filtered with a 3 Hz lowpass, showing the heartbeat. Same data.

There´s some firmware for plus with CW?
Can you please tell me wich?

Thanks
 

Offline ALW

  • Contributor
  • Posts: 33
  • Country: fr
Re: NanoVNA Custom Software
« Reply #1222 on: August 28, 2021, 11:29:01 am »
The V2+4 standard firmware can do CW. https://nanorfe.com/nanovna-v2-user-manual.html "Zero span". I am using stock FW 1.2 it came with. In Joe's SW you can simply select/enter a CW frequency, it will do CW and even record the raw data. Only thing I couldn't figure out so far is the sample rate and whether it can be manipulated with the number of point settings

Edit: FW version on display git-20210538-412578c
Even standalone you have an entry in the menu "stimulus" "CW FREQ"
« Last Edit: August 28, 2021, 11:37:58 am by ALW »
 

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11758
  • Country: us
Re: NanoVNA Custom Software
« Reply #1223 on: August 28, 2021, 04:02:11 pm »
I suspect it's the OS changing the fonts.  One of the problems when distributing LabView code is the various PCs may not have the same fonts loaded.  You would think it would include the required fonts when installing the software but I suspect some fonts are protected by license.   To work around it, it's best to use fonts that are the most common.

Your question about the sample rate isn't something I have looked into.  We know the time to pull down a 400 point data set requires one second.   So something in the order of 2.5mS (which would include switching between ports).  Acquiring less data points will reduce the update rate but I doubt it is linear.   I did try setting it to 25 points it seems to update around 65mSish.  While changing the number of samples may not effect the hardware sample rate, it will certainly increase the overall uncertainly.  Consider we are now spending more time dealing with the overhead to send the data. 

I suspect you are really wanting to know how fast the hardware samples.  Depending how the firmware was written, it may not be a constant.  The easiest thing may be to ask OWO.    Another option may be to look at the drive side of R301 and see how fast the receiver's input selection switch toggles.   

**
Wording
« Last Edit: August 28, 2021, 04:14:15 pm by joeqsmith »
 
The following users thanked this post: ALW

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11758
  • Country: us
Re: NanoVNA Custom Software
« Reply #1224 on: August 28, 2021, 05:23:42 pm »
For fun, we can attempt to measure it indirectly.  From the manual for the V2Plus4, we know it will be dependent on the frequency range. 

For starts, I have set the number of data points to 31, Center to 13MHz and a span of 1MHz.   Notice my software shows a sweep time of 208mS.   Now lets look at the output signal with my Signal Hound.  We can see the time between sweeps is 207mS.  But the actual time the VNA is sweeping is 45mS.   It appears like it is close to 689SPS.   We have lost about 75% of our data. 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf