Author Topic: Low frequencies Vector Network Analyzer, arduino based.  (Read 15514 times)

0 Members and 1 Guest are viewing this topic.

Online Kleinstein

  • Super Contributor
  • ***
  • Posts: 14158
  • Country: de
Re: Low frequencies Vector Network Analyzer, arduino based.
« Reply #75 on: September 26, 2018, 07:16:04 pm »
If windowing is used, it would not make a big difference, if at all. This is a step on the raw data, essentially before starting with FFT or Görtzel or DFT.

I don't think one will need 64 bit math to use the Görtzel algorithm or DFT. 32 Bit math should be plenty for 2048 points, though the FFT might get away with 16 bit math (and may have to use it because of memory limitations).

Besides speed the FFT has the disadvantage that it is essentially limited to certain window lengths (usually 1024, 2048, maybe 4096, maybe 768, 1536 in theory), and needs space so have all the data (may need even 2 sets) and the results in memory.
Speed wise the critical limit is if real time calculation is possible - that is do the calculation at the speed the data come in. So how fast is the FFT solution ?

Even if not optimum speed, the idea of using a µC and little extra HW for a low end slow VNA is nice.
 

Offline ogden

  • Super Contributor
  • ***
  • Posts: 3731
  • Country: lv
Re: Low frequencies Vector Network Analyzer, arduino based.
« Reply #76 on: September 26, 2018, 07:37:18 pm »
I don't think one will need 64 bit math to use the Görtzel algorithm or DFT.

Obviously 32bit precision is enough to measure. SNR estimation test was distraction BS move anyway. Even OP test shows insignificant difference of magnitude (not SNR) between 32bit (float) precision Görtzel vs FFT: 2620.176270 vs 2620.160156

Quote
Besides speed the FFT has the disadvantage that it is essentially limited to certain window lengths (usually 1024, 2048, maybe 4096, maybe 768, 1536 in theory), and needs space so have all the data (may need even 2 sets) and the results in memory.

In half of that memory I better hold precalculated sine lookup table for DFT
 

Offline radioactive

  • Regular Contributor
  • *
  • Posts: 173
  • Country: us
Re: Low frequencies Vector Network Analyzer, arduino based.
« Reply #77 on: September 26, 2018, 08:17:35 pm »

I didn't omit the windowing function, you did. 


I'm referring to your first post, where you comparing fftw vs goertzel:
https://www.eevblog.com/forum/projects/low-frequencies-vector-network-analyzer-arduino-based/msg1844921/#msg1844921

Why you didn't apply windowing, as you should?  Than, would be a huge difference in the two charts, would not it?

And you are ignoring the fact, that Goertzel is meaningless w/o 64-bits architecture.

I've re-run my original test (little larger sweep to make it visually symmetrical) with N=2048 and now we are back to using the libfftw library version of fft.   

compile with      gcc goertzel_test.c -o goertzel_test -lm -lc -lfftw3

This is also 32-bit floats.  I've added a blackman-harris window to compare against the rectangular window  (no window).   The trade-off for the various windows is usually between finer frequency resolution (rectangular) with less suppression of the side lobes or something like blackman-harris which does a pretty good job of suppressing the side lobes, but gives you less frequency resolution.   There is also one called flat-top window that maintains better amplitude accuracy (less scalloping loss).  So really depends on what you are measuring.

 
The following users thanked this post: ogden

Offline MasterTTopic starter

  • Frequent Contributor
  • **
  • Posts: 785
  • Country: ca
Re: Low frequencies Vector Network Analyzer, arduino based.
« Reply #78 on: September 27, 2018, 12:54:55 pm »
If windowing is used, it would not make a big difference, if at all. This is a step on the raw data, essentially before starting with FFT or Görtzel or DFT.
It would not, I already tested this, both Goertzel & FFT react in similar manner for introducing windowing. The main question, is do I need a windowing?
 Thinking about it for awhile,  I came to concept of "perspective", a view angle. If I put a phase error, as it is written in the first few lines of the original message, 0.01 degree as a starting point, than all other parameters lined up.

1.   SNR:  0.01 degree imply -> ~80 dB

2.   BW:   Next, is the bandwidth. Since, this is a "measuring" device I'm trying to build, not a dummy dtmf detector, BW has to be defined differently compare to common definition Peak/ sqrt(2).  BW in this perspective is the main peak width At -80 dB.

3.  And this 80 dB SNR, consequently, says that windowing is a Must, and suppression of the side lobes > 80 .

4. "Measuring device" means that it has some dynamic range, so my phase error (0.01) stays below this line even magnitude at the ADC input drops significantly. I do not have PGA at this point, and probably don't want to have, as it would be another "stepped line" cause of errors.  So defining dynamic range at least 40 dB, or better 60 , I have 80 + (40-60) = 120 - 140 dB.

5. Based on this value, now I'm sure Goertzel is must be 64-bits. In my SNR example, where sng_grt shows 67 dB, plus 40 -test was done at 40 dBc, Goertzel noise floor is 107 dB (if 32-bits math used ) and it's way too low for 120-140.

6. I'd test Goertzel-64 on arduino DUE see if it faster than fft-32, could be. Could be I'm underestimating it's performance. 
 

Offline ogden

  • Super Contributor
  • ***
  • Posts: 3731
  • Country: lv
Re: Low frequencies Vector Network Analyzer, arduino based.
« Reply #79 on: September 27, 2018, 01:24:22 pm »
If I put a phase error, as it is written in the first few lines of the original message, 0.01 degree as a starting point, than all other parameters lined up.

Right. Let's beat 200k$ worth N5247B which have miserable 0.02 degrees RMS specified.
 

Online Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11612
  • Country: my
  • reassessing directives...
Re: Low frequencies Vector Network Analyzer, arduino based.
« Reply #80 on: September 27, 2018, 02:01:27 pm »
If windowing is used, it would not make a big difference, if at all. This is a step on the raw data, essentially before starting with FFT or Görtzel or DFT.
It would not, I already tested this, both Goertzel & FFT react in similar manner for introducing windowing. The main question, is do I need a windowing?
 Thinking about it for awhile,  I came to concept of "perspective", a view angle.
the purpose of windowing is to reduce leakage in fft result adjacent to/when there is significant frequency component not residing in fft bin. and its a separate (pre) process to dft (fft or goertzel or whatever derivatives) with complexity O(n) and can be easily incorporated real time, once the original data is windowed, its gone, processing/calculation will be made based on the windowed signal. you can get by without windowing if your big mama frequency is residing in one of your fft bin, but if you want to see significant effect of it, try evaluating odd frequency like eg if your bin is ... 244, 488, ... etc, try giving the fft function a pure 366Hz sine signal (in the middle between 2 bins) with 0 or minimal or clean phase noise and look at the fft result, with or without windowing function. but you should know this already i may just rephasing this for anyone who will come across this thread in the future. fwiw...

https://www.edn.com/electronics-news/4383713/Windowing-Functions-Improve-FFT-Results-Part-I
https://en.wikipedia.org/wiki/Window_function
https://community.plm.automation.siemens.com/t5/Testing-Knowledge-Base/Windows-and-Spectral-Leakage/ta-p/432760
https://en.wikipedia.org/wiki/Spectral_leakage
« Last Edit: September 27, 2018, 02:22:04 pm by Mechatrommer »
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 

Offline Bud

  • Super Contributor
  • ***
  • Posts: 6903
  • Country: ca
Re: Low frequencies Vector Network Analyzer, arduino based.
« Reply #81 on: September 27, 2018, 02:24:58 pm »
OP no offence but you've been delusional about your device performance. Not sure why you not answering questions about calibration, so i have to assume you do not know what it is. If that is the case you have a lot to learn and a long way to go before this contraption can be called a VNA.
Facebook-free life and Rigol-free shack.
 

Online Kleinstein

  • Super Contributor
  • ***
  • Posts: 14158
  • Country: de
Re: Low frequencies Vector Network Analyzer, arduino based.
« Reply #82 on: September 27, 2018, 03:45:58 pm »
Much of an VNA is in the software to do the calibration and to compensate for parasitic couplings that ideally should not be there. So this is a really important point. As shown the HW looks more like a limited range, low frequency impedance analyzer. Even there is usually takes corrections / adjustments with something like an open circuit and short.

For the SNR / phase noise estimates, it looks like these are at maximum amplitude. However a real signal is rarely at the maximum amplitude and there are other sources of trouble than white ADC noise. One such problem is that the rather slow amplifiers might reach the slew rate / power bandwidth limit.  There are also such nasty effects like self heating and temperature dependent phase shifts. The corrections needed also tend to increase the noise by something like a factor of 2 as it involves a 2nd or 3 rd measurement.

Comparing to much higher frequency instruments is kind of misleading - they have different problems and a different setup. So in some aspects even a simple low frequency setup can be better than an expensive microwave instrument - these usually don't even offer measurements below a certain limit (e.g. 10 KHz).
 

Offline MasterTTopic starter

  • Frequent Contributor
  • **
  • Posts: 785
  • Country: ca
Re: Low frequencies Vector Network Analyzer, arduino based.
« Reply #83 on: September 27, 2018, 04:21:58 pm »
OP no offence but you've been delusional about your device performance. Not sure why you not answering questions about calibration, so i have to assume you do not know what it is. If that is the case you have a lot to learn and a long way to go before this contraption can be called a VNA.
I do know about calibration, but really don't care. It's still "work in progress", calibration is only applicable to completed device. Above I set a line at >120 dB, and thinking again I may never get there w/o PGA, as 12-bits adc may not be enough. ADC is only 72 dB and needs about 50 to get a score. Initially  I was counting to get 30 via dsp-core (processing gain), and it seems I needs 20 dB more.

For the SNR / phase noise estimates, it looks like these are at maximum amplitude. However a real signal is rarely at the maximum amplitude and there are other sources of trouble than white ADC noise. One such problem is that the rather slow amplifiers might reach the slew rate / power bandwidth limit. 
Correct, I observed that mcp6s91 start to lag at 1 MHZ, even DS says GBW=18 MHz.  What is more problematic, that phase offset  depends on the magnitude, showing non-linearity, that I can't remedy nether in software not via calibration.
 

Online Kleinstein

  • Super Contributor
  • ***
  • Posts: 14158
  • Country: de
Re: Low frequencies Vector Network Analyzer, arduino based.
« Reply #84 on: September 27, 2018, 08:17:43 pm »
For the  MCP6S91 the power BW is relatively small. At 1 MHz the amplitude limit is at around 1 V_pp at G=1.  So this PGA is a rather bad choice if only gain 1 or 2 is used. (see Figure 2-24 in the DS).

 

Offline MasterTTopic starter

  • Frequent Contributor
  • **
  • Posts: 785
  • Country: ca
Re: Low frequencies Vector Network Analyzer, arduino based.
« Reply #85 on: September 28, 2018, 11:55:30 am »
... you can get by without windowing if your big mama frequency is residing in one of your fft bin,
Not so easy.  If there is only one "mama frequency" - I already done that, run DDS in the multiples of the ADC clock  - windowing is not required.  The problem is that there could be more than one signal at the input, DDS and interference. I can adjust my ADC clock as well, to suppress lets say 50/60 Hz, same as they do for 18-24 bits SD ADC - using 4.9152 MHz crystals, but it would works for this specific 50/60 Hz frequency. TFT display interference and digital noise from arduino itself very likely can't be rejected simultaneously, it's asking for windowing function. I see, that a lot depends on SNR ratio, DDS / Interference, and dynamic range I want to reach.


Besides speed the FFT has the disadvantage that it is essentially limited to certain window lengths (usually 1024, 2048, maybe 4096, maybe 768, 1536 in theory), and needs space so have all the data (may need even 2 sets) and the results in memory.

 I read a few times, that fft needs to store samples, and goertzel like may work on "the fly". So memory requirements for goertzel may be much smaller.
Not is this project. Sampling at 1 MSPS, (and using DMA to get this high sampling rate) is making operation (to store data before processing) not  optional.
« Last Edit: September 28, 2018, 01:17:32 pm by MasterT »
 

Online Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11612
  • Country: my
  • reassessing directives...
Re: Low frequencies Vector Network Analyzer, arduino based.
« Reply #86 on: September 28, 2018, 02:30:38 pm »
I see, that a lot depends on SNR ratio, DDS / Interference, and dynamic range I want to reach.
"we" (someone else already posted and asked this) are not sure why noises, interferences, dynamic range, SNR are your main concern. when your main interest should be on the fundamental frequency, thats why all posters suggested single-bin application to you. SNR or dynamic range concern should be in spectrum analysis, signal purity/distortion out of a DUT such as signal/function generator design application, which is not what you are doing here (impedance analyzer). further, since you have internal signal generator, you should be able to specify that as calibration data and subtract from your output, ymmv.
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 

Offline MasterTTopic starter

  • Frequent Contributor
  • **
  • Posts: 785
  • Country: ca
Re: Low frequencies Vector Network Analyzer, arduino based.
« Reply #87 on: September 28, 2018, 09:45:21 pm »
"we" (someone else already posted and asked this) are not sure why noises, interferences, dynamic range, SNR are your main concern. when your main interest should be on the fundamental frequency, thats why all posters suggested single-bin application to you.
What I see, that nobody understand the difference between dumb DTMF detection, and 0.01 degree accuracy phase measurements. When you find out what is it about, than post your comments, please.
 

Online Kleinstein

  • Super Contributor
  • ***
  • Posts: 14158
  • Country: de
Re: Low frequencies Vector Network Analyzer, arduino based.
« Reply #88 on: September 28, 2018, 10:10:11 pm »
The noise is usually not the main problem, as one can reduce noise by spending a little more time on taking data. Here it helps if the calculations can be done real time, so that little time is lost.

The more difficult parts are usually to get parasitic phase shifts and unwanted signal paths small or at least stable enough that they can be corrected. So here this is the amplifiers but also choice of signal paths (e.g. relays). A special problem can be switchable gain, as the dynamic range of the 12 bit ADC is not that large. Nonlinear effects can also cause funny effects at the small scale. Quite often accuracy is not limited by noise, but by other non-ideal effects. So the SNR is not such an important factor - it is more important to the speed of a measurement, not the accuracy.

I think many of us understand the DFT quite well: There is no magic gain in SNR from the FFT compared to other DFT methods. It is just a different algorithm to give essentially the same result.  Depending on the situation it can be faster or slower - that is the main difference.

It is a little unfortunate that the DDS and ADC seem to use independent clocks. This is a possible source of hard to control errors due to variations in initial phase.
 

Offline ogden

  • Super Contributor
  • ***
  • Posts: 3731
  • Country: lv
Re: Low frequencies Vector Network Analyzer, arduino based.
« Reply #89 on: September 28, 2018, 11:48:51 pm »
It is a little unfortunate that the DDS and ADC seem to use independent clocks.

LOL. It's least problem of particular circuit.

I am puzzled about another question: how this so called VNA can measure any other property (like dissipation) of capacitor besides plain capacitance. Could you please explain this to me?
 

Offline Dave

  • Super Contributor
  • ***
  • Posts: 1352
  • Country: si
  • I like to measure things.
Re: Low frequencies Vector Network Analyzer, arduino based.
« Reply #90 on: September 29, 2018, 04:20:57 pm »
What I see, that nobody understand the difference between dumb DTMF detection, and 0.01 degree accuracy phase measurements. When you find out what is it about, than post your comments, please.
What I see, is a person that intentionally ignored the evidence that I provided, demonstrating that conventional DFT and FFT produce the exact same results. You ramble that you want evidence and when I put in the time to produce said evidence for you, you blatantly ignore it.
<fellbuendel> it's arduino, you're not supposed to know anything about what you're doing
<fellbuendel> if you knew, you wouldn't be using it
 

Offline MasterTTopic starter

  • Frequent Contributor
  • **
  • Posts: 785
  • Country: ca
Re: Low frequencies Vector Network Analyzer, arduino based.
« Reply #91 on: September 29, 2018, 07:59:04 pm »
What I see, is a person that intentionally ignored the evidence that I provided, demonstrating that conventional DFT and FFT produce the exact same results. You ramble that you want evidence and when I put in the time to produce said evidence for you, you blatantly ignore it.

I did replay, have you misread?

But we didn't study matlab in 90-s.
  It says, I'm proud to be completely illiterate  in matlab. No comprendo, sinor.
 In theory, there is no difference if algorithm is written for "float" "double" or "int64_t". But in practice there is, big pile of shit at the output.
 
 

Offline Dave

  • Super Contributor
  • ***
  • Posts: 1352
  • Country: si
  • I like to measure things.
Re: Low frequencies Vector Network Analyzer, arduino based.
« Reply #92 on: September 29, 2018, 09:11:43 pm »
Knowing any of the programming languages gives you enough background to at least try to understand matlab code. It's merely a manipulation of matrices and to top it all off, I added plenty of comments in there to make things clear.

Single-precision floating-point variables are more than good enough to produce accurate results. Heck, you could even do it with int32 variables if you did your homework and kept the variable lengths in check.
The claim that plenty of us already voiced still stands: Doing a full FFT for a single bin is a waste of resources and clock cycles.
<fellbuendel> it's arduino, you're not supposed to know anything about what you're doing
<fellbuendel> if you knew, you wouldn't be using it
 

Offline MasterTTopic starter

  • Frequent Contributor
  • **
  • Posts: 785
  • Country: ca
Re: Low frequencies Vector Network Analyzer, arduino based.
« Reply #93 on: September 29, 2018, 11:36:16 pm »
Knowing any of the programming languages gives you enough background to at least try to understand matlab code. It's merely a manipulation of matrices and to top it all off, I added plenty of comments in there to make things clear.

///

The claim that plenty of us already voiced still stands: Doing a full FFT for a single bin is a waste of resources and clock cycles.
Very accurate description, "manipulation", unfortunately, matlab does manipulation not only with the matrices.

I already verified Goertzel C code on 32-bits math, and it's failed on rounding noise.  Anyone could run original software with low frequencies to confirm this.

If under "resources" you mean memory, than when DMA involved algorithm is out of business, anyway samples directed to memory.

Last, but not least. Clock cycles.
I acknowledge, that I misunderstood performance of  the single bin (Goertzel) algorithm, provided by "radioactive".  My latest test shows that it runs >2 times faster on arduino Due (SAM3X8E) in similar with fft conditions.  I spend some time to re-write code into int64_t math, otherwise it would be much slower on uCPU w/o FPU. So, again a lot depends on implementation. It was mot obvious in the beginning that int64 version would be so fast,  trickery that compiler does can't be predicted by no-one.
 

Offline Dave

  • Super Contributor
  • ***
  • Posts: 1352
  • Country: si
  • I like to measure things.
Re: Low frequencies Vector Network Analyzer, arduino based.
« Reply #94 on: September 30, 2018, 01:00:19 am »
Very accurate description, "manipulation", unfortunately, matlab does manipulation not only with the matrices.
Not quite sure I catch your drift. How is it unfortunate that matlab can do more than calculations on matrices?
<fellbuendel> it's arduino, you're not supposed to know anything about what you're doing
<fellbuendel> if you knew, you wouldn't be using it
 

Offline MasterTTopic starter

  • Frequent Contributor
  • **
  • Posts: 785
  • Country: ca
Re: Low frequencies Vector Network Analyzer, arduino based.
« Reply #95 on: September 30, 2018, 10:12:23 am »
Not quite sure I catch your drift. How is it unfortunate that matlab can do more than calculations on matrices?
What I'm trying to say, matlab is a tool to manipulate the consciousness.  It can show any results, that someone want to show.
 Consequence of the "digital economic". In other words, it last things on a planet that I would trust. I'm better to believe in the "fft magic"
 Sametime, I do respect the right to "freedom of religion" others.
 

Offline Dave

  • Super Contributor
  • ***
  • Posts: 1352
  • Country: si
  • I like to measure things.
Re: Low frequencies Vector Network Analyzer, arduino based.
« Reply #96 on: September 30, 2018, 02:33:18 pm »
Matlab (or Scilab, Octave, R and Python's NumPy) are the de facto tools that engineers and data analysts use for numeric computation. The syntax is similar or the same in all of them - know one and you pretty much know all of them.
I posted my script, I'm not hiding anything. Anyone is free to dismantle my code and show me exactly where I'm wrong.
The fact that you're ignorant and refuse to adapt to new standards is not an excuse to accuse me of being shifty and presenting data to support a hidden agenda.

Congrats, you just earned yourself a spot on the ignore list.
<fellbuendel> it's arduino, you're not supposed to know anything about what you're doing
<fellbuendel> if you knew, you wouldn't be using it
 
The following users thanked this post: ogden

Offline MasterTTopic starter

  • Frequent Contributor
  • **
  • Posts: 785
  • Country: ca
Re: Low frequencies Vector Network Analyzer, arduino based.
« Reply #97 on: September 30, 2018, 02:57:20 pm »
Congrats, you just earned yourself a spot on the ignore list.
Thanks, will do same thing. I'm not gonna to study matlab, ( or cantonese, if someone provided his tests results). Project is in plain C (and arduino) languages, so you are talking on same wave or moving on.
 

Offline Bud

  • Super Contributor
  • ***
  • Posts: 6903
  • Country: ca
Re: Low frequencies Vector Network Analyzer, arduino based.
« Reply #98 on: October 18, 2018, 11:13:10 pm »
"we" (someone else already posted and asked this) are not sure why noises, interferences, dynamic range, SNR are your main concern. when your main interest should be on the fundamental frequency, thats why all posters suggested single-bin application to you.
What I see, that nobody understand the difference between dumb DTMF detection, and 0.01 degree accuracy phase measurements. When you find out what is it about, than post your comments, please.

Yes here is my comment. Indications are you are confusing accuracy with resolution. No wonder, since this is a common mistake. Accuracy is a measure  of how close the measurement is to the correct value. In absence of calibration you accuracy can be off 2 orders of magnitude, i.e. non-existstant. Beside the phase (you claim 0.01 degree) will be invalid because the device errors not being accounted for, it will depend on the length of the cables connecting the DUT to the device. The claimed 0.01 degree are meaningless. It is just how granular your invalid measurements are going to be. And once you will get to implementing calibration you will find out (if dilligent enough) that achieving just 1/10 of that claim (0.1 degree phase accuracy) is very hard. Let alone no calibration model exists for such device architecture so you will have much fun developing one and proving it is valid. This is why i said you have a long way to go.
 
Facebook-free life and Rigol-free shack.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf