Generic VNA software for a saved file of ADC samples - Page 1
Forum section: electronics / rf-microwave

author: RoGeorge
author_rank: Super Contributor
timestamp: October 17, 2021, 01:50:58 pm
content: I would like to use a DDS frequency sweep (Rigol DG4000 generator) and a DSO to record the ADC samples (Rigol DS1000z oscilloscope), then to look at the saved datafile presented as it would be the display of a VNA.Is there any FOSS software tool to use or to modify for such a setup, software that can read some recorded ADC samples and present that data with the typical GUI charts and cursors of a VNA?

author: joeqsmith
author_rank: Super Contributor
timestamp: October 17, 2021, 02:37:01 pm
content: With the mention of vectors, I wonder if you know what you are asking. Assuming you have a way to get the complex data, I would just create a Touchstone file. You can then post process it with several free tools.

author: RoGeorge
author_rank: Super Contributor
timestamp: October 17, 2021, 06:18:43 pm
content: I didn't know about Touchstone, thank you for the hint about that file format!At a brief search about Touchstone and by looking at the menu fields of the program seen in this videohttps://youtu.be/ehmDhLn0Bm8,the file format seems easy to implement, and there are some Touchstone viewer programs already. Some viewers are free, and I bet some of them might be also FOSS. Will dig more about that later.I never had a VNA, so I might be asking for weird things. What I have in mind is to use a dual channel DDS generator and a 4 channel digital oscilloscope to cobble up together a VNA, for hobby projects around the lab.The generator has 2 independent channels that can be set to play identical signals, so one DDS output goes straight to one oscilloscope channel, as a phase reference. The other DDS output goes to the DUT. The remaining oscilloscope channels can be used to probe the DUT. (having in mind a 2 port DUT)For example:- one channel of the oscilloscope is sampling the generated signal (as a phase reference)- the second channel is sampling the voltage at the input port of the DUT- the third channel is sampling the voltage of the output port of the DUTThese 3 signals seem to me enough to calculate the instantaneous V and I at the input and output of the DUT, and from there to calculate the S parameters or to draw a Smith chart, assuming the input and output impedance seen by the DUT is 50 ohms.Please let me know if I left out any measurement that can not be deduced from these 3 sampled waveforms: Vref, Vin and Vout.After data acquisition, the ADC samples of Vref, Vin and Vout taken at each frequency needs to be converted into a datapoint to be displayed on the PC, with some nice formatted plots and sliders, and Smith charts, and engineering units on axis, and zoom, and click to show the values for a selected point on a plot, etc.My hope was to find a free GUI for displaying and handling the plots, without having to program myself all the layout and the details for each chart and text box. Seems like that's exactly what a Touchstone Viewer software can do.The data acquisition part had to be done anyway, and converting data to a Touchstone format seems easier than writing a custom GUI viewer. Either way, using an established intermediary file format can only be an advantage.

author: rf-messkopf
author_rank: Regular Contributor
timestamp: October 17, 2021, 09:23:24 pm
content: Quote from: RoGeorge on October 17, 2021, 06:18:43 pmIn order to determine the S-matrix you need to know more. For example, to measure \$S_{11}\$ of your device, you need the instantaneous voltageandcurrent into port 1, together with the phase angle between them. This assumes that the other port is terminated with the system impedance. Your circuit will not be able to measure that.If you determine these three quantities, you can work out the impedance looking into port 1, or equivalently, the reflection factor, or equivalently, the incident and reflected waves at port 1. Notice, though, that the ware quantities are a more general concept than the instantaneous voltage and current on a transmission line. They are also meaningful for waves in waveguides or free space. Only on TEM lines these concepts coincide.A real VNA measures them by separating the incident and the reflected wave by a directional coupler. In low frequency VNAs this is usually a resistive device, somewhat similar to a Wheatstone bridge.Quote from: RoGeorge on October 17, 2021, 06:18:43 pmOnly plotting the raw data measured with a directional device is not enough, and will be rather useless. Much of the power of a VNA is achieved though vector error correction, more commonly called calibration. Your software must be able to take care of that as well. The METAS VNA tools can do off-line calibration with Touchstone data. Also, there is thehttp://scikit-rf.org/package for Python which contains methods for the most common calibration types.

author: joeqsmith
author_rank: Super Contributor
timestamp: October 17, 2021, 09:29:35 pm
content: AppCAD is another free viewer. METAS is nice but will not plot Smith charts like AppCAD can.Depending one what your DUT is, will determine what you need for a setup. For simple S11 or shunt impedance, you need the incident, reflected and phase between them. Normally done with a a directional coupler.The NanoVNAs are fairly low cost. Software to control them and collect data is available for free.

author: Joel_Dunsmore
author_rank: Regular Contributor
timestamp: October 18, 2021, 12:50:13 am
content: Quote from: RoGeorge on October 17, 2021, 06:18:43 pmAs others have said, you need both voltage and current at the input and the output. If you pass your signal through a resistor, you can sample the input of the resistor with Vref and the output with Vin (connected to your DUT) and get current from that. At the output you will also need a current sense resistor. Generally you need 4 pieces of information for two S-parameters and 4 more pieces for all 4 S-parameters (the second set with a different drive condition, usually driving the signal from port 2 of the DUT) If you use directional couplers you can sample the square-root of the power waves and get the commonly-used a1, b1, a2, b2 waves (I'm being a bit pedantic as even though the O-scope can sample voltage, the coupled signal has a kind-of inferred power associated with the impedance of the coupler and we can convert it to a power as shown in chapter 1 in my book. Further, for s-parameters, you don't need to convert it to anything as we always take ratios of measurements so absolute values are not importanted - they ratio out).A lot of this is discussed in chapters 1 and 2 of my book, with error-correction in chapter 3:www.tinyurl.com/JoelsMicrowaveBookBut you can also find it elsewhere on line.For an O-scope measurement, your data will be in the time domain (sampled many times on the waveform at a fixed frequency). From this data, you need to extract the frequency domain data for each sample measurement in term of magnitude and phase. We use DSP filters to do this, but there are lots of techniques to extract such data including just an FFT.

author: RoGeorge
author_rank: Super Contributor
timestamp: October 19, 2021, 03:52:16 pm
content: Thank you all for guidance.Though, I still don't see why it wouldn't work. Maybe I didn't described it properly, maybe I oversimplified something in my lumped representation, or maybe I am missing something that I don't know at all, maybe I should rather say what is the goal than how to achieve it.The goal would be (apart from learning) to use a DG4000 DDS and a DS1000z DSO to characterize parts in AC, at relatively low frequencies (the oscilloscope band is 100MHz analog, and can simultaneously sample 4 channels at 250MSa/s each). For example, to measure the inductance of a coil, to see the self-resonance of a capacitor, the band of a filter or an amplifier, maybe some ESR measurements too, thinks like that.I'm not a ham, and have no hands on experience in RF or microwaves, only some light theoretical understanding. The goal is to learn more, to do some experiments (not only simulations), and to improvise some VNA-like tool with the two instruments I already have in my lab.Back on topic, the phase/amplitude of the source signal is known, the series (internal) resistance Rg of the generator is known (50 ohms and assumed pure resistive), that should be enough to find the phase/amplitude for current in the port 1 loop.Same for the second port, since it has a 50+j0 load attached, the voltage and current must be in phase, therefore from the V amplitude and phase (relative to Vg), and the pure resistive Rload, the current and phase through port 2 can be deduced.Knowing the amplitude and phase (relative to Vg) of both the voltage and the current at each port, should be enough. Thought didn't look into all the details yet, just a draft.I found out only yesterday that LTspice can calculate the S parameters, too, just like QUCS, except LTspice doesn't have Smith charts. That's great because LTspice is more productive to work with, and I can use the LTspice S plots to check if what I'm trying to do will give the same results.Will add later an example or two with complete schematic, and with the steps I plan to use in finding I / V / \$\varphi\$ at each port.

author: radiolistener
author_rank: Super Contributor
timestamp: October 20, 2021, 09:06:20 am
content: Quote from: RoGeorge on October 19, 2021, 03:52:16 pmyou're needs to use measurement bridge or directional coupler in order to measure reflection coefficient for the DUT.With a simple ADC on the DUT input you will be unable to get relation between forward and reflected waves which is needed to calculate reflection coefficient.Here is block diagram of a simple VNA with measurement bridge:In order to get reflection coefficient on the DUT input, you're needs two ADC:1) reference clock2) voltage on the resistor in the measurement bridge powered from reference clock.

author: RoGeorge
author_rank: Super Contributor
timestamp: October 21, 2021, 02:04:53 pm
content: Wow, this is so clever!I've noticed the Wheatstone bridge was mentioned here, but I was not aware of its property to distinguish between the incident and reflected waves, so I thought it was only a far resemblance. This feature of directionality of a bridge is so neat!Just for the docs, I'll put here two links explaining the directionality of a bridge for newcomers like me:https://www.mwrf.com/technologies/test-measurement/article/21849280/copper-mountain-technologies-the-wheatstone-bridge-how-does-it-impact-vna-measurementsbased on theDunsmore, Joel. “Simple SMT Bridge Circuit Mimics Ultra-Broadband Coupler”, RF Design, November 1991: p105-108.This is too nice to just read and move on without playing with a directional bridge a little.

author: Joel_Dunsmore
author_rank: Regular Contributor
timestamp: October 22, 2021, 06:08:02 am
content: Quote from: RoGeorge on October 19, 2021, 03:52:16 pmI neglected to notice your v-reference, and now I have to think about your conditions some more. Vref from the second DDS might be able to be considered the same as the reference tap of a bridge. If your DDS has perfect 50 ohms, and you know your voltage of the source exactly...let me think about it a bit more. "It's so crazy, it just might work". the condition of a dual DDS where the voltage measurement of one gives the true voltage of the other is not something I've seen before, so is something to consider further.

author: Odysseus
author_rank: Regular Contributor
timestamp: October 22, 2021, 07:17:03 am
content: If you are willing to perform SOL calibration, then you can use almost any four port network between a source, DUT, and two channels on a scope to build a one port VNA.Theonlyconstraint is that your network is linear, time invariant, and has non-zero directivity. The bridge you posted meets this criteria, and so does the one below.In particular, R1, R2, R3, and R4 can be any value, and in practice do not need to be purely resistive.The attached LTSpice schematic includes a large commented expression that correctly plots the S11 of the DUT, no matter how convoluted and imperfect your network is.More to your question: if you are exporting waveforms from your scope onto a PC, then as others have said, your best bet might be to get your hands dirty with python, octave, scilab, etc.And BTW, LTSpice can almost do smith charts:

author: JohnG
author_rank: Frequent Contributor
timestamp: October 22, 2021, 03:38:14 pm
content: For what it is worth, I recently came across a program called SimSmith. It looks very nice, but I have no experience with it. Just passing the info along because it looks like it could be fairly useful. Some links:http://www.ae6ty.com/smith_charts.htmlhttp://www.w0qe.com/SimSmith.htmlJohn

author: rf-messkopf
author_rank: Regular Contributor
timestamp: October 22, 2021, 04:07:29 pm
content: Quote from: Joel_Dunsmore on October 22, 2021, 06:08:02 amGosh, you are right. Referring to the above schematic, if we can assume that the instantaneous voltages V1g and V2g are exactly equal and the scope inputs are high impedance, then the current into port 1 is \$({\rm ADC2\_Vin}-{\rm ADC1\_Vref})/50\,\Omega\$, so we have all that we need to calculate \$S_{11}\$. Crazy indeed.

author: Marsupilami
author_rank: Frequent Contributor
timestamp: October 23, 2021, 02:33:48 am
content: The biggest problem I see with the voltage method is the ADC2_Vin terminal. Even if the Scope is in HiZ mode the cable going to it is in parallel with the DUT input port.The same at ADC3_Vout can be fixed by placing the 50R termination at the scope and with a good enough cable that will provide proper termination on the DUT output, but this is not possible on the input terminal. (Unless the cable is short enough for the frequency of interest. E.g. 1m teflon cable at 10MHz will show up as -i155Ohm in parallel to the DUT input.) For kHz ranges it should be perfectly fine.

author: Marsupilami
author_rank: Frequent Contributor
timestamp: October 23, 2021, 02:41:10 am
content: Also the two channels of the generators are driving a different load. One drives the scope input the other drives the cable to the DUT and the DUT input impedance + scope. The assumption is that the voltage at gCH1 node is the same as at gCH2 but that's not true if the two channels are loaded differently.

author: rf-messkopf
author_rank: Regular Contributor
timestamp: October 23, 2021, 06:27:26 pm
content: Quote from: Marsupilami on October 23, 2021, 02:41:10 amI don't mean to nitpick here, but if I'm not mistaken you only need the assumption that the two voltage sources in the generators are ideal and generate exactly the same voltage. And that Rg1 is exactly 50 Ohms. The voltage at node gCH1 will depend on the DUT and will in general not be equal to the voltage at gCH2..

author: Marsupilami
author_rank: Frequent Contributor
timestamp: October 23, 2021, 07:18:43 pm
content: Quote from: rf-messkopf on October 23, 2021, 06:27:26 pmYou totally should nitpick, that's how things are figured out and I started it.Anyway that is true if there's no voltage drop on the Calbe_to_DUT.If you know gCH2 (ADC1_Vref) then you know V2g because there's no current flowing through Rg2 as the scope is HiZ (this assumes that there's no cable at all between the generator and the scope)Then we know V1g too as it is exactly the same as V2g. If we knew the voltage at gCH1 then from (gCH1-V1g)/Rg1 we'd know the current flowing through Rg1 and thus into the DUT. The DUT input current, the DUT input voltage (ADC2_Vin) gives us the DUT input impedance thus S11 (assuming that the DUToutput is perfectly terminated).Problem is that gCH1 is not known. DUT input current will be (ADC2_Vin - V1g) / (Rg1 + Z_Cable_to_DUT). And Z_Calbe_to_DUT isn't known either.No? Am I missing something?

author: rf-messkopf
author_rank: Regular Contributor
timestamp: October 23, 2021, 07:56:10 pm
content: Quote from: Marsupilami on October 23, 2021, 07:18:43 pmWhat you say is absolutely correct.What I have been tacitly assuming is that the cable is negligible, in terms of loss and phase shift. This would be the case if it is short and frequencies are low enough.But even if the cable is present it should be possible to do a full one-port calibration of this setup and eliminate the error it introduces, right?Another story is that such a setup using a scope would have a poor dynamic range when compared to a real VNA.

author: RoGeorge
author_rank: Super Contributor
timestamp: October 23, 2021, 08:34:47 pm
content: Got sidetracked and still didn't looked into details, didn't experiment, or even simulate it yet.Quote from: rf-messkopf on October 23, 2021, 07:56:10 pmI've thought about this, the scope's ADC is only 8 bits, but since the oscilloscope allows to download upto 6 million samples, I hope to use that as oversampling, in order to add a few more bits to the resolution.In theory the scope's amplifier can be controlled too, so at a given frequency to give a boost or an attenuation when measuring (and to do that for each frequency data point), but that would probably make the whole setup very, very slow.