¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io
Date

Saving .s1p, .s2p, and Screenshots Directly from the nanoVNA-H4

Ken Moorman
 

Several months ago, possibly last year even, there was some discussion here
about the nanoVNA-H4 as having built onto the boards either a jack that
would accept micro-SD cards or at least the circuit pads were present for
the installation of said jack if it had not actually been soldered on by the
manufacturer. I also remember that there was discussion about adding a
small clock crystal directly across two pins on, I believe, the SMT MCU.
This would allow the user to set the clock using a terminal program like
Putty. Firmware was also being written to support these two features, I
believe. I was too busy with other problems on my learning curve for
nanoVNA use that I didn't save any of the discussions then. I have a
hardware version 4.2 which has the micro-SD card jack already added and have
added a slot to the case for it. I have upgraded the firmware to Dislord's
latest version, v1.0.50, which has the menu item "SD CARD" on the Main Menu.
Tapping on that brings up the next menu with "SAVE S1P" and "SAVE S2P".
There was also something said, I thought, about saving screenshots on the
nanoVNA-H4 to the micro-SD card but I haven't seen a menu item for that yet.
I have not tried plugging in a card yet but when I tap on either of the save
commands nothing seems to happen and I get no error message. If anyone has
discovered how to use any of these functions including the clock I would
really like to learn what you know. And if all this is yet to be
implemented I would like to know that as well. Being able to save the s1p
and s2p files in the field would be a very nice feature, as well as being
able to retain screenshots. I have used my phone to take pictures of the
screen but saving them to the card would be great and wouldn't take any
effort.



Ken, NU4I


Re: Newcomer - Advice sought please -Edelay appeared and calibration awry

 

Roger,

My apologies for the late reply, delivering curry, toilet rolls and various biscuits around the country has kept me away from home.

Thank you very much, will look into this as I am now off for 12 days.

Very much appreciated.

Kev


Re: Pitfalls of measuring components with the NanoVNA #measurement

 

JMR,

You have a NanoVNA-H. Correct? Which version of firmware are you using for best results? I will try to make a comparison since I have -H and -H4 NanoVNAs.

Roger


Re: Pitfalls of measuring components with the NanoVNA #measurement

 

I can try the latest firmware to see if things are improved but can you post up a link and a version number to try?


Re: Pitfalls of measuring components with the NanoVNA #measurement

 

Hi Dislord, thanks for the reply.

I don't know if this is useful but I did briefly try several versions of newer firmware (including yours) on my nanoVNA-H and I found the performance wasn't as good when doing critical tests like this. I assumed something had been compromised for faster detection/sweep. So I've gone back to a very old version of firmware to get this level of performance.

I guess not many nanovna users will explore the limits of the instrument like this. I'm a career long user of VNAs and I do try and squeeze as much performance out of them as I can. I also can create custom L0-L3 and C0-C3 correction factors for some of my cal kits to really make them work well through several GHz.

I don't know what the detection bandwidth is in the version of firmware I'm using as it is fixed but I did try several newer firmware versions and I did try the lower RBW options and I still couldn't get the same performance. Only a handful of nanoVNA users will be as critical as me so I'm not sure how much this matters.


Re: Pitfalls of measuring components with the NanoVNA #measurement

 

Can you get last NanoVNA firmware and made measure vs small bandwidth setthing (30Hz ?)
This should reduce noise


Re: Pitfalls of measuring components with the NanoVNA #measurement

 

Here's the nanoVNA attempting the same test. This is a really nice (expensive!) PPI 1111 560pF cap in series with a 0.333R resistor and also just the PPI 560pF cap without any added resistance.
The nanoVNA gets the 0.333R ESR test spot on.

At first glance the lower trace showing the measurement of the 0.03R ESR of the 560pF cap looks really good but the noise on the trace will make a Q curve look very jagged. These results are worlds apart from the incompetent team who wrote the paper about capacitor ESR that Roger linked to a few posts ago.


Re: Pitfalls of measuring components with the NanoVNA #measurement

 

OK thanks. I've not studied the nanoVNA beyond the input to the ADC so I don't know how it does things in firmware.

To try and counter the research article that Roger linked to I dug out another PPI 1111 SMD cap. This one is 560pF and the datasheet shows a falling ESR from about 0.03R up at VHF.

I also measured a decent 1R 1% SMD resistor to 50MHz to try to prove it was 1R and flat to within 0.02R up to 50MHz. I then put three resistors in parallel and put this in series with the 560pF cap. The total ESR of the cap + resistor should therefore be just over 0.333R.

The plot below was taken with my Agilent VNA and it shows that this is the case. I also measured the 560pF cap on its own and it had a decent stab at measuring the ESR which should be about 0.03R at the top end according to the datasheet.

Modern VNAs are really amazing devices. I'm not sure I trust the ESR reading of the raw 560pF cap as this really is stretching the limits of the VNA. However, to get this level of performance the whole test fixture and the cal kit are very important as is the experience of the operator.


Re: Pitfalls of measuring components with the NanoVNA #measurement

 

On 3/23/21 7:48 PM, Roger Need via groups.io wrote:
On Tue, Mar 23, 2021 at 07:24 PM, jmr wrote:

I've not actually looked inside my nanovna but a quick glance at the online
schematic shows a classic resistive bridge. When you connect a test circuit to
the CH0 input the bridge in the nanoVNA should output a signal that measures
to have the magnitude of the reflection coefficient. It will also have the
phase of the reflection coefficient. The LO + NE612 mixer converts this down
to 5kHz where it can be sampled with an ADC and measured in relation to the
reference signal in terms of amplitude and phase. The reference is also mixed
down to 5kHz.

If the ADC after the NE612 mixer says the 5kHz signal is shrunk to 99.9% of
the size of the 5kHz reference input then the reflection coefficient is 0.999.
If the 5kHz signal has a phase of -112degrees with respect to the 5kHz
reference then the angle of the reflection coefficient will be -112degrees.

That's the way I assume the system works. I don't see why you and Jim think
the bridge generates I and Q signals. What am I missing here?
JMR,

Please read carefully what I wrote. I did not say the "bridge generates I and Q signals". But it is not as simple as you say. Here is edy555 commenting on the original design. How is it done now? I don't know...

/g/nanovna-users/files/Miscellaneous/NanoVNA%20design%20notes%20by%20edy555/Calculate%20reflection%20coefficient%20from%20NanoVNA%20signal%20and%20plot%20frequency%20characteristics.pdf

Rather than you or I speculating I hope someone here that knows the firmware details can comment.


The I/Q measurement is done in dsp.c, in routine dsp_process() which takes 48 raw samples in *capture and turns it into two I/Q pairs.

*capture is 32 bits, the low order 16 bits are the reference, the high order bits are the measurement.

The actual calculation takes the two 16 bit numbers (input and either sin or cos) multiplies them, then divides by 16? and adds it to an accumulator. I assume the divide by 16 is to make sure that the sum doesn't overflow when summing 48 copies.? The sin and cos table is pretty close to full scale (32698, full scale would be 32767), so I assume the gain in front of the adc (or the signal levels) so that the divide by 16 and sum over 48 keeps it from overflowing.


Re: Pitfalls of measuring components with the NanoVNA #measurement

 

On 3/23/21 7:24 PM, jmr via groups.io wrote:
On Wed, Mar 24, 2021 at 12:39 AM, Roger Need wrote:
I did some research today on how the NanoVNA calculates the reflection
coefficient, Gamma, from the digitized bridge signals. There is very little
information on this available and the firmware source code does not have a
flowchart or text description.

Roger
I've not actually looked inside my nanovna but a quick glance at the online schematic shows a classic resistive bridge. When you connect a test circuit to the CH0 input the bridge in the nanoVNA should output a signal that measures to have the magnitude of the reflection coefficient. It will also have the phase of the reflection coefficient. The LO + NE612 mixer converts this down to 5kHz where it can be sampled with an ADC and measured in relation to the reference signal in terms of amplitude and phase. The reference is also mixed down to 5kHz.

If the ADC after the NE612 mixer says the 5kHz signal is shrunk to 99.9% of the size of the 5kHz reference input then the reflection coefficient is 0.999.
If the 5kHz signal has a phase of -112degrees with respect to the 5kHz reference then the angle of the reflection coefficient will be -112degrees.

That's the way I assume the system works. I don't see why you and Jim think the bridge generates I and Q signals. What am I missing here?
The bridge doesn't.? It generates a 5kHz signal which is digitized. Then, in the software that's mixed with a 5 kHz sin and cos, and then averaged over 48 points? to make an I and Q value.

static const int16_t sincos_tbl[48][2] = {
? { 10533,? 31029 }, { 27246,? 18205 }, { 32698,? -2143 }, { 24636, -21605 },
? {? 6393, -32138 }, {-14493, -29389 }, {-29389, -14493 }, {-32138,?? 6393 },
? {-21605,? 24636 }, { -2143,? 32698 }, { 18205,? 27246 }, { 31029,? 10533 },
? { 31029, -10533 }, { 18205, -27246 }, { -2143, -32698 }, {-21605, -24636 },
? {-32138,? -6393 }, {-29389,? 14493 }, {-14493,? 29389 }, { 6393,? 32138 },
? { 24636,? 21605 }, { 32698,?? 2143 }, { 27246, -18205 }, { 10533, -31029 },
? {-10533, -31029 }, {-27246, -18205 }, {-32698,?? 2143 }, {-24636,? 21605 },
? { -6393,? 32138 }, { 14493,? 29389 }, { 29389,? 14493 }, { 32138,? -6393 },
? { 21605, -24636 }, { 2143,? -32698 }, {-18205, -27246 }, {-31029, -10533 },
? {-31029,? 10533 }, {-18205,? 27246 }, {? 2143,? 32698 }, { 21605,? 24636 },
? { 32138,?? 6393 }, { 29389, -14493 }, { 14493, -29389 }, { -6393, -32138 },
? {-24636, -21605 }, {-32698,? -2143 }, {-27246,? 18205 }, {-10533,? 31029 }
};


Re: Pitfalls of measuring components with the NanoVNA #measurement

 

On 3/23/21 5:39 PM, Roger Need via groups.io wrote:
On Tue, Mar 23, 2021 at 06:15 AM, Jim Lux wrote:


You should really be looking at the I/Q uncertainty (R and X) rather
than mag and phase.? The VNA directly measures I and Q, which is then
converted to reflection coefficient with sqrt and atan.? For "small"
random uncertainties in I/Q on a vector, the uncertainty in magnitude
and angle (in radians) are comparable. This is comparable to the "small
angle approximation for sin(x) = x. Think of a vector with a "cloud" of
measurement points around the tip of the vector - the noise on I and the
noise on Q are comparable, and as long as noise is "small" compared to
magnitude, that cloud is pretty symmetrical in shape.

Jim,,

I did some research today on how the NanoVNA calculates the reflection coefficient, Gamma, from the digitized bridge signals. There is very little information on this available and the firmware source code does not have a flowchart or text description. The best I could find was edy555 notes where he said he first calculates the magnitude and phase of the reflection coefficient in polar form (magnitude and phase) . From there the real and imaginary form of gamma, impedance and SWR etc. is easily calculated. If anyone has specific information on the steps done in the nanoVNA I would be interested to hear about it.
The basic instrument calculates I/Q (dsp.c, dsp_process()) from the input samples, with the usual multiply by sin/cos. acc_samp_s and _c, and acc_ref_s and _c.


It then calculates gamma by dividing by the reference (dsp.c, calculate_gamma())

? float rs = acc_ref_s;
? float rc = acc_ref_c;
? float rr = rs * rs + rc * rc;
? //rr = sqrtf(rr) * 1e8;
? float ss = acc_samp_s;
? float sc = acc_samp_c;
? gamma[0] =? (sc * rc + ss * rs) / rr;
? gamma[1] =? (ss * rc - sc * rs) / rr;

that's the usual (a+bj)/(c+dj)? identity -> (a+bj) * (c-dj)/[(c+dj)(c-dj)]

that's gamma as a complex number.

sweep() in main.c actually does the measurements for the frequencies, and applies the calibrations.? It calls *sample_func, which is defined on line 610:

static void (*sample_func)(float *gamma) = calculate_gamma;



The conversion to phase is done in plot.c - look for the function phase()

in main.c, the trace type is set to TRC_PHASE in cmd_trace(), and that sets it up

so when trace_into_index() in plot.c is called,

??? v = refpos - phase(coeff[i]) * scale;

which turns the phase into a the plot value.


If you're looking to turn gamma (reflection coefficient) into impedance, that's done in plot.c, also in gamma2imp()

? float z0 = 50;
? float d = z0 / ((1-coeff[0])*(1-coeff[0])+coeff[1]*coeff[1]);
? float zr = ((1+coeff[0])*(1-coeff[0]) - coeff[1]*coeff[1]) * d;
? float zi = 2*coeff[1] * d;

similarly for displaying phase, trace_get_value_string() turns the value (coeff[2]) into a string.
? case TRC_PHASE:
??? v = phase(coeff[i]);
??? chsnprintf(buf, len, "%.3f" S_DEGREE, v);
??? break;

So, in summary, the NanoVNA measures things in cartesian coordinates, and only converts to polar for display or plotting.



My analysis program does have the Gamma I and Q output capability so here is the output based on a 470 pF capacitor at 3.4 MHz. with a reactance of 100 ohms. You can see that a .03 to .04% error in I or Q measurement results in a calculated Q error of 100 for this example. If the Q to be measured is higher even less IQ error can be tolerated. For example with a reactance of 20 ohms and a Q of 1000 the ESR is .02 ohms and a .007% in I or Q measurement results in a Q error of 50.

Chasing High Q on the NanoVNA seems pointless....

Roger




Re: Pitfalls of measuring components with the NanoVNA #measurement

 

On Tue, Mar 23, 2021 at 07:24 PM, jmr wrote:

I've not actually looked inside my nanovna but a quick glance at the online
schematic shows a classic resistive bridge. When you connect a test circuit to
the CH0 input the bridge in the nanoVNA should output a signal that measures
to have the magnitude of the reflection coefficient. It will also have the
phase of the reflection coefficient. The LO + NE612 mixer converts this down
to 5kHz where it can be sampled with an ADC and measured in relation to the
reference signal in terms of amplitude and phase. The reference is also mixed
down to 5kHz.

If the ADC after the NE612 mixer says the 5kHz signal is shrunk to 99.9% of
the size of the 5kHz reference input then the reflection coefficient is 0.999.
If the 5kHz signal has a phase of -112degrees with respect to the 5kHz
reference then the angle of the reflection coefficient will be -112degrees.

That's the way I assume the system works. I don't see why you and Jim think
the bridge generates I and Q signals. What am I missing here?
JMR,

Please read carefully what I wrote. I did not say the "bridge generates I and Q signals". But it is not as simple as you say. Here is edy555 commenting on the original design. How is it done now? I don't know...

/g/nanovna-users/files/Miscellaneous/NanoVNA%20design%20notes%20by%20edy555/Calculate%20reflection%20coefficient%20from%20NanoVNA%20signal%20and%20plot%20frequency%20characteristics.pdf

Rather than you or I speculating I hope someone here that knows the firmware details can comment.

Roger


Re: Pitfalls of measuring components with the NanoVNA #measurement

 

On Wed, Mar 24, 2021 at 12:39 AM, Roger Need wrote:
I did some research today on how the NanoVNA calculates the reflection
coefficient, Gamma, from the digitized bridge signals. There is very little
information on this available and the firmware source code does not have a
flowchart or text description.

Roger
I've not actually looked inside my nanovna but a quick glance at the online schematic shows a classic resistive bridge. When you connect a test circuit to the CH0 input the bridge in the nanoVNA should output a signal that measures to have the magnitude of the reflection coefficient. It will also have the phase of the reflection coefficient. The LO + NE612 mixer converts this down to 5kHz where it can be sampled with an ADC and measured in relation to the reference signal in terms of amplitude and phase. The reference is also mixed down to 5kHz.

If the ADC after the NE612 mixer says the 5kHz signal is shrunk to 99.9% of the size of the 5kHz reference input then the reflection coefficient is 0.999.
If the 5kHz signal has a phase of -112degrees with respect to the 5kHz reference then the angle of the reflection coefficient will be -112degrees.

That's the way I assume the system works. I don't see why you and Jim think the bridge generates I and Q signals. What am I missing here?


Re: Pitfalls of measuring components with the NanoVNA #measurement

 

If anyone does read the paper linked to by Roger the test setup for s11 in that paper is shown in figure 4 and it is awful with bits of wobbly copper tape and a metal bar making up the short and the open. They claim they try and correct for it using equations based on a crude circuit model for their unsuitable test jig. I don't think they know what they are doing. It appears that they don't actually realise that their de-embedding won't account for the uncontrolled nature of the short and open system they are using. The damage (to the measurement uncertainty of mag r of the test cap) will already have been done during the SOL calibration. You can get away with a crude system like that if you just want to measure the capacitance of the component but if you want to measure both the magnitude and angle of the reflection coefficient of the capacitor you need to have extremely well defined open and short circuit connections.

To make the measurements I'm making I use a GHz rated text fixture where the fixture/cal Zo is very well controlled right up until it hits the open or the short discontinuity at the end of the cal kit. I'm using a cal kit where I should have the offset delays for OPEN and SHORT corrected to (hopefully) less than 1ps. I'm using a precision 50 ohm load for the cal kit. This might seem over the top but the offset delays for the cal kit need to be known quite accurately or errors can creep in for critical measurements like this.

It appears that they are measuring just under 0.2R ESR for the 1nF cap across VHF using s11 That is a Q in the ballpark of just 20! They get 0.05R ESR using another method. I'm not surprised they are getting strange results with s11 (like a Q of 20) because their test setup is an uncertain mess.


Re: Pitfalls of measuring components with the NanoVNA #measurement

 

An interesting paper "Measuring Capacitor Parameters Using Vector Network Analyzers" by Stepins, Asmanis, and Asmanis might be of interest to members of this group. The three common methods of measuring components using S11 refection, S21 shunt and S21 series are discussed. It can be downloaded here....



They conclude the following:

"The most problematic parameter to measure accurately with VNA is capacitor ESR. Only shunt-through technique should be used for accurate ESR measurements. However there are some limitations. ESR can accurately be measured only at f(res) and in vicinity of it (ESR measurement error below 3% can be
achieved). For frequencies which are much higher or lower than f(res) the measurement accuracy can be very poor, even using shunt-through technique, because when capacitor reactance is much higher than its ESR, then the measurement error can increase enormously. Accurate measurements of ESR of capacitors with C lower than several tens of nF are impossible. ESR measurements of small-capacitance capacitors using VNA is completely useless."

Roger


Re: Pitfalls of measuring components with the NanoVNA #measurement

 

On Tue, Mar 23, 2021 at 06:15 AM, Jim Lux wrote:


You should really be looking at the I/Q uncertainty (R and X) rather
than mag and phase.? The VNA directly measures I and Q, which is then
converted to reflection coefficient with sqrt and atan.? For "small"
random uncertainties in I/Q on a vector, the uncertainty in magnitude
and angle (in radians) are comparable. This is comparable to the "small
angle approximation for sin(x) = x. Think of a vector with a "cloud" of
measurement points around the tip of the vector - the noise on I and the
noise on Q are comparable, and as long as noise is "small" compared to
magnitude, that cloud is pretty symmetrical in shape.

Jim,,

I did some research today on how the NanoVNA calculates the reflection coefficient, Gamma, from the digitized bridge signals. There is very little information on this available and the firmware source code does not have a flowchart or text description. The best I could find was edy555 notes where he said he first calculates the magnitude and phase of the reflection coefficient in polar form (magnitude and phase) . From there the real and imaginary form of gamma, impedance and SWR etc. is easily calculated. If anyone has specific information on the steps done in the nanoVNA I would be interested to hear about it.

My analysis program does have the Gamma I and Q output capability so here is the output based on a 470 pF capacitor at 3.4 MHz. with a reactance of 100 ohms. You can see that a .03 to .04% error in I or Q measurement results in a calculated Q error of 100 for this example. If the Q to be measured is higher even less IQ error can be tolerated. For example with a reactance of 20 ohms and a Q of 1000 the ESR is .02 ohms and a .007% in I or Q measurement results in a Q error of 50.

Chasing High Q on the NanoVNA seems pointless....

Roger


Re: NanoVNA measurement of an EFHW Transformer

 

Jeff
I have been using the ancient bridges for years and still use them for the high Z's. Yes! All of these ancient bridges had to go thru an initial balance for each freq. Not to mention you needed an RF source and a null meter. No swept measurement for sure.
73


Re: Pitfalls of measuring components with the NanoVNA #measurement

 

Sorry, I made a slight goof with the last plot as the trace for the poly 470pF cap was from the wrong S1p file. To make the traces overlay correctly I have to make sure that both VNAs have the same start and stop frequencies and both have 101 points and the same applies for the simulator that plots the results. Otherwise the graphing engine creates interpolation errors and the trace will look incorrect. I've corrected this for the poly 470pF cap trace. As a bonus see the yellowish trace in the plot below. This is probably the highest Q cap I can find at about 470pF. It is a pair of 1111 series 820pF ceramic caps in series to make up a 410pF cap with very high Q. In terms of highest Q across the HF bands (for approx 400-470pF) it does seem to be the daddy at the moment...

Obviously, I had to measure this with the Agilent VNA and I'm not sure how realistic this result is for the 820pF in series with 820pF. I would definitely treat this impressive Q result as 'educational' rather than accurate!


Re: Pitfalls of measuring components with the NanoVNA #measurement

 

To make things harder for the nanoVNA I pulled a couple of 220pF ceramic disk caps from an old Cobra 148GTL-DX CB radio that was probably made in 1981. I put them in parallel to make up 440pF.

These caps should have a higher Q than the previous Philips 470pF poly capacitor. See below for a comparison between the Agilent VNA and the nanoVNA. You can see that the nanoVNA is really struggling and (as expected) the data gets really noisy at 10MHz where the Q is just over 1000. This is a 'very' harsh test for both VNAs and also the cal kit and the test fixture but you can see that the pair of 220pF caps in parallel have a much improved Q compared to the poly 470pF cap.

I think it would be better to measure the Q a different way because I think there will be a fair bit of measurement uncertainty creeping in to the system when measuring higher Q capacitors like this but at least the Agilent VNA and the nanoVNA are performing roughly as expected across 5MHz to 50MHz for this type of capacitor.


Re: Pitfalls of measuring components with the NanoVNA #measurement

 

Isee, it is complex but can be accurate.

But as I understand it you really have to relate the thermal losses to the real power loss, reactive power does not produce heath.

Regards,

Ignacio EB4APL

El 23/03/2021 a las 18:56, Manfred Mornhinweg escribi¨®:
It looks like measuring the Q of high quality capacitors could be very
difficult, even at single frequencies.
Well, there is always the thermal method: Put the capacitor under test in a resonant circuit, thermally disconnected from the coil, excite it to a high amplitude, and measure the temperature rise of the capacitor. Several methods can be used to calculate the loss from temperature rise, or putting the capacitor in a thermal enclosure together with some more thermal mass, and measure the rate of temperature rise, and so on. Once the power loss has been computed, it's simple to relate it to the reactive power in the capacitor, and calculate Q or dissipation factor from that.

But it's a rather complex and slow method, to get the Q at just a single frequency.

--
El software de antivirus Avast ha analizado este correo electr¨®nico en busca de virus.