Author Topic: LCR Impedance Viewer for Picoscope+Keysight+R&S Bode Plot Data (open source)  (Read 29035 times)

0 Members and 1 Guest are viewing this topic.

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
I have been a big fan of using the app FRA4Picoscope to generate bode plots. This for me makes the Pico products much more useful.

By using a reference resistor in series with a DUT, it is possible to calculate the impedance from the DUT.  For this a made a small tool to do the calculation automatically, and also to allow the user to more easy compare different bode plots in once view. Currently, you can open the CSV-files generated by FRA4Picoscope, Keysight & R&S (more to come in the future), and view and compare them easily in the different impedance views.

I programmed automatic cursors, a zoom function for each individual axis, and both logarithmic and linear frequency axis. When a CSV file is opened, the used reference resistor is requested. This can be different for each file (to allow the user to choose the optimal value for the DUT) in the same plot view.  You can also copy pictures/data to the clipboard (data can be pasted in excel directly), or save them to a file.

Attached is the program, including some test data to allow non-Pico/Keysight/R&S users to have a go also. If some other scopes can generate bode plot data (frequency, gain and phase), it should be no problem to make an import functionality for these also. I am still cleaning up a bit of my code, once finished the code will be available as open source also.

Enjoy! Feedback is off course much appreciated. 

Installation is not required, just unzip the package and run the exe. It does need dotNet 4.6.1 or higher. The software was written in Visual Studio20172019 community edition, using the standard chart component of dotNet (no external libraries used for charting).

Edit: changed to VS2019 for the latest small update

Full source code is available at:
https://github.com/WimHuyghe/FRA-Impedance-Viewer
« Last Edit: September 12, 2021, 02:47:01 pm by _Wim_ »
 
The following users thanked this post: egonotto, thm_w, edavid, Andreas, doktor pyta, ogden, The Soulman, threephase, vmax

Offline threephase

  • Regular Contributor
  • *
  • Posts: 205
  • Country: gb
Re: LCR Impedance Viewer for Picoscope Bode Plot Data
« Reply #1 on: February 10, 2019, 02:31:56 pm »
Interesting project, I'll download it and transfer over to a Windows PC to have a play with.

Thanks for posting,

Kind regards.
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
Re: LCR Impedance Viewer for Picoscope Bode Plot Data
« Reply #2 on: February 10, 2019, 03:52:54 pm »
Thanks! If somebody could post a bode plot export (CSV preffered if possible) from a Keysight of Siglent scope, I can have a look to make an import function for these also.
 

Online 2N3055

  • Super Contributor
  • ***
  • Posts: 6453
  • Country: hr
Re: LCR Impedance Viewer for Picoscope Bode Plot Data
« Reply #3 on: February 10, 2019, 04:26:43 pm »
Thanks! If somebody could post a bode plot export (CSV preffered if possible) from a Keysight of Siglent scope, I can have a look to make an import function for these also.
Nice work!
Thanks for the offer, in attachment FRA CSV form Keysight MSOX3000T.
If you need more let me know.

Thanks and best regards.
Sinisa
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
Re: LCR Impedance Viewer for Picoscope+Keysight Bode Plot Data
« Reply #4 on: February 10, 2019, 07:22:21 pm »
Keysight import works also! I do not know what your file was, but I can import it and display it.

Now still a Siglent file, R&S and...  :)

EDIT: last version added in first post
« Last Edit: February 11, 2019, 02:02:57 pm by _Wim_ »
 

Online 2N3055

  • Super Contributor
  • ***
  • Posts: 6453
  • Country: hr
Re: LCR Impedance Viewer for Picoscope+Keysight Bode Plot Data
« Reply #5 on: February 10, 2019, 08:31:09 pm »
Wow it works really well!
Great work, really!

The file is standard FRA.csv from scope. I had to rename it to .txt to upload it to EEVBLOG (it doesn't let you upload .csv).

A suggestion: it would be nice to show what R was used for calculation. Maybe a chance to change it later + recalc ?

Thanks again.

Regards,
Sinisa.
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
Re: LCR Impedance Viewer for Picoscope+Keysight Bode Plot Data
« Reply #6 on: February 10, 2019, 08:57:33 pm »
Thanks for the feedback.

I will make a property windows were all file info can be seen (ref resistor, path, file name, number of datapoints, max freq, min freq...).

Changing the ref resistor value once displayed is not very easy (I would have to delete the series and add them again) and normally also not necesarry I think (if the wrong value was entered, the user can remove the file by right clicking on the legend and add it again using the correct value.

I have already added the following options:
- allow for printing a chart
- allow the user to choose to display the legend inside or outside the chart (both have benefits)

Currently working on the property window...
 
The following users thanked this post: 2N3055

Offline Hydron

  • Frequent Contributor
  • **
  • Posts: 978
  • Country: gb
Re: LCR Impedance Viewer for Picoscope+Keysight Bode Plot Data
« Reply #7 on: February 10, 2019, 09:27:32 pm »
Looks like a useful bit of software, thanks for writing and sharing it!
If nobody else supplies a R&S file then I can oblige, but I'll wait a bit first (scope is setup for some other measurements right now and prefer to leave it be).
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
Re: LCR Impedance Viewer for Picoscope+Keysight Bode Plot Data
« Reply #8 on: February 10, 2019, 09:33:24 pm »
Looks like a useful bit of software, thanks for writing and sharing it!

Thanks! Updated version added to first post. Now with print support and file properties window.
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
Re: LCR Impedance Viewer for Picoscope+Keysight Bode Plot Data
« Reply #9 on: February 10, 2019, 09:47:31 pm »
If anybody has some good info how a calibration can be calculated (like performing an "open" and "short" bode measurement first with the testjig alone). This could be a usefull feature to include to increase accuracy.

Will not be for today however...
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
Re: LCR Impedance Viewer for Picoscope+Keysight Bode Plot Data
« Reply #10 on: February 11, 2019, 02:05:11 pm »
New version in first post: some small bugfixes and cosmetic changes. Source code file is to big to attach here (4MB). @Moderator, is it possible to attach bigger files somehow in first post?
 

Offline Hydron

  • Frequent Contributor
  • **
  • Posts: 978
  • Country: gb
Re: LCR Impedance Viewer for Picoscope+Keysight Bode Plot Data
« Reply #11 on: February 11, 2019, 02:23:41 pm »
Maybe put it on something like github/lab etc? Would also allow people to see changes in the code over time.
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
Re: LCR Impedance Viewer for Picoscope+Keysight Bode Plot Data
« Reply #12 on: February 11, 2019, 05:33:44 pm »
Maybe put it on something like github/lab etc? Would also allow people to see changes in the code over time.

That crossed my mind also, but I first have to read a bit to see how exactly that works with integration in VS2017.
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
Re: LCR Impedance Viewer for Picoscope+Keysight Bode Plot Data
« Reply #13 on: February 11, 2019, 07:43:58 pm »
Ok, finally success I think. Apparently there is an issue with VS2017 on Win7 with github (error "user cancelled certificate check"). This links "easy fix" was indeed the solution for my problem: https://github.com/github/VisualStudio/issues/1532

So normally the full source code should be available here:
https://github.com/WimHuyghe/FRA-Impedance-Viewer

Please report back if you were able to compile it using this source code, and off course also if you would like to contribute to the code.
« Last Edit: February 11, 2019, 07:50:13 pm by _Wim_ »
 

Offline Hydron

  • Frequent Contributor
  • **
  • Posts: 978
  • Country: gb
Re: LCR Impedance Viewer for Picoscope+Keysight Bode Plot Data (open source)
« Reply #14 on: February 11, 2019, 10:22:42 pm »
So I did a quick bode plot on the RTB2k, both channels (3 and 4) connected directly to the sig gen so results are a bit boring (other than a bit of phase/amplitude shift from the cables/reflections up towards 25MHz) but should give an idea of file format (which is nice and simple). Note that this is 100points/decade but it can go up to 500, so potentially quite a few points for a wide sweep at 500/dec.
The standard output seems to be a CSV (attached with filetype changed to txt); there is also a "live data" directory with a bunch of other formats that can be accessed when the unit is plugged into the PC as a USB device - this is in the zip file (also attached) but probably not important to support that as it's far more complicated than the standard output - it's probably more for when the unit is used in an automated rather than interactive fashion.
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
Re: LCR Impedance Viewer for Picoscope+Keysight Bode Plot Data (open source)
« Reply #15 on: February 12, 2019, 09:56:27 pm »
So I did a quick bode plot on the RTB2k, both channels (3 and 4) connected directly to the sig gen so results are a bit boring (other than a bit of phase/amplitude shift from the cables/reflections up towards 25MHz) but should give an idea of file format (which is nice and simple).

R&S now also supported. Update attached to first post. Any other tools that generate bode plots? :-)
 

Online 2N3055

  • Super Contributor
  • ***
  • Posts: 6453
  • Country: hr
SC from Github compiled on first try on VS2017..
 
The following users thanked this post: _Wim_

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
SC from Github compiled on first try on VS2017..

Thanks for the feedback, good to know.
 
The following users thanked this post: 2N3055

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
Added direct measurement of a plot using a picoscope (no more need to save to CSV first). This uses the API DLL from the FRA4Picoscope app.

Updated version attached to first post, source code on Github.

Known bugs: status log picoscope does not work yet.
 

Offline HalFET

  • Frequent Contributor
  • **
  • Posts: 512
  • Country: 00
What did you have in mind as calibration? Do you actually want to calculate the error throughout the curve?
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
I was thinking of something is the line of measuring a "known" resistor with using the known reference resistor. This way both gain and phase can be predicted, and actual measured gain and phase can be used somehow as a correction. Similarly, I could measure with an open jig and a shorted jig like is typically done with an LCR meter.

But I am not sure this will be very useful, as the inaccuracy of using a scope in the first place or probably much worse that not performing a calibration on the test jig/cables.

 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
Updated version again in first post, now you can define the reference resistor when taking a measurement with the picoscope directly (forgot to remove the test code were is was default at 1K  :) )
 

Offline HalFET

  • Frequent Contributor
  • **
  • Posts: 512
  • Country: 00
That should be doable if you measure it in a range where the phase difference is high enough. You could probably also go for a Q-meter approach, though that would require additional components which might not be very attractive.
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
Finally fixed the problem with the message log. Updated version in first post. Also added some more options and small functionality.
 

Offline HalFET

  • Frequent Contributor
  • **
  • Posts: 512
  • Country: 00
Quick try at the error calculation, haven't yet investigated your code so not sure how applicable this is.

So operating on the assumption that we can see the circuit as follows:

V2  o------+
           |
          | |
          | | Z_REF
          | |
           |
V1  o------+
           |
          | |
          | | Z_DUT
          | |
           |
          ___
GND        -


Then we can assume: Z_DUT = Z_REF * V1 / (V2 - V1)
If we split each bit up as imaginary number: Z_DUT = R_DUT + j * X_DUT, Z_REF = R_REF + 1i * X_REF, V1 = V1_Re + 1i * V1_Im and V2 = V2_Re + 1i * V2_Im

At that point:
Code: [Select]
R_DUT = - ((V1_Im - V2_Im)*(R_REF*V1_Im + V1_Re*X_REF))/((V1_Im - V2_Im)^2 + (V1_Re - V2_Re)^2) - ((V1_Re - V2_Re)*(R_REF*V1_Re - V1_Im*X_REF))/((V1_Im - V2_Im)^2 + (V1_Re - V2_Re)^2)
Code: [Select]
X_DUT = ((V1_Im - V2_Im)*(R_REF*V1_Re - V1_Im*X_REF))/((V1_Im - V2_Im)^2 + (V1_Re - V2_Re)^2) - ((V1_Re - V2_Re)*(R_REF*V1_Im + V1_Re*X_REF))/((V1_Im - V2_Im)^2 + (V1_Re - V2_Re)^2)
If we then set the error of each input variable: R_REF_Error X_REF_Error V1_Re_Error V1_Im_Error V2_Re_Error V2_Im_Error

Then the errors become:
Code: [Select]
R_DUT_Error = (V1_Im_Error^2*((X_REF*(V1_Re - V2_Re))/((V1_Im - V2_Im)^2 + (V1_Re - V2_Re)^2) - (R_REF*(V1_Im - V2_Im))/((V1_Im - V2_Im)^2 + (V1_Re - V2_Re)^2) - (R_REF*V1_Im + V1_Re*X_REF)/((V1_Im - V2_Im)^2 + (V1_Re - V2_Re)^2) + ((V1_Im - V2_Im)*(R_REF*V1_Im + V1_Re*X_REF)*(2*V1_Im - 2*V2_Im))/((V1_Im - V2_Im)^2 + (V1_Re - V2_Re)^2)^2 + ((V1_Re - V2_Re)*(R_REF*V1_Re - V1_Im*X_REF)*(2*V1_Im - 2*V2_Im))/((V1_Im - V2_Im)^2 + (V1_Re - V2_Re)^2)^2)^2 + V1_Re_Error^2*((R_REF*V1_Re - V1_Im*X_REF)/((V1_Im - V2_Im)^2 + (V1_Re - V2_Re)^2) + (R_REF*(V1_Re - V2_Re))/((V1_Im - V2_Im)^2 + (V1_Re - V2_Re)^2) + (X_REF*(V1_Im - V2_Im))/((V1_Im - V2_Im)^2 + (V1_Re - V2_Re)^2) - ((V1_Im - V2_Im)*(R_REF*V1_Im + V1_Re*X_REF)*(2*V1_Re - 2*V2_Re))/((V1_Im - V2_Im)^2 + (V1_Re - V2_Re)^2)^2 - ((V1_Re - V2_Re)*(R_REF*V1_Re - V1_Im*X_REF)*(2*V1_Re - 2*V2_Re))/((V1_Im - V2_Im)^2 + (V1_Re - V2_Re)^2)^2)^2 + V2_Im_Error^2*(((V1_Im - V2_Im)*(R_REF*V1_Im + V1_Re*X_REF)*(2*V1_Im - 2*V2_Im))/((V1_Im - V2_Im)^2 + (V1_Re - V2_Re)^2)^2 - (R_REF*V1_Im + V1_Re*X_REF)/((V1_Im - V2_Im)^2 + (V1_Re - V2_Re)^2) + ((V1_Re - V2_Re)*(R_REF*V1_Re - V1_Im*X_REF)*(2*V1_Im - 2*V2_Im))/((V1_Im - V2_Im)^2 + (V1_Re - V2_Re)^2)^2)^2 + V2_Re_Error^2*(((V1_Im - V2_Im)*(R_REF*V1_Im + V1_Re*X_REF)*(2*V1_Re - 2*V2_Re))/((V1_Im - V2_Im)^2 + (V1_Re - V2_Re)^2)^2 - (R_REF*V1_Re - V1_Im*X_REF)/((V1_Im - V2_Im)^2 + (V1_Re - V2_Re)^2) + ((V1_Re - V2_Re)*(R_REF*V1_Re - V1_Im*X_REF)*(2*V1_Re - 2*V2_Re))/((V1_Im - V2_Im)^2 + (V1_Re - V2_Re)^2)^2)^2 + R_REF_Error^2*((V1_Im*(V1_Im - V2_Im))/((V1_Im - V2_Im)^2 + (V1_Re - V2_Re)^2) + (V1_Re*(V1_Re - V2_Re))/((V1_Im - V2_Im)^2 + (V1_Re - V2_Re)^2))^2 + X_REF_Error^2*((V1_Re*(V1_Im - V2_Im))/((V1_Im - V2_Im)^2 + (V1_Re - V2_Re)^2) - (V1_Im*(V1_Re - V2_Re))/((V1_Im - V2_Im)^2 + (V1_Re - V2_Re)^2))^2)^(1/2)
Code: [Select]
X_DUT_Error = (V1_Im_Error^2*((R_REF*(V1_Re - V2_Re))/((V1_Im - V2_Im)^2 + (V1_Re - V2_Re)^2) - (R_REF*V1_Re - V1_Im*X_REF)/((V1_Im - V2_Im)^2 + (V1_Re - V2_Re)^2) + (X_REF*(V1_Im - V2_Im))/((V1_Im - V2_Im)^2 + (V1_Re - V2_Re)^2) + ((V1_Im - V2_Im)*(R_REF*V1_Re - V1_Im*X_REF)*(2*V1_Im - 2*V2_Im))/((V1_Im - V2_Im)^2 + (V1_Re - V2_Re)^2)^2 - ((V1_Re - V2_Re)*(R_REF*V1_Im + V1_Re*X_REF)*(2*V1_Im - 2*V2_Im))/((V1_Im - V2_Im)^2 + (V1_Re - V2_Re)^2)^2)^2 + V1_Re_Error^2*((R_REF*V1_Im + V1_Re*X_REF)/((V1_Im - V2_Im)^2 + (V1_Re - V2_Re)^2) - (R_REF*(V1_Im - V2_Im))/((V1_Im - V2_Im)^2 + (V1_Re - V2_Re)^2) + (X_REF*(V1_Re - V2_Re))/((V1_Im - V2_Im)^2 + (V1_Re - V2_Re)^2) + ((V1_Im - V2_Im)*(R_REF*V1_Re - V1_Im*X_REF)*(2*V1_Re - 2*V2_Re))/((V1_Im - V2_Im)^2 + (V1_Re - V2_Re)^2)^2 - ((V1_Re - V2_Re)*(R_REF*V1_Im + V1_Re*X_REF)*(2*V1_Re - 2*V2_Re))/((V1_Im - V2_Im)^2 + (V1_Re - V2_Re)^2)^2)^2 + V2_Im_Error^2*((R_REF*V1_Re - V1_Im*X_REF)/((V1_Im - V2_Im)^2 + (V1_Re - V2_Re)^2) - ((V1_Im - V2_Im)*(R_REF*V1_Re - V1_Im*X_REF)*(2*V1_Im - 2*V2_Im))/((V1_Im - V2_Im)^2 + (V1_Re - V2_Re)^2)^2 + ((V1_Re - V2_Re)*(R_REF*V1_Im + V1_Re*X_REF)*(2*V1_Im - 2*V2_Im))/((V1_Im - V2_Im)^2 + (V1_Re - V2_Re)^2)^2)^2 + V2_Re_Error^2*((R_REF*V1_Im + V1_Re*X_REF)/((V1_Im - V2_Im)^2 + (V1_Re - V2_Re)^2) + ((V1_Im - V2_Im)*(R_REF*V1_Re - V1_Im*X_REF)*(2*V1_Re - 2*V2_Re))/((V1_Im - V2_Im)^2 + (V1_Re - V2_Re)^2)^2 - ((V1_Re - V2_Re)*(R_REF*V1_Im + V1_Re*X_REF)*(2*V1_Re - 2*V2_Re))/((V1_Im - V2_Im)^2 + (V1_Re - V2_Re)^2)^2)^2 + R_REF_Error^2*((V1_Re*(V1_Im - V2_Im))/((V1_Im - V2_Im)^2 + (V1_Re - V2_Re)^2) - (V1_Im*(V1_Re - V2_Re))/((V1_Im - V2_Im)^2 + (V1_Re - V2_Re)^2))^2 + X_REF_Error^2*((V1_Im*(V1_Im - V2_Im))/((V1_Im - V2_Im)^2 + (V1_Re - V2_Re)^2) + (V1_Re*(V1_Re - V2_Re))/((V1_Im - V2_Im)^2 + (V1_Re - V2_Re)^2))^2)^(1/2)
It ain't pretty, but doable I would say.
 
The following users thanked this post: 2N3055

Offline HalFET

  • Frequent Contributor
  • **
  • Posts: 512
  • Country: 00
To further elaborate on it, since you're using gain apparently (assuming I read your code correctly) we'll have to convert the scope's measurement error to gain error:
Gain = 20 log(V1/V2)
dGain/dV1 = - 20 / V1
dGain/dV2 = 20 / V2

So then:
Gain Error = sqrt( (dGain/dV1 * V1_Error)^2 + (dGain/dV2 * V2_Error)^2 )
Gain Error = sqrt( (20 / V1 * V1_Error)^2 + (20 / V2 * V2_Error)^2 )
Gain Error = 20 * sqrt( (V1_Error / V1)^2 + (V2_Error / V2)^2 )

Next we need to put this into Z_DUT = Z_REF * V1 / (V2 - V1)

If we rework it a bit it should become Z_DUT = Z_REF / (V2 / V1 - 1) = Z_REF / (1 / (V1/V2) - 1)

Then V1/V2 = (|V1| < Phi)/(V2 < 0°) = (|V1| * cos(phi) + j * |V1| * sin(phi)) / |V2| so we need to know the error on |V1|/|V2|.

Since |V1|/|V2| = 10^(Gain/20) the error becomes sqrt((Gain Error * 2^((x-40)/20) * 5^((x-20)/20) * ln(10))^2)

I'll do the rest later.
« Last Edit: March 01, 2019, 11:31:16 am by HalFET »
 
The following users thanked this post: 2N3055

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
To further elaborate on it, since you're using gain apparently (assuming I read your code correctly) we'll have to convert the scope's measurement error to gain error:
Gain = 20 log(V1/V2)
dGain/dV1 = - 20 / V1
dGain/dV2 = 20 / V2

So then:
Gain Error = sqrt( (dGain/dV1 * V1_Error)^2 + (dGain/dV2 * V2_Error)^2 )
Gain Error = sqrt( (20 / V1 * V1_Error)^2 + (20 / V2 * V2_Error)^2 )
Gain Error = 20 * sqrt( (V1_Error / V1)^2 + (V2_Error / V2)^2 )

Next we need to put this into Z_DUT = Z_REF * V1 / (V2 - V1)

If we rework it a bit it should become Z_DUT = Z_REF / (V2 / V1 - 1) = Z_REF / (1 / (V1/V2) - 1)

Then V1/V2 = (|V1| < Phi)/(V2 < 0°) = (|V1| * cos(phi) + j * |V1| * sin(phi)) / |V2| so we need to know the error on |V1|/|V2|.

Since |V1|/|V2| = 10^(Gain/20) the error becomes sqrt((Gain Error * 2^((x-40)/20) * 5^((x-20)/20) * ln(10))

I'll do the rest later.

Wow, thanks for this. I will have a detailed look at it this weekend, to late for math now...  :)
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
New version in first post:

Bugfix:
- was not possible any longer to open multiple FRA4Pico plots (was always opening new plot).

Other changes:
- cursor info always same nr of lines (so chart does not move when right mouse button is used)
- pompt on exit when unsaved files are present
 
The following users thanked this post: 2N3055, HalFET

Offline HalFET

  • Frequent Contributor
  • **
  • Posts: 512
  • Country: 00
To further elaborate on it, since you're using gain apparently (assuming I read your code correctly) we'll have to convert the scope's measurement error to gain error:
Gain = 20 log(V1/V2)
dGain/dV1 = - 20 / V1
dGain/dV2 = 20 / V2

So then:
Gain Error = sqrt( (dGain/dV1 * V1_Error)^2 + (dGain/dV2 * V2_Error)^2 )
Gain Error = sqrt( (20 / V1 * V1_Error)^2 + (20 / V2 * V2_Error)^2 )
Gain Error = 20 * sqrt( (V1_Error / V1)^2 + (V2_Error / V2)^2 )

Next we need to put this into Z_DUT = Z_REF * V1 / (V2 - V1)

If we rework it a bit it should become Z_DUT = Z_REF / (V2 / V1 - 1) = Z_REF / (1 / (V1/V2) - 1)

Then V1/V2 = (|V1| < Phi)/(V2 < 0°) = (|V1| * cos(phi) + j * |V1| * sin(phi)) / |V2| so we need to know the error on |V1|/|V2|.

Since |V1|/|V2| = 10^(Gain/20) the error becomes sqrt((Gain Error * 2^((x-40)/20) * 5^((x-20)/20) * ln(10))^2)

I'll do the rest later.

Fixed a little error, forgot the ^2 on the ratio of |V1|/|V2|  error, but I'd just replace it with abs() in software. Also didn't remember that cos(x) + j*sin(x) = e^(j*x).

The error on V1/V2 then becomes:

d(V1/V2)/d(|V1|/|V2|) = exp(j*phi)
d(V1/V2)/d(phi) = (|V1|/|V2|)*exp(j*(phi+0.5*pi))
Error V1/V2 = sqrt((d(V1/V2)/d(|V1|/|V2|) * Error(|V1|/|V2|))^2 + (d(V1/V2)/d(phi) * Error(Phi))


 

Offline HalFET

  • Frequent Contributor
  • **
  • Posts: 512
  • Country: 00
Redid it entirely in Matlab to avoid errors (think a few might have sneaked in already, like I forgot a ln(10) in the gain error probably):
Code: [Select]
syms REF_Magnitude positive; syms Error_REF_Magnitude positive;
syms REF_Phi real;           syms Error_REF_Phi positive;
syms V1_Magnitude positive;  syms Error_V1_Magnitude positive;
syms V1_Phi real;            syms Error_V1_Phi positive;
syms V2_Magnitude positive;  syms Error_V2_Magnitude positive;

%Calculate Gain error based on scope measurements
%This should be a function of the scope which is calculated once.
TrueGain = 20 * log10(V1_Magnitude / V2_Magnitude);

dGain_dV1 = diff(TrueGain, V1_Magnitude);
dGain_dV2 = diff(TrueGain, V2_Magnitude);
TrueGain_Error = sqrt( (dGain_dV1 * Error_V1_Magnitude)^2 + (dGain_dV2 * Error_V2_Magnitude)^2 );


%Lets assume the Gain and Gain_Error are input variables
syms Gain Gain_Error real;

%Calculate V1/V2 error based on Gain error
V1_V2_Magn_ratio = 10 ^ (Gain / 20);
Error_V1_V2_Magn_ratio = abs(diff(V1_V2_Magn_ratio, Gain) * Gain_Error);

V1_V2 = V1_V2_Magn_ratio * exp(1i * V1_Phi);

dV1_V2_dGain   = diff(V1_V2, Gain);
dV1_V2_dV1_Phi = diff(V1_V2, V1_Phi);
V1_V2_Error = sqrt(( dV1_V2_dGain * Gain_Error)^2 + (dV1_V2_dV1_Phi * Error_V1_Phi)^2);

%Device Under Test
Z_REF = REF_Magnitude * exp(1i * REF_Phi);
Z_DUT = Z_REF * 1 / (1 / V1_V2 - 1);
Z_DUT_Magnitude = abs(Z_DUT);
Z_DUT_Phase     = angle(Z_DUT);

Z_DUT_Magnitude_deltas  = [diff(Z_DUT_Magnitude, REF_Magnitude) diff(Z_DUT_Magnitude, REF_Phi) diff(Z_DUT_Magnitude, Gain) diff(Z_DUT_Magnitude, V1_Phi)];
Z_DUT_Magnitude_errors  = [Error_REF_Magnitude Error_REF_Phi Gain_Error Error_V1_Phi];
Z_DUT_Phase_deltas      = [diff(Z_DUT_Phase, REF_Magnitude) diff(Z_DUT_Phase, REF_Phi) diff(Z_DUT_Phase, Gain) diff(Z_DUT_Phase, V1_Phi)];
Z_DUT_Phase_errors      = [Error_REF_Magnitude Error_REF_Phi Gain_Error Error_V1_Phi];

Z_DUT_Magnitude_Error   = sqrt(sum((Z_DUT_Magnitude_deltas .* Z_DUT_Magnitude_errors).^2));
Z_DUT_Phase_Error       = sqrt(sum((Z_DUT_Phase_deltas .* Z_DUT_Phase_errors).^2));


Code: [Select]
Z_DUT_Magnitude = REF_Magnitude/abs(1/10^(Gain/20)*exp(-V1_Phi*1i) - 1)
Z_DUT_Phase = angle(exp(REF_Phi*1i)/(1/10^(Gain/20)*exp(-V1_Phi*1i) - 1))

Z_DUT_Magnitude_Error = (Error_REF_Magnitude^2/abs(exp(-V1_Phi*1i)/10^(Gain/20) - 1)^2 - (1/10^(Gain/10)*Error_V1_Phi^2*REF_Magnitude^2*sign(1/10^(Gain/20)*exp(-V1_Phi*1i) - 1)^2*exp(-V1_Phi*2i))/abs(exp(-V1_Phi*1i)/10^(Gain/20) - 1)^4 + (1/10^(Gain/10)*Gain_Error^2*REF_Magnitude^2*sign(1/10^(Gain/20)*exp(-V1_Phi*1i) - 1)^2*exp(-V1_Phi*2i)*log(10)^2)/(400*abs(exp(-V1_Phi*1i)/10^(Gain/20) - 1)^4))^(1/2)
Z_DUT_Phase_Error = ((Gain_Error^2*real(exp(REF_Phi*1i)/(1/10^(Gain/20)*exp(-V1_Phi*1i) - 1))^4*(imag((1/10^(Gain/20)*exp(REF_Phi*1i)*exp(-V1_Phi*1i)*log(10))/(exp(-V1_Phi*1i)/10^(Gain/20) - 1)^2)/(20*real(exp(REF_Phi*1i)/(1/10^(Gain/20)*exp(-V1_Phi*1i) - 1))) - (real((1/10^(Gain/20)*exp(REF_Phi*1i)*exp(-V1_Phi*1i)*log(10))/(exp(-V1_Phi*1i)/10^(Gain/20) - 1)^2)*imag(exp(REF_Phi*1i)/(1/10^(Gain/20)*exp(-V1_Phi*1i) - 1)))/(20*real(exp(REF_Phi*1i)/(exp(-V1_Phi*1i)/10^(Gain/20) - 1))^2))^2)/(imag(exp(REF_Phi*1i)/(exp(-V1_Phi*1i)/10^(Gain/20) - 1))^2 + real(exp(REF_Phi*1i)/(exp(-V1_Phi*1i)/10^(Gain/20) - 1))^2)^2 + (Error_V1_Phi^2*real(exp(REF_Phi*1i)/(1/10^(Gain/20)*exp(-V1_Phi*1i) - 1))^4*(real((1/10^(Gain/20)*exp(REF_Phi*1i)*exp(-V1_Phi*1i))/(exp(-V1_Phi*1i)/10^(Gain/20) - 1)^2)/real(exp(REF_Phi*1i)/(1/10^(Gain/20)*exp(-V1_Phi*1i) - 1)) + (imag((1/10^(Gain/20)*exp(REF_Phi*1i)*exp(-V1_Phi*1i))/(exp(-V1_Phi*1i)/10^(Gain/20) - 1)^2)*imag(exp(REF_Phi*1i)/(1/10^(Gain/20)*exp(-V1_Phi*1i) - 1)))/real(exp(REF_Phi*1i)/(exp(-V1_Phi*1i)/10^(Gain/20) - 1))^2)^2)/(imag(exp(REF_Phi*1i)/(exp(-V1_Phi*1i)/10^(Gain/20) - 1))^2 + real(exp(REF_Phi*1i)/(exp(-V1_Phi*1i)/10^(Gain/20) - 1))^2)^2 + (Error_REF_Phi^2*real(exp(REF_Phi*1i)/(1/10^(Gain/20)*exp(-V1_Phi*1i) - 1))^4*(imag(exp(REF_Phi*1i)/(1/10^(Gain/20)*exp(-V1_Phi*1i) - 1))^2/real(exp(REF_Phi*1i)/(exp(-V1_Phi*1i)/10^(Gain/20) - 1))^2 + 1)^2)/(imag(exp(REF_Phi*1i)/(exp(-V1_Phi*1i)/10^(Gain/20) - 1))^2 + real(exp(REF_Phi*1i)/(exp(-V1_Phi*1i)/10^(Gain/20) - 1))^2)^2)^(1/2)

This isn't very practical though, the question is where to start simplifying. Or better yet, what's an acceptable error estimate. The flu hit me a bit too hard for me to think straight about this one for now, heheh.
 
The following users thanked this post: _Wim_

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
Yikes  :o. That's alot of math to check this weekend. Maybe I will need a couple more...  :)
 

Offline HalFET

  • Frequent Contributor
  • **
  • Posts: 512
  • Country: 00
Yikes  :o. That's alot of math to check this weekend. Maybe I will need a couple more...  :)
It just over-inflates very quickly if you don't use in-between answers and simplify some terms, it ain't as bad as it looks. The principle behind error/uncertainty calculations is really simple though: Error of Value = sqrt( sum of (dValue/dx1 * Error of x_i)^2 for all variables x_i)

So it'd be a lot more practical to calculate dValue/dx_i for each variable, and then just add it all up together like that like I did in the Matlab code. Just a bit too hazy to cut it up into pieces at the moment, should be easy enough to do if you fire that code up in Matlab or Octave though.

But the main interesting bit is that the gain error in practice stays quite flat until you go into the lower ranges, there the potential offset error of the scope can kill it for you.
Code: [Select]
Series = 0.001:0.005:10;
[X, Y] = meshgrid(Series, Series);
Z = 20 .* log10(X./Y);

figure(1);
surf(X, Y, Z, 'edgecolor', 'none');
xlabel('V2 [V]');
ylabel('V1 [V]');
zlabel('Gain [dB]');
title('Voltage Gain - Decibel');

%Scope error =  Gain error + Offset error + ADC error
%            =  +/- 5% value +/- 5 mV +/- 0.25% range

Range1X = X <= 0.1;                         Range1Y = Y <= 0.1;
Range2X = xor(X <= 1, Range1X);             Range2Y = xor(Y <= 1, Range1Y);
Range3X = xor(X <= 10, Range1X | Range2X);  Range3Y = xor(Y <= 10, Range1Y | Range2Y);


XError = 0.05 .* X + 0.005 + 0.0025 .* (Range1X .* 0.1 + Range2X .* 1 + Range3X .* 10);
YError = 0.05 .* Y + 0.005 + 0.0025 .* (Range1Y .* 0.1 + Range2Y .* 1 + Range3Y .* 10);
ZError = (20 ./ log(10)) .* sqrt((YError./Y).^2 + (XError./X).^2 );

figure(2);
surf(X, Y, ZError, 'edgecolor','none');
xlabel('V2 [V]');
ylabel('V1 [V]');
zlabel('Gain Error [dB]');
title('Voltage Gain Error - Decibel Error');

Operating on the assumption that the 39°C fever hasn't completely fried my brain, you're looking at something along the lines of <0.75 dB as of uncertainty throughout the practical range. Practical offset errors will probably be less than 2 mV, and the gain error on any modern scope frontend ought to be less than 5% really. See attached plots for 0 through 10V with the values of the code above.
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
First let me explain the current calculation that is in the software:

        V1 o------+
              |
             | |
             | | Z_REF
             | |
              |
   V2 o------+
              |
             | |
             | | Z_DUT
             | |
              |
            ___
   GND     -

   Z_DUT = V2 / I

   I = Rref / (V2 - V1)
   
   => Z_DUT = Rref* V2 / (V1-V2)

   Angle between V1 and V2 = θ, V1 at 0°equal to siggen.

   Current in polar coordinates: [r=sqrt(X²+Y²) //  α= tan-1 (y/x) ]
   <=> I = Rref / sqrt((V1 - V2 * cosθ)² +(V2 * sinθ)²)
   <=> I = Ref / sqrt(V1²-2 * V1 * V2 * cosθ + V2²)


  Magnitude & angle of Z_DUT: [dividing vectors in polar coordinates = divide magnitudes and substract phases]
        Z_DUT = Rref* V2 / sqrt(V1²-2*V1* V2*cosθ + V2²)
        α =  θ – tan-1 ((-V2* sinθ)/(V1-V2* cosθ))

  To translate the above to “gain”, we know <=> gain = V2/V1

   -----------------------------------------------------------
   | Zmag = Rref* gain / sqrt(1-2*gain* cosθ + gain²) |
   ----------------------------------------------------------- (equation 1)
   -----------------------------------------------------
   | α =  θ – tan-1 ((-gain* sinθ)/(1-gain* cosθ)) |
   ------------------------------------------------- ---(equation 2)

   Capacitance:
   -------------
   Z_DUT expressed in rectangular format has only a real part equal to Resr and a negative imaginary part equal to 1/(2*π* f*C)
   
   Z_DUT = Resr – j / (2*π* f*C)
   
   Z_DUT = Zmag* cosα + j* Zmag*sinα
   =>

  --------------------------
  | Resr = Zmag* cosα  |
  -------------------------- (equation 3)
 
  Zmag* sinα = -1 / (2 * π * f * C) <=>

  ----------------------------------------
  | C = -1 / (2 * π * f * Zmag * sinα |
  ----------------------------------------(equation 4)

  Inductance:
  ------------

  Z_DUT expressed in rectangular format has only a real part equal to Resr and a positive imaginary part equal to 2*π* f*L

  Z_DUT = Resr + j * 2 * π * f * L

  Z_DUT = Zmag* cosα + j* Zmag*sinα
  =>

   --------------------------
   | Resr = Zmag* cosα  |
   -------------------------- (equal to equation 3)
   --------------------------------
   | L = Zmag* sinα / (2*π* f) |
   --------------------------------- (equation 5)
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
Calibration:

If we perform the calibration with a purely resistive calibration resistor Rcal, we know Z_TOT  will consist of Rcal + Z_ERR

In rectangular coordinates we can express this as

Z_TOT = Zmag_err*cosα_err + Rcal + j* Zmag_err*sinα_err
Z_TOT =  Zmag*cosα                      + j*Zmag*sinα

=>
Zmag*cosα = Zmag_err*cosα_err + Rcal (1)
Zmag*sinα = Zmag_err*sinα_err (2)

(2) Can be changed to:

-----------------------------------------
| Zmag_err = Zmag*sinα / sinα_err |
----------------------------------------- (equation 6)

Substituting equation 6 into (1)

Zmag*cosα = = Zmag*sinα *cosα_err/sinα_err   + Rcal <=>

------------------------------------------------------------
| α_err = tan-1 (Zmag* sinα / (Zmag*cosα – Rcal))  |
------------------------------------------------------------ (equation 7)

This way we know the error vector that can be used to adjust the measurement in the future.
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
Calculation of DUT with correction:

We know Z_TOT  will consist of Z_DUT + Z_ERR

In rectangular coordinates we can express this as
Z_TOT = Zmag_err*cosα_err + Zmag_DUT*cosα_DUT + j* (Zmag_err*sinα_err + Zmag_DUT *sinα_DUT)
Z_TOT =  Zmag*cosα                                                + j*Zmag*sinα
=>

Zmag*cosα =  Zmag_err*cosα_err + Zmag_DUT*cosα_DUT
Zmag*sinα = Zmag_err*sinα_err + Zmag_DUT *sinα_DUT
=>
------------------------------------------------------------------------
| Zmag_DUT = (Zmag*sinα - Zmag_err*sinα_err) / sinα_DUT   |
------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------
| α_DUT = tan-1 ((Zmag*sinα - Zmag_err*sinα_err)/ (Zmag*cosα - Zmag_err*cosα_err)) |
------------------------------------------------------------------------------------------------------

The capacitance and inductance formulae above can now be changed with Zmag_DUT and α_DUT.


I am not a Matlab guy, so did not check this, just tried to make my written calculations in digital format.

Basic principle would be as follows:

- run a calibration with an Rcal reference resistor once. This file will be saved with values for Zmag_err and α_err for each frequency (interpollation will be used for in between frequencies)

- measure a DUT.
    * first calucalate Zmag + α
    * lookup Zmag_err + α_err from the calibration file for each frequency
    * based on the above, calculate Zmag_dut and α_DUT
    * caculate capacitance and inductance using these last 2

Am I missing something? Although I am currently not sick, my head also goes to 39°C when doing this stuff, so could be full with mistakes. So to all the math guru's, please check  :)

All of this is off course only true if Z_ERR can be thought of as an impedance in series with Z_DUT...


edit: some spelling mistakes, copy paste error and clarifications
« Last Edit: March 03, 2019, 08:45:09 pm by _Wim_ »
 

Offline Hans Polak

  • Contributor
  • Posts: 39
  • Country: nl
Wim,
I downloaded your nice calculation tool and it seems to work fine on the .csv file produced by FRA4Picoscope.
Problem however is that although FRA4Picoscope produces nice Bode plots, they show 1/A instead of input A, no idea why. Your tool obviously assumes an A and not an 1/A.

That's why I tried "Measure" in your program.
A nice screen appears with all relevant parameters to be entered, but when I press "start Measurement", I get a message "Unhandled Exception" and when  clicking continue nothing further happens.
I have installed SDK from Picoscope, but that makes no difference.
Do I still need some additional software on my machine ?
I have a 5243B PicoScope and my computer has Windows 10.

I enclosed as a .txt file the .CSV file for a bode plot of a 2200 Ohm Rsense between B and A and a 1mH +56 Ohm coil between A and Gnd plus what FRA4Picoscope made of it.

Hans


 


 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
Hi Hans,

If I see the plot from FRA4Picoscope, I think you got input and output channel mixed up , because your gain can never be bigger than 0db with a passive device and a series resistance (input channel = input to DUT; output= output from DUT, it gets me confused also quite regularly). My app does not case which channels were used, I only look at gain and phase in the CSV file.
As for my app crashing, normally there should be a log file in the execution directory. Can you post that one here? Did you close FRA4Picoscope while testing with my app (both cannot be run at the same time because both want access to the scope)?If FRA4Picoscope runs fine, you normally do not need to install anything else.

 

Offline Hans Polak

  • Contributor
  • Posts: 39
  • Country: nl
Hi Wim,

Thanks for your rapid reply.
You are right, changing the A and the B inputs returns the correct information.
I have now the DUT from input B to gnd and not from input A as in your instruction.
Thanks again,

Hans


 

Offline Evodad

  • Contributor
  • Posts: 21
  • Country: se
Hi Wim,

I have used FRA4 quite a lot on and of since it was released. So yours is a really nice contribution to the tools for Picoscope,
expanding on the usability !

As for Hans in the Previous post I can't get the included measurement application to work. See attached file.
With FRA4 everything works just fine.

As for calibration and improvements. May I suggest to add checkboxes with a number for each loaded file.
(Or some other good way to do it)
  • Unchecking will remove them from display
  • Simple functions could take Trace 1 and subract from Trace 2 (where Trace 1 could be e.g a zero ohm refererence)
  • You could save a combination of data as new data
  • You could delete Trace X of not needed anymore etc

Keep up the good work !

)) Kind regards, Per

 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
Hi Wim,

I have used FRA4 quite a lot on and of since it was released. So yours is a really nice contribution to the tools for Picoscope,
expanding on the usability !

As for Hans in the Previous post I can't get the included measurement application to work. See attached file.
With FRA4 everything works just fine.

As for calibration and improvements. May I suggest to add checkboxes with a number for each loaded file.
(Or some other good way to do it)
  • Unchecking will remove them from display
  • Simple functions could take Trace 1 and subract from Trace 2 (where Trace 1 could be e.g a zero ohm refererence)
  • You could save a combination of data as new data
  • You could delete Trace X of not needed anymore etc

Keep up the good work !

)) Kind regards, Per

Hi,

Could you post the "log4net.log" file from the execution directory. I hope this will give me some additional info.

Deleting a trace is possible already, just left click on legend item you want to remove.

As to the other improvements, some things were already planned, but I have been quite occupied with actual work lately, and lost a bit of momentum on this. This started out as a "quick and dirty" personal tool, and I should make some quite big structure changes to add things like you requested more easily.

 

Offline Evodad

  • Contributor
  • Posts: 21
  • Country: se
Just answered but that reply does seem to have gone into Cyberspace....
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
into Cyberspace....

My debugger does not run wel there...  ::)
 

Offline Evodad

  • Contributor
  • Posts: 21
  • Country: se
Added Log first changed to .txt then zipped and changed to .txt, will it post :)

YES, this worked better !!!
« Last Edit: April 21, 2019, 11:03:49 am by Evodad »
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
Added Log first changed to .txt then zipped and changed to .txt, will it post :)

YES, this worked better !!!

Something is not correct, because the file does not contain any readable text. Normally you should be able to open this file in notepad and see something like this:

Code: [Select]
2019-03-07 22:02:35,865 [1] DEBUG WHConsult.Utils.Settings.IniFiles.IniSettingsManager - GetDoubleValue: SettingName:StartFrequencyHz DefaultValue:100
2019-03-07 22:02:35,904 [1] DEBUG WHConsult.Utils.Settings.IniFiles.IniSettingsController - GetValue fileType:Settings section:Picoscope settingName:StartFrequencyHz
2019-03-07 22:02:35,908 [1] DEBUG WHConsult.Utils.Settings.IniFiles.IniSettingsController - GetInifile fileType:Settings
2019-03-07 22:02:35,913 [1] DEBUG WHConsult.Utils.Settings.IniFiles.IniSettingsManager - GetIntValue: SettingName:ExtraSettlingTimeMs DefaultValue:30
2019-03-07 22:02:35,919 [1] DEBUG WHConsult.Utils.Settings.IniFiles.IniSettingsController - GetValue fileType:Settings section:Picoscope settingName:ExtraSettlingTimeMs
2019-03-07 22:02:35,926 [1] DEBUG WHConsult.Utils.Settings.IniFiles.IniSettingsController - GetInifile fileType:Settings
2019-03-07 22:02:35,934 [1] DEBUG WHConsult.Utils.Settings.IniFiles.IniSettingsManager - GetDoubleValue: SettingName:StimulusOffset DefaultValue:0
2019-03-07 22:02:35,941 [1] DEBUG WHConsult.Utils.Settings.IniFiles.IniSettingsController - GetValue fileType:Settings section:Picoscope settingName:StimulusOffset
2019-03-07 22:02:35,950 [1] DEBUG WHConsult.Utils.Settings.IniFiles.IniSettingsController - GetInifile fileType:Settings
2019-03-07 22:02:35,956 [1] DEBUG WHConsult.Utils.Settings.IniFiles.IniSettingsManager - GetDoubleValue: SettingName:InitialStimulus DefaultValue:0,1
2019-03-07 22:02:35,963 [1] DEBUG WHConsult.Utils.Settings.IniFiles.IniSettingsController - GetValue fileType:Settings section:Picoscope settingName:InitialStimulus
2019-03-07 22:02:35,966 [1] DEBUG WHConsult.Utils.Settings.IniFiles.IniSettingsController - GetInifile fileType:Settings
2019-03-07 22:02:35,973 [1] DEBUG WHConsult.Utils.Settings.IniFiles.IniSettingsManager - GetDoubleValue: SettingName:OutputDCOffset DefaultValue:0
2019-03-07 22:02:35,978 [1] DEBUG WHConsult.Utils.Settings.IniFiles.IniSettingsController - GetValue fileType:Settings section:Picoscope settingName:OutputDCOffset
2019-03-07 22:02:35,986 [1] DEBUG WHConsult.Utils.Settings.IniFiles.IniSettingsController - GetInifile fileType:Settings
2019-03-07 22:02:35,995 [1] DEBUG WHConsult.Utils.Settings.IniFiles.IniSettingsManager - GetStringValue: SettingName:OutputChannel DefaultValue:B
2019-03-07 22:02:36,001 [1] DEBUG WHConsult.Utils.Settings.IniFiles.IniSettingsController - GetValue fileType:Settings section:Picoscope settingName:OutputChannel
2019-03-07 22:02:36,006 [1] DEBUG WHConsult.Utils.Settings.IniFiles.IniSettingsController - GetInifile fileType:Settings
2019-03-07 22:02:36,010 [1] DEBUG WHConsult.Utils.Settings.IniFiles.IniSettingsManager - GetStringValue: SettingName:OutputAttenuation DefaultValue:X1
2019-03-07 22:02:36,016 [1] DEBUG WHConsult.Utils.Settings.IniFiles.IniSettingsController - GetValue fileType:Settings section:Picoscope settingName:OutputAttenuation
2019-03-07 22:02:36,023 [1] DEBUG WHConsult.Utils.Settings.IniFiles.IniSettingsController - GetInifile fileType:Settings
2019-03-07 22:02:36,030 [1] DEBUG WHConsult.Utils.Settings.IniFiles.IniSettingsManager - GetStringValue: SettingName:OutputCoupling DefaultValue:DC
2019-03-07 22:02:36,039 [1] DEBUG WHConsult.Utils.Settings.IniFiles.IniSettingsController - GetValue fileType:Settings section:Picoscope settingName:OutputCoupling
2019-03-07 22:02:36,046 [1] DEBUG WHConsult.Utils.Settings.IniFiles.IniSettingsController - GetInifile fileType:Settings
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
Can you try to copy the app to your local C-drive with a short pathname and execute it from there?
 

Offline Evodad

  • Contributor
  • Posts: 21
  • Country: se
Sorry if a confused you.

The file was orginaly: log4net.log, this did not work to post so I changed it to log4net.log.txt
This did not work either so I took log4net.log.txt and Zipped the file to log4net.log.txt.ZIP
and changed the .ZIP with .txt to log4net.log.txt.txt.

So to go back, change from .txt to .ZIP and then you should have your file after Unzipping.

)) Kind regards, Per
« Last Edit: April 21, 2019, 12:08:44 pm by Evodad »
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
Ok, now I could open the log, but it seems like the log is not from the time the app crashed (the app was opened again afterwards, so more info was added to the log).

I have added some more code to log better were I think the crash occurs. Can you please run the attached version, and copy the log to here directly after the app crash occurred?

Did you try to run the app from the C-drive directly?
 

Offline Evodad

  • Contributor
  • Posts: 21
  • Country: se
This should do it I hope, booth from 1008 and 1009. Just Zipped this time :)

Running it from the C-drive didn't make a difference.

)) Per
« Last Edit: April 22, 2019, 07:33:48 am by Evodad »
 

Offline Hans Polak

  • Contributor
  • Posts: 39
  • Country: nl
Wim,

Thanks for the wonderful job you did, especially with the cursor and using FRA4PS as input works fine for me.
I have a point to mention.
In the image showing the impedance, the program also shows a phase. However this is the phase that belongs to the Gain.
In the Image below I show the difference phase that belongs to the impedance.

Hans
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
This should do it I hope, booth from 1008 and 1009. Just Zipped this time :)

Running it from the C-drive didn't make a difference.

)) Per

Seems to be related to a 32-bit vs 64-bit conflict when calling the DLL from FRA4Picoscope. I suspect your running on x64, can you try if you can run the attached version, or experiment with running the exe in compatability mode.

According to this (https://bitbucket.org/hexamer/fra4picoscope/wiki/Home), currently only 32-bit is supported (I am running still 32-bit, so this could be the reason).

 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
Wim,

Thanks for the wonderful job you did, especially with the cursor and using FRA4PS as input works fine for me.
I have a point to mention.
In the image showing the impedance, the program also shows a phase. However this is the phase that belongs to the Gain.
In the Image below I show the difference phase that belongs to the impedance.

Hans

Thanks for spotting this  :-+. Corrected version is attached to first post. In the calculations I always used the phase in radians (which was correct), but converted to degrees from the measured phase instead of the phase from the DUT, exactly like you said.
 

Offline Hans Polak

  • Contributor
  • Posts: 39
  • Country: nl
Yep, it's working all right.

Hans
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
Yep, it's working all right.

Hans

Great! Hopefully in the next couple of months I will have some more time to add features like calibration and calculation...
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
Hi Wim,

I have used FRA4 quite a lot on and of since it was released. So yours is a really nice contribution to the tools for Picoscope,
expanding on the usability !

As for Hans in the Previous post I can't get the included measurement application to work. See attached file.

I think I found a solution for the X64 problem. Updated version in first post.
 

Offline Hans Polak

  • Contributor
  • Posts: 39
  • Country: nl
It works like a charm, nice with this extra settling time and overlaying measurements on top of each other, great job.
The only very very small thing is that you have to start measuring twice.
The first time it contacts the Picoscope and after that you have to press measure again, not very important.

Hans

 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
The only very very small thing is that you have to start measuring twice.
The first time it contacts the Picoscope and after that you have to press measure again, not very important.

Next to the button "abort measurement" you have the option to leave the picocontrol screen open. This way you only need a single mouseclick for each measurement (I guess this is what you want).
 

Offline Hans Polak

  • Contributor
  • Posts: 39
  • Country: nl
Wim,
I still noticed a small anomaly. In the Modulus diagram, now having the correct phase, the cursor below the image still gives the phase of the bode diagram.

Then I have a few suggestions concerning noise fighting in noisy pictures, although I have no idea whether or in what way noise fighting is already part of your software Tool.
1) the most simple step would be when testing up to a frequency A, to limit BW of both channels to a BW of 5A or something like that.
The scope's BW in my case of 100mHz, has a noise of 100uV.
When measuring up to 100kHz, BW could be limited to 500kHz, already giving a possible noise reduction of 23dB.
2) Since it is possible to "overlay" several measurements in your program, it would help to reduce noise when they could be averaged.

Kindest regards,
Hans
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
I still noticed a small anomaly. In the Modulus diagram, now having the correct phase, the cursor below the image still gives the phase of the bode diagram.
 
Thanks for spotting this (again). Updated version in first post.

1) the most simple step would be when testing up to a frequency A, to limit BW of both channels to a BW of 5A or something like that.
The scope's BW in my case of 100mHz, has a noise of 100uV.
When measuring up to 100kHz, BW could be limited to 500kHz, already giving a possible noise reduction of 23dB.
 
I directly use the DLL from FRA4Picoscope, and get gain and phase results directly. A good discussion on the noise improvement for FRA4Picoscope can be found here:
https://www.picotech.com/support/topic14311.html?&start=390

2) Since it is possible to "overlay" several measurements in your program, it would help to reduce noise when they could be averaged.
 
Yes, this is on my todo list, but a little more work than simple bug fixes, and currently not so much spare time and too many other projects.

 

Offline Hans Polak

  • Contributor
  • Posts: 39
  • Country: nl
Wim,
Thank you for the link. As I found out, there are several paramaters that can be used to reduce noise, that was very helpful.

If have another suggestion. In your Reactance plots, you are using positive and negative values, just as they are calculated.
In all Network Vector analyzers and in Spice, the absolute value of these imaginary numbers are displayed, giving the  image almost twice the resolution and a sharp transition at the point of Fres, also quite useful.
See attachment as an example.

Hans
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
Wim,
Thank you for the link. As I found out, there are several paramaters that can be used to reduce noise, that was very helpful.

If have another suggestion. In your Reactance plots, you are using positive and negative values, just as they are calculated.
In all Network Vector analyzers and in Spice, the absolute value of these imaginary numbers are displayed, giving the  image almost twice the resolution and a sharp transition at the point of Fres, also quite useful.
See attachment as an example.

Hans

Thanks for this suggestion, I was not aware it is commonly done different (have yet to find an affordable VNA). I will implement this in the next version.
 

Online 2N3055

  • Super Contributor
  • ***
  • Posts: 6453
  • Country: hr
I think reactance sign is also very useful.
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
If have another suggestion. In your Reactance plots, you are using positive and negative values, just as they are calculated.
In all Network Vector analyzers and in Spice, the absolute value of these imaginary numbers are displayed, giving the  image almost twice the resolution and a sharp transition at the point of Fres, also quite useful.
 

I think reactance sign is also very useful.

I have added a “preferences” window under the edit menu, this way the user can choose the plot options (I expect some more options will come in the future). So both can have it your way  ;)

As always, updated version in first post.
 
The following users thanked this post: 2N3055

Online 2N3055

  • Super Contributor
  • ***
  • Posts: 6453
  • Country: hr
If have another suggestion. In your Reactance plots, you are using positive and negative values, just as they are calculated.
In all Network Vector analyzers and in Spice, the absolute value of these imaginary numbers are displayed, giving the  image almost twice the resolution and a sharp transition at the point of Fres, also quite useful.
 

I think reactance sign is also very useful.

I have added a “preferences” window under the edit menu, this way the user can choose the plot options (I expect some more options will come in the future). So both can have it your way  ;)

As always, updated version in first post.

You're just awesome!!

All the best,
Sinisa
 

Offline Hans Polak

  • Contributor
  • Posts: 39
  • Country: nl
Absolutely perfect addition with the positive reactance.
Thank you.

Hans
 

Offline apate26

  • Newbie
  • Posts: 2
  • Country: us
Hello Wim
 Thanks for the help but I don't see any installation or upload option, How can I use this? Where should I upload the excel files to see the graphs as you showed?
Thanks
Avi
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
Hello Wim
 Thanks for the help but I don't see any installation or upload option, How can I use this? Where should I upload the excel files to see the graphs as you showed?
Thanks
Avi

First post of this thread contains the files for download. Program does not need installation, running the executable is all that is required.
 

Offline KlausKragelund

  • Contributor
  • Posts: 33
  • Country: dk
Hi

Great tool. Been trying a couple of components out, works fine. But it has problems with range due to the fixed reference resistor

Have you considered if one added a USB controlled relay board to switch in different reference resistors over the range?

Regards

Klaus
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
Considered, yes. But because I did not need this often, never implemented that. Also, it would then require others users to make the same hardware,  which I consider a disadvantage also.

It has been a long time since I even looked at this. As with many of my projects, at some point other interesting subject takes over before a project is really finished (I intended to allow for some calibration routines also, but never got around doing that).

Currently no further development is planned, but maybe someday. All source code is available however, so feel free to add or modify as much as you want.
 

Offline Hans Polak

  • Contributor
  • Posts: 39
  • Country: nl
Hi Wim,

I'm using your excellent FRA Imp Viewer quite a bit.
I still  have a wish high on my list.
When starting the program, the value of the series resistor has to be specified.
However there are also probe tips attached to both sided of this resistor.
The A channel side plays no role, but the probe's capacity on the B channel becomes part of the network and interferes with the measurement.
That's why I always have to go to LTSpice trying to simulate a circuit giving the same characteristics including the capacity of the probe tip, to finally remove this capacity and get the real data for the DUT.
You can imagine that that's quite a job.
So it would be great if your program not only asked for the series resistor, but also for the capacity of the Channel B probe.

Kindest regards,
Hans
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
Hi Wim,

I'm using your excellent FRA Imp Viewer quite a bit.
I still  have a wish high on my list.
When starting the program, the value of the series resistor has to be specified.
However there are also probe tips attached to both sided of this resistor.
The A channel side plays no role, but the probe's capacity on the B channel becomes part of the network and interferes with the measurement.
That's why I always have to go to LTSpice trying to simulate a circuit giving the same characteristics including the capacity of the probe tip, to finally remove this capacity and get the real data for the DUT.
You can imagine that that's quite a job.
So it would be great if your program not only asked for the series resistor, but also for the capacity of the Channel B probe.

Kindest regards,
Hans

Hi Hans,

To do something useful with the input capacitance, I would also need the calibration calculations (which are currently not included in the current version of the software, I never got around doing that). This would require a major update, which is currently not planned.

Source code is however available, and visual studio can be downloaded for free. So it should be feasible to implement this change yourselves. If you have questions about parts of the source code, you can post them here, I will try to help you further, but for the moment, I will not be making any big changes myself.

Best Regards,

Wim

 

Offline Hans Polak

  • Contributor
  • Posts: 39
  • Country: nl
Hi Wim,

Thanks for replying so rapidly.
Two questions:

1) What do you mean with calibrations calculations. Would this be to assess the load of the probe and to verify the value of the used measuring resistor ?
I won't need all this.

2) Since I'm not a programmer would it help when I provide you with the math, where the probe's capacity is now also part of the equation, to calculate the DUT's exact impedance, inductance and capacitance ?

Kindest Regards,
Hans
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
1) What do you mean with calibrations calculations. Would this be to assess the load of the probe and to verify the value of the used measuring resistor ?
I won't need all this.

Yes, this is what I meant

2) Since I'm not a programmer would it help when I provide you with the math, where the probe's capacity is now also part of the equation, to calculate the DUT's exact impedance, inductance and capacitance ?

That might be an option, but no promises. This thread describes what is currently in the code:
https://www.eevblog.com/forum/testgear/rlc-impedance-viewer-for-picoscope-bode-plot-data/msg2238570/#msg2238570

The actual part of the code that does the calculations is here:
https://github.com/WimHuyghe/FRA-Impedance-Viewer/blob/master/FRA_IMP/FRAResult.cs

It should be fairly readable even for a non programmer. Please that this into account when describing the update in the math. Adding an additional input parameter to the GUI is no issue for me, so that can be done easily.
« Last Edit: May 10, 2021, 06:42:40 pm by _Wim_ »
 

Offline Hans Polak

  • Contributor
  • Posts: 39
  • Country: nl
O.K. I'll provide the math, then we see what can be done.

Regards,
Hans
 

Offline Hans Polak

  • Contributor
  • Posts: 39
  • Country: nl
Wim,
Before going into mathematical detail, may I ask you how many bits are used from Picoscope's options.
My Picoscope 5243B has various bit depth settings from 8 bits to 16 bits.
I don't know whether this is an option that your software can influence, bit more bits will of course result in more accurate results, especially when calculating a capacity.

Hans
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
Wim,
Before going into mathematical detail, may I ask you how many bits are used from Picoscope's options.
My Picoscope 5243B has various bit depth settings from 8 bits to 16 bits.
I don't know whether this is an option that your software can influence, bit more bits will of course result in more accurate results, especially when calculating a capacity.

Hans

My software uses the data obtained from FRA, I would need to check his source code. But I would guess max resolution is used, but I am not sure.
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
 I will have a closer look at this this weekend
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
Wim,
Before going into mathematical detail, may I ask you how many bits are used from Picoscope's options.
My Picoscope 5243B has various bit depth settings from 8 bits to 16 bits.
I don't know whether this is an option that your software can influence, bit more bits will of course result in more accurate results, especially when calculating a capacity.

Hans

Yes, maximum resolution is used => 15 bit for a 5000 series scope (see https://www.picotech.com/support/topic14311-180.html near the bottom). In the newest version of FRA4Picoscope a new API is implemented where this can be changed.

The API I am using always uses the highest resolution possible (which for this use case is ok I think)
 

Offline Hans Polak

  • Contributor
  • Posts: 39
  • Country: nl
Wim,
Working on the math, I ran into something strange.
Using the same .csv file for FRA Imp Viewer and Excel, where I had the math worked out, I got exactly the same shape for the inductance including all jaggies, but the values in my graph are roughly 1.5 times larger ?
The capacitance on the other hand is completely different, where FRA Imp Viewer seems to be wrong.
What I used was a 100R series resistor  and for the DUT another 100R resistor parallel to 10nF.
In the Excel version the 10nF is visible from 10kHz to 1Mhz

Hans


 

Offline Hans Polak

  • Contributor
  • Posts: 39
  • Country: nl
Wim,
Forget the inductance issue, error from my side.
Capacity is still wrong.

Hans
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
Do you see the same effect when you measure an actual capacitor?
 

Offline Hans Polak

  • Contributor
  • Posts: 39
  • Country: nl
I did measure an actual capacitor.
As mentioned, Serie resistor R=100R, and Dut composed of 100R//10nF.
The .csv file generated with these 3 components was processed by FRA Imp Viewer and separately calculated by Excel as : C=[Im[(1-V)/V)]/(W*R), were V is the complex voltage derived from the .CSV file and W=2*Pi*Freq.
When V=A+jB, where A=Gain*Cos(phase) and B=Gain*Sin(phase), then C=[B/(A^2+B^2)]/(W*R)

Hans
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
Hmmm, that does seem indeed strange in that case. I will run a few tests comparing the result of FRA Imp with the analog discovery I have been using instead since I bought one.
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
it seems to be a conflict between x64 and x86 build. When I run from visual studio in x86 build mode I do not get this issue.

Attached is an x86 build (which also runs fine on my x64 machine) that does not seem to have the issue (same source code!  :rant:)


=> that does not solve it completely, but when measuring a capacitor only (without parallel resistor) the x64 version was not ok also. But with the parallel resistor results still seem off.
« Last Edit: May 13, 2021, 06:23:02 am by _Wim_ »
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
Found it. The issue is that my calculations are for series capacitance and resistance, and your calculations are for parallel capacitance and resistance.

Ideally, both modes should be supported (this is typically done on LCR meters)
« Last Edit: May 13, 2021, 07:50:27 am by _Wim_ »
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
I have done now a run with the 100 ohm and 22nf (did not have a 10nF) is series, and the FRA IMP gives the correct results.
 

Offline Hans Polak

  • Contributor
  • Posts: 39
  • Country: nl
Wim,
I don't know how you calculate the capacitance, but for a DUT it is unknown whether a capacitance is in series or in parallel.
But indeed, when using a 10nF+100R in series, FRA Imp Viewer is doing a proper job ?
The algorithm that I use calculates the capacitance of the DUT no matter where this cap is located and gives the right answer for a certain freq band.
See images below for 100R+10nF in parallel and 100R+10nF in series.

Hans
 
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
I don't know how you calculate the capacitance, but for a DUT it is unknown whether a capacitance is in series or in parallel.

I use what I think is called the I-V method (see here: https://www.eevblog.com/forum/testgear/rlc-impedance-viewer-for-picoscope-bode-plot-data/msg2238570/#msg2238570)

If I compare the 100 ohm || 22 nF measurement with the result I get using the analog discovery in "series" capacitance mode (Cs), the results my app get are very similar. The analog discovery also has parallel capacitance mode, which gives your result. So I do think the way it is currently implemented is also a correct way, although there are probably several ways to do it. 

My older HP LCR meter cannot test the 100 ohm + 22nF is series (gives no reading, I get only a result in parallel mode), so I cannot compare with that one.
« Last Edit: May 13, 2021, 12:11:25 pm by _Wim_ »
 
The following users thanked this post: 2N3055

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
Result using my app (only series mode available)
 

Offline Hans Polak

  • Contributor
  • Posts: 39
  • Country: nl
Wim,
Thanks for explaining.
My point is that you never know whether a DUT has a serial or a parallel cap.
So making a choice between series or parallel can both be wrong when several caps at different places are part of the DUT.
Nevertheless I will have a look at your math, that seems a bit complicated.

After all, with channel A as reference and Channel B after series resistor R as the point to measure gain and phase, B=A*Z/(Z+R)
Assuming both channels are normalised to A=1, you get B=Z/(Z+R) or Z=R*B/(1-B)
B being a complex signal, whose Re and Im parts can be calculated with the measured phase, you get all the data you want.
So because we used different ways for calculation, I will try to find out at what point they differ, that will make the discussion easier.

Hans
 
The following users thanked this post: 2N3055

Offline Hans Polak

  • Contributor
  • Posts: 39
  • Country: nl
I know what's wrong, and this has nothing to do with serial or parallel caps.

Let's assume Z = A+jB (so this already includes the serial resistor R)

Resr = Re(Z) = A
JwL= im(Z) = jB , so L=B/w
Impedance = sqrt(A^2+B^2)

So far that's what you did and that's all O.K
But now for the cap, where you used:

1/jwC = Im(Z) = jB, so wC=1/B and C=1/Bw
And that's wrong, let me explain

if 1/jwC=A+jB, then jwC = Im(1/(A+jB)) = Im (A-jB)/[(A+jB)*(A-jB)] = Im(A-jB)/(A^2+B^2) = jB/(A^2+B^2)
C = [B/(A^2+B^2)]/w
Quite a difference from the 1/B*w that you are using.

This the correct way to calculate C.

Hans
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
Hi Hans,

I am not following your explanation why the result is wrong, could you elaborate a bit more?

To be honest, I do not think the result is wrong, I think the difference is in the end goal we want to achieve. The calculation I have implemented is to find the equivalent series capacitance and equivalent series resistance for the DUT. The second calculation (that I have not implemented), would calculate the equivalent parallel capacitance and equivalent parallel resistance for the DUT. These should be 2 different results, and I think this is how it is commonly done for an LCR/impedance meter. This is also confirmed by the fact the analog discovery had a very similar result. Your suggestion that series/parallel can be calculated with the same equations does not seem logical to me (why else would almost every LCR meter have a separate mode for this)

I think your goal is to calculate the capacitor independent of the series / parallel resistor. But this does not characterize the DUT as a whole. With an extreme example of a capacitor with a 100 ohm resistor in parallel, the series mode is indeed useless but still correct (this did confuse me also however, I would have expected a more reasonable result). I should have implemented both modes when I was writing the app, but as my main goal for the app was to check capacitor quality at frequencies high than my HP could handle (tops out at 20kHz), series mode (aka ESR) was all I needed.

There are for sure many different ways to do all of this. Keysight has and impedance measurement handbook (https://www.keysight.com/be/en/assets/7018-06840/application-notes/5950-3000.pdf) that has probably sufficient info to build a really high end system, but I only stuck to the very basics.

Wim
 

Offline Hans Polak

  • Contributor
  • Posts: 39
  • Country: nl
Hi Wim,

What I tried to explain is that you cannot simply invert a complex number and still keep using the original imaginary part.
As I have shown, you have to rearrange the formula and split it again in real and imaginary.
You didn't do that, which is mathematically wrong.
The result B/(A^2+B^2) instead of 1/B that you are using happens to be true for very small values of A, thus very small values of Resr, which is the case with a serial connection.

The formula that could fit parallel connections would then be for very small values of B, because in that case you will get B/A^2.
But in the images below you can see that in this B/A^2 only fits at very low frequencies, far below the 100Hz where the graph starts, whereas B/(A^2+B^2) does the job as expected.

So with the series connection 1/B happens to go well, but with the parallel connection 1/B fits very bad, in this very case there is only some overlapping above 1Mhz.
So this is just to say that there is no separate formula for parallel connections.
When you disagree, I would welcome that formula.

Maybe someone reading this correspondence who is fit in complex calculation can confirm my calculation.
My goal is to find the capacitance for an unknown circuitry and not for a single series cap. For that I can use my cap meter.

Hans
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
So this is just to say that there is no separate formula for parallel connections.
When you disagree, I would welcome that formula.
See page 6 for conversion between series and parallel capacitance.

http://www.componentsengineering.com/wp-content/uploads/pdfs/LCR-Measurement-Primer.pdf

What I tried to explain is that you cannot simply invert a complex number and still keep using the original imaginary part.
As I have shown, you have to rearrange the formula and split it again in real and imaginary.
You didn't do that, which is mathematically wrong.
The result B/(A^2+B^2) instead of 1/B that you are using happens to be true for very small values of A, thus very small values of Resr, which is the case with a serial connection.

The attached figure shows I think best why this is done. When we express Z_DUT in 2 ways:
  Z_DUT = Resr            – j / (2*π* f*C)
  Z_DUT = Zmag* cosα + j* Zmag*sinα

From this we see that
  Resr = Zmag * cosa
 -1  / (2*π* f*C) = Zmag * sina

=> both are not complex numbers any longer, and all calculations are done in an algebraic way.

Edit: forgot to add the minus sign
« Last Edit: May 14, 2021, 08:46:10 am by _Wim_ »
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
An important paragraph why we should not expect the values to be the same
 

Offline Hans Polak

  • Contributor
  • Posts: 39
  • Country: nl
Wim,
I think we should leave the subject, because we are not coming together as it seems.
When 1/jwC=A+JB, it is mathematically wrong to conclude that jwC=1/jB, because one j is in the numerator and the other j is in the denominator.
Correct is: jwC= IM(1/(A+JB). Solving this leads to wC=B/(A^2+B^2).
And as mentioned, for very small values of A as in serial connections, this becomes the 1/B that FRA Imp Viewer uses.

But after this all, here's a really positive thing that I would like to mention, which is the calibration.
I asked you a few days ago to possibly include the probe's capacity in the calculation, but I found a much better way, making this question completely  obsolete.
With FRA4PS I record the chain without a DUT, but of course with the necessary measuring probes in place. Ideally this should give a flat Bode diagram with phase permanently at zero degrees.
Look at the first image below how the Bode diagram looks in my case.
And altough this doesn't look to bad, only 0.06dB and 6 degrees removed from the ideal, the effect of this can be quite massive as we will see.

Now store this Bode diagram as a .csv file, open it in Excel and make a second set with Log Freq, -1*Gain in dB  and -1*Phase.
This second set will be your future correction set.
To show the effect, I took a 1x probe as a DUT.
Without any correction, results are shown in the second image.
But when correcting this recording in Excel by adding the gain in dB and phase of the correction set, the now corrected data produces quite a different plot, see the the third image.
So this is way more accurate than just specifying the capacity of the measuring probe.
What you see are resp. Impedance, Resr and two plots for the Capacity, one is using 1/B as in FRA and the second using B/(A^2+B^2),  [with A and B being resp. the RE and IM part of Z].
Result is very good after correctio,  isn't it.

Hans


 

Offline Hans Polak

  • Contributor
  • Posts: 39
  • Country: nl
P.S. I forgot to mention that this correction was with the 100R series resistor that I used.
For other resistors, a new correction file should be made.

Hans
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
I think we should leave the subject, because we are not coming together as it seems.

Hi Hans, I would rather come to a conclusion, as now we have created doubt whether the results are correct or not. If incorrect, I will make the modification, but until now I am not convinced it is the case. Hopefully some other members here can share their opinion also.

Look at the first image below how the Bode diagram looks in my case.
And altough this doesn't look to bad, only 0.06dB and 6 degrees removed from the ideal, the effect of this can be quite massive as we will see.

Now store this Bode diagram as a .csv file, open it in Excel and make a second set with Log Freq, -1*Gain in dB  and -1*Phase.
This second set will be your future correction set.
To show the effect, I took a 1x probe as a DUT.
Without any correction, results are shown in the second image.
But when correcting this recording in Excel by adding the gain in dB and phase of the correction set, the now corrected data produces quite a different plot, see the the third image.
So this is way more accurate than just specifying the capacity of the measuring probe.
What you see are resp. Impedance, Resr and two plots for the Capacity, one is using 1/B as in FRA and the second using B/(A^2+B^2),  [with A and B being resp. the RE and IM part of Z].
Result is very good after correctio,  isn't it.

Hans

I you read the beginning of this thread, this is how I initially saw the calibration also. But after reading a bit more on the subject, I somehow convinced myself this was not fully correct, however I am not sure of this. Did you check if this also works ok with a complex DUT? Typically LCR meters do both an open and a short calibration to correct for errors.
 

Offline Hans Polak

  • Contributor
  • Posts: 39
  • Country: nl
Wim,
When you propose a complex DUT, composed out of various components, I can solder this together and show the results without and with correction.
I'm looking forward to do this test.

Hans
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
Wim,
When you propose a complex DUT, composed out of various components, I can solder this together and show the results without and with correction.
I'm looking forward to do this test.

Hans

Hi Hans,

To test the calibration routine, I would do the following:
1) run the calibration routine, and measure a complex load => this give you the reference waveform of the complex load
2) "modify" your scope input channel by adding a parallel capacitor [and series capacitor bypassed by a resistor] [=optional]
3) run the calibration routine again with the "modified" scope input, and remeasure the same complex load
4) ideally the measurement result should be equal to your reference waveform.

 

Offline Hans Polak

  • Contributor
  • Posts: 39
  • Country: nl
Hi Wim,

As I understand your proposal,

Make cal. file 1 with only the scope probe attached.
Measure a complex load and correct it with cal. file 1.
Make a new cal. file 2, now with an added cap over the probe.
Measure the same complex load again but now with the added cap and correct the result with cal. file 2.
Corrected result for the complex load should be the same in both cases.

That's easy to perform, and I will certainly do, but before doing that two questions:
1) Is there a reason why you attached an image of a probe, or do you suggest this to be used as a complex load 
2) what capacity do you suggest to place in par. to the probe for cal. file 2 ?

Hans
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
As I understand your proposal,
Make cal. file 1 with only the scope probe attached.
Measure a complex load and correct it with cal. file 1.
Make a new cal. file 2, now with an added cap over the probe.
Measure the same complex load again but now with the added cap and correct the result with cal. file 2.
Corrected result for the complex load should be the same in both cases.
Yes, indeed.

1) Is there a reason why you attached an image of a probe, or do you suggest this to be used as a complex load
=> was just to give an idea on how an probe and input looks to give an idea about the values to make a modified "bad" input

2) what capacity do you suggest to place in par. to the probe for cal. file 2 ?
=> I would take something like 47pf or maybe up to a 100pf. This will already limit HF response quite severely. For the optional series resistance I would think something like 100k and and 100pf.
 

Offline Hans Polak

  • Contributor
  • Posts: 39
  • Country: nl
Hi Wim

O.k. I'll place a 75pF cap par to the probe to produce cal. file 2.

The optional 100K + 100pF that you mention, is that meant to be placed par. to the probe (instead of the above mentioned 75pF ?) to generate a cal. file 3 and if so, the two in series or in parallel.

And still open is the question: how should the DUT look like, or is that the 100K + 100pF ?

Hans
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
Hi Wim

O.k. I'll place a 75pF cap par to the probe to produce cal. file 2.

The optional 100K + 100pF that you mention, is that meant to be placed par. to the probe (instead of the above mentioned 75pF ?) to generate a cal. file 3 and if so, the two in series or in parallel.

And still open is the question: how should the DUT look like, or is that the 100K + 100pF ?

Hans

The optional 100K + 100pf is to create a high pass characteristic. Together with the parallel cap, this should create a response with:
- some loss of gain due to the 100K series resistor (acts as a voltage divider with the 1M input impedance to the scope)
- for higher frequencies, the 100K is bypassed by the parallel cap, increasing the gain again
- for very high frequencies, we have again a loss in gain due to the parallel input cap.

This should create a non flat response to challenge the calibration logic. I would start however with only the parallel input cap.

For a load I would just a parallel LC network with a series resistor, just to have both some inductive & capacitive behavior. Values are not very critical, I would just ensure that you have some non-flat parts in the zone where the calibration correction is the largest (to challenge the correction).
 

Offline Hans Polak

  • Contributor
  • Posts: 39
  • Country: nl
Hi Wim,

I'm extremely sorry, but I have some other bad news.
So far I only concentrated on the capacitance calculations of FRA Imp Viewer.
But now being busy with calibration and so on, I found more that's not O.K.

Still with a 100R reference resistor, and as load 100R+10nF in series, I took FRA's inductance image, having on the right side the ESR.
At 100Hz, the 10nF still has a large impedance, so most of Resr comes from the probe, but the FRA image shows -50R at 100Hz.
To my opinion, Resr can never become negative and a value of 50R seems impossible altogether.
In the Excel Image below, Re is as expected, positive and 45K at 100Hz.

Then the Inductance shows 250H in FRA at 100Hz, where Excel using the same .csv file shows 22H at 100Hz.
As from 1kHz and upwards, FRA and Excel are the same within 10%.

At least ESR has some miscalculation, which could be the cause of the wrong inductance value, but maybe there's more.

Hans


 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
Hi Wim,

I'm extremely sorry, but I have some other bad news.
So far I only concentrated on the capacitance calculations of FRA Imp Viewer.
But now being busy with calibration and so on, I found more that's not O.K.

Still with a 100R reference resistor, and as load 100R+10nF in series, I took FRA's inductance image, having on the right side the ESR.
At 100Hz, the 10nF still has a large impedance, so most of Resr comes from the probe, but the FRA image shows -50R at 100Hz.
To my opinion, Resr can never become negative and a value of 50R seems impossible altogether.
In the Excel Image below, Re is as expected, positive and 45K at 100Hz.

Then the Inductance shows 250H in FRA at 100Hz, where Excel using the same .csv file shows 22H at 100Hz.
As from 1kHz and upwards, FRA and Excel are the same within 10%.

At least ESR has some miscalculation, which could be the cause of the wrong inductance value, but maybe there's more.

Hans

If you put a 10nF capacitor in series with 100 ohm, you create a high pass filter with a 159kHz -3db point. Each octave lower will be another -6db.  You loose another 7-8 db by the voltage divider created by the two 100 ohm resistors and the 50 ohm resistor in the signal generator. Counting all of these losses up you end up in the noise floor of your scope (in other words, for the scope your DUT is an open circuit at these low frequencies).

As your scope channels are not perfectly identical and have some bias offset, the current "measured" through the reference resistor can be negative (as this current is measured by the difference between channel 1 and channel 2), and all sort of strange things can also happen in the noise. Your csv file show a positive gain at lower frequencies (+0.018 db, which means the signal measured on the DUT is LARGER then the signal put into the reference resistor => this can only be via bias offset differences in an open circuit situation, as this is impossible for a passive device)
You will probably see a similar result by measuring an open circuit.

I have no idea what you have done in your excel to handle negative currents (positive gains), in the case of my app I limited the gain to zero (see "GainCorrectedDB" function). A more clear solution would be to plot no data at all when the gain is positive, but having a smooth continuous curve like in your excel is even more confusing (I presume you somewhere use an "absolute value" function to circumvent this issue).


« Last Edit: May 15, 2021, 07:16:14 pm by _Wim_ »
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
If you look at the gain of the CSV you posted, you can see that somewhere just before 10-15kHz the scope runs out of resolution. To measure your DUT in these lower frequencies, the reference resistor should be much larger to give the system again the change to see variations in gain. 
 

Offline Hans Polak

  • Contributor
  • Posts: 39
  • Country: nl
Wim,

I appreciate very much that you are still communicating after so many points I brought forward with results that deviate from what was to be expected.
Your program has a wonderful graphical interface, that's the reason I like to use it.
In Excel I have all the formulas to calculate the same, but with very simple graphical options.
But at the end no matter where the calculations are taking place, results should be 100% identical, which they are not.
When leaving the capacity calculation as a separate issue, I would have expected no difference in Resr, Inductance and impedance.

No offense, but if I may say so, the used way of calculating is rather complicated with additional current and a second phase that I haven't checked because calculation can be done much simpler with less chance of making mistakes, see calculation below.

The fact that my Excel shows different graphs based on one and the same .CSV file says that one of both must be wrong.
So here is the Math that I have checked over and over.


 
 
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
Hi Hans,

No offence taken. For me your calculation looks more complex, but that is probably because we both spent more time on our own method or due to different backgrounds.  ;)

I found this webpage from Tektronix which also uses the I-V method and matches very closely with what I have done:

https://uk.tek.com/document/application-note/capacitance-and-inductance-measurements-using-oscilloscope-and-function-ge

I especially like the piece posted below  ;D

As to the difference in results, in your last measurement the DUT acts as an amplifier (positive gain). It is no surprise for me that in that case different calculation strategies lead to different results, as there exist is no passive device combination that can work as an amplifier (when talking about RLC-components). So whatever formula's used to calculate the equivalent set of RLC-components, the only correct result should be "not possible", and any numbers that are spit out should be ignored.  Compared these numbers for "correctness" does not make sense.

One interesting point of the Tektronix article, if you look at equation 1, this would place the maximum achievable accuracy at 0.5% for a Picoscope 5000 series. Not bad. A top of the line Keysight impedance analyzer (https://www.keysight.com/be/en/product/E4990A/impedance-analyzer-20-hz-10-20-30-50-120-mhz.html) does "only" 10-times better.  :)
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
No offense, but if I may say so, the used way of calculating is rather complicated with additional current and a second phase that I haven't checked because calculation can be done much simpler with less chance of making mistakes, see calculation below.

Looking at your calculation, I think you did oversimply a bit. You consider the measured phase as the phase of the capacitor/inductor, but the measured phase is the phase of the current through the reference resistor only. For purely capacitive or inductive loads the phase of the current will be identical, but the difference gets larger for combined loads.
« Last Edit: May 16, 2021, 08:32:13 am by _Wim_ »
 

Offline Hans Polak

  • Contributor
  • Posts: 39
  • Country: nl
Hi Wim,

I don't get what you mean with the phase.
The only reason there is a phase shift in the first place is because the DUT (and the probe) are causing this.
But I will dive into the Tektronix calculation and see what it brings.
No matter what roads are taken to calculate the characteristics of a DUT, the outcome should be 100% the same.
It's not the calculation that determines the properties, but the only DUT.
When trying to achieve the same result, one of both must be wrong, but I'm sure we will find out.

As a control system in the background, we can also use LTSpice, because with 3 simple commands it calculates:
L = IM(Rref*(V2/(V1-V2))/w)
Resr=Re(Rref*(V2/(V1-V2)))
Imp=Mag(Rref*(V2/(V1-V2)))

Hans

P.S. I saw in the above shown calculation that I forgot to include R* in the imaginary part E. But in my Excel this is correct.
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
Hi Hans,

This is the general principle I followed (and also in the Tektronix article)

The only info we have is the voltage & phase at point A1 and A2 in the Tektronix figure. For A1 we set the phase to 0°, for A2 we use the phase FRA reports. From these 2 voltage vectors, the current vector can be calculated because Rref in known. We also know this current has to go through the DUT.

By using ohms law and knowing both the current vector and voltage vector in A2, we can calculate the impedance of the DUT.  From there I think our calculation methods agree to extract ESR, Capacitance and inductance from the impedance.

Hope this clarification helps.
 

 

Offline Hans Polak

  • Contributor
  • Posts: 39
  • Country: nl
Hi Wim,

Step one.
I did the math my way with all the figures from the Tektronix article, and got the exact same figures as they did.

Hans
 

Offline Hans Polak

  • Contributor
  • Posts: 39
  • Country: nl
Second test now with 10mH.
Again, exactly the same figures as Tektronix.

Hans
 

Offline Hans Polak

  • Contributor
  • Posts: 39
  • Country: nl
Wim,

For completeness, here's the Excel file that I used for the above calculations.

Hans
 

Offline Hans Polak

  • Contributor
  • Posts: 39
  • Country: nl
Wim,
This is the test circuit I propose for testing the calibration with 1)probe alone and 2) probe +75pf
Can you agree with this ?

Hans

 

Offline Hans Polak

  • Contributor
  • Posts: 39
  • Country: nl
In the image at the left Rref is a symbolic 2200, but in the simulation plot at the right I used the correct value of 100R as can be seen in the topline above the plot.
 

Offline Hans Polak

  • Contributor
  • Posts: 39
  • Country: nl
Hi Wim,

Here are the first results, resp the LTSpice plot, the Excel plot uncalibrated and the third one calibrated for the used probe,
and finally the recorded .CSV  File disguised as txt file.

Hans

 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
Hi Wim,

Step one.
I did the math my way with all the figures from the Tektronix article, and got the exact same figures as they did.

Hans

That is no surprise as the load is almost purely capacitive or inductive. What do you get when running the same CSV data with from above (with the positive gain) using the Tektronix formula's? I would guess you also get a negative ESR like I did and not the plot you posted.

You will not get my complete plot as I limit the gain to max zero dB, but at least you should verify if your claim from above is correct that there is a fault in my ESR calculation.
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
Wim,
This is the test circuit I propose for testing the calibration with 1)probe alone and 2) probe +75pf
Can you agree with this ?

Hans

That looks ok to me
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
Hi Wim,

Here are the first results, resp the LTSpice plot, the Excel plot uncalibrated and the third one calibrated for the used probe,
and finally the recorded .CSV  File disguised as txt file.

Hans

I am not sure how I need to interpret these result. Is the just probe the result without the 75pF, the the calibrated the result with the 75pF cap & then calibrated? Can you post a plot where you see in one graph:

- DUT measured with no 75pf cap at scope input
- DUT measured with 75pf cap at scope input
- DUT measured with 75pf cap at scope input & with calibration correction implemented

1 & 3 should be identical in an ideal calibration situation, 2 should be different enough to see the calibration "working"
 

Offline Hans Polak

  • Contributor
  • Posts: 39
  • Country: nl
Wim,

1) You already have the results for measuring the DUT with probe, uncompensated and compensated,
Here are the results when adding a 68pF cap over the probe, first image uncompensated, second image compensated and third image both compensated versions on top of each other in the same image.
I suppose the two dips at 5Mhz in the compensated version are because of the inductance in the wires connecting the 68pF, but below 3Mhz, both compensated versions are exactly equal so I did not try to correct this.

2) I didn't understand your comment that you were not surprised,
I did both Tektronix tests for resp. 10uF and 1mF and got exactly the same results with my formulas.
You even got the Excel file that calculated these results.

The simulation with LTSpice also gave the exact same plot as my real life DUT measurement.
What else do you need as a prove that my formulas are correct ?

Hans
 

Offline Hans Polak

  • Contributor
  • Posts: 39
  • Country: nl
Hi Wim,

I have the impression that you still find it hard to believe that there's something wrong with your calculations.
That's why I have implemented the full Tektronix formulas from the link that you gave.
I ran two sessions, one with the DUT with 100R/1mH+38R/1nF, first image below.
The other one was with the 100R+10nF in series, where we had the discussion whether Resr could be -50R, see second image below,
I gave both models these two files:  model1 with my math , the other model2 with the Tektronix math.
I overlaid the outcome of both ways of calculation to clearly see the differences between the two.

Conclusion: For Imp, Resr and Induction, result is exactly the same as was to be expected.
Only the Capacity differs because of the reason I mentioned before, that when having j in the numerator and in the denominator, you can not simply put an equation upside down, as was also 100% confirmed in the LTSpice simulation.
But nevertheless, the plot produced using this simplification, seems quite useable so I can live with it.
Where Tektronix differs from my math, I have put a T in red on the plotted line.

One example of what is still not O.K. in your Imp Viewer is visible for the 100+10nF series giving Resr=-50R and the L=250H both at 100Hz, because as you see they have to be resp 43K an 22H, So it's not the math that is wrong, but something in your calculation goes aside.
Hope you can find it.

Hans
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
I have the impression that you still find it hard to believe that there's something wrong with your calculations.
That's why I have implemented the full Tektronix formulas from the link that you gave.
I ran two sessions, one with the DUT with 100R/1mH+38R/1nF, first image below.
The other one was with the 100R+10nF in series, where we had the discussion whether Resr could be -50R, see second image below,
I gave both models these two files:  model1 with my math , the other model2 with the Tektronix math.
I overlaid the outcome of both ways of calculation to clearly see the differences between the two.
Conclusion: For Imp, Resr and Induction, result is exactly the same as was to be expected.
Only the Capacity differs because of the reason I mentioned before, that when having j in the numerator and in the denominator, you can not simply put an equation upside down, as was also 100% confirmed in the LTSpice simulation.
But nevertheless, the plot produced using this simplification, seems quite useable so I can live with it.
Where Tektronix differs from my math, I have put a T in red on the plotted line.
 
Your impression is indeed correct. Below the Tektronix math vs mine (screenshots from post 32) To express the Tektronix formula’s in "gain", you only have to divide by Va1. When you do that you get EXACTLY the same formula. No mathematical simplification, the same.  If you see it otherwise, please point me to the difference.

The reason for the difference between your graph and the Tektronix one, is by not calculating for current first, as explained above. See the second term in equation 3 of Tektronix, this is the reason for your difference. If the measured phase goes to 90° (pure inductive or capacitive loads), the second term disappears and the data is the same. Also as explained above.

One example of what is still not O.K. in your Imp Viewer is visible for the 100+10nF series giving Resr=-50R and the L=250H both at 100Hz, because as you see they have to be resp 43K an 22H, So it's not the math that is wrong, but something in your calculation goes aside.
 

As also  explained above, I limit the gain to zero (so positive gains are removed), but you seem to insist to pick a part of the plot were the DUT was acting as an active device. This was a deliberate choice or mine, because otherwise plots can have a very large difference between min and max, causing the user to have to zoom in every time he wants to see the "interesting part" (because the part were the DUT acts an amplifier does not mean anything). 

That's why I have implemented the full Tektronix formulas from the link that you gave.
I ran two sessions, one with the DUT with 100R/1mH+38R/1nF, first image below.
The other one was with the 100R+10nF in series, where we had the discussion whether Resr could be -50R, see second image below,
I gave both models these two files:  model1 with my math , the other model2 with the Tektronix math.
I overlaid the outcome of both ways of calculation to clearly see the differences between the two.
 
Can you post your excel file? I would expect that ESR becomes negative where the DUT becomes an amplifier. The direction inversion in your plot seems strange to me as the measure profile is both smooth for phase and gain.
 

Offline Hans Polak

  • Contributor
  • Posts: 39
  • Country: nl
Hi Wim,

I must say, you are rather hard to convince, but anyhow, here is the Excel file. That should finally convince you as it follows exactly each step accordingly.
Used file is the 100R+10nF in series that you already have with Rref=100R
And as said, it's obviously not the math that is wrong, but there must be something going wrong in your calculation giving L=246H and Resr=50R at 100Hz instead of 21.6H and 43.8K, and there is more.

Hans


 
 

Offline Hans Polak

  • Contributor
  • Posts: 39
  • Country: nl
You mentioned to limit the gain to one.
That will indeed increase the value of L considerably (and influence the capacity) , but also the value of Resr will increase to ca 47K at 100Hz and higher.
So after all the things I have done so far, it seems fair to say that now it's your turn to tell what exactly it is that you do on top of calculating the formulas , that may help to explain part of the differences.

Hans
 

Offline Hans Polak

  • Contributor
  • Posts: 39
  • Country: nl
One last thing, here is the same file 100R+10nF but now compensated for the measuring probe with a calibration file.
That makes a visible difference, but although Resr is now a bit noisy at LF, it is still considerably above 10Khz.
I have attached both the image and the Excel file.

Hans


 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
And as said, it's obviously not the math that is wrong...

And as said, it's obviously not the math that is wrong  :-DD  :phew:

but there must be something going wrong in your calculation giving L=246H and Resr=50R at 100Hz instead of 21.6H and 43.8K, and there is more.

I wonder if it has some has something to do with the gain limit I already told you in post 104?
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
You mentioned to limit the gain to one.
That will indeed increase the value of L considerably (and influence the capacity) , but also the value of Resr will increase to ca 47K at 100Hz and higher.

I just checked your excel file and did two things:
- copied all the formula's from the first row down until the end (formula's in the first row where correct but they did not go all the way down)
- set all of the positive gains to zero

=> Resr goes to -50 ohms  and stays there.

But, you are using a logarithmic axis in Excel, and that does not plot negative numbers

So after all the things I have done so far, it seems fair to say that now it's your turn to tell what exactly it is that you do on top of calculating the formulas , that may help to explain part of the differences.

I only limited the gain to negative numbers as explained immediatly when you reported the problem. With the changes above in Excel you get the same results
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
One last thing, here is the same file 100R+10nF but now compensated for the measuring probe with a calibration file.
That makes a visible difference, but although Resr is now a bit noisy at LF, it is still considerably above 10Khz.
I have attached both the image and the Excel file.

Hans

To prevent repeating myself:

I am not sure how I need to interpret these result. Is the just probe the result without the 75pF, the the calibrated the result with the 75pF cap & then calibrated? Can you post a plot where you see in one graph:

- DUT measured with no 75pf cap at scope input
- DUT measured with 75pf cap at scope input
- DUT measured with 75pf cap at scope input & with calibration correction implemented

1 & 3 should be identical in an ideal calibration situation, 2 should be different enough to see the calibration "working"
 

Offline Hans Polak

  • Contributor
  • Posts: 39
  • Country: nl
Wim,

1) What an incriminating suggestion that the formulas in my Excel file were not pulled down and that only the first row was correct.

2) What a totally wrong decision to make all gain figures above 0dB zero, but leave the rest for what it is.
This results is a totally crippled plot giving that silly 50R for Resr in case of the file we were discussing.
There is nothing wrong with values above 0dB, it can be because of an LC resonance or a channel gain issue, but FRA Imp Viewer can never know  what the reason is.
In case of a channel gain difference, one thing the  user could do if it bothers is to subtract the same dB value from all samples, but a much better thing to do is to correct the file with the probe's calibration file.
Conclusion: FRA Imp Viewer is indeed willingly and totally superfluous corrupting files.

3) Keep repeating yourself when it's not obvious what I mean with file compensation with the Probe's calibration file. Everybody else will perfectly understand what this means.

It's obvious from the above that I'm done with you, the way you react is like stung by a bee and turning every discussion into an ordinary fight.

Hans
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
1) What an incriminating suggestion that the formulas in my Excel file were not pulled down and that only the first row was correct.
 
How do you explain than that I take your excel, add the CSV data with only negative gains, pull the formula’s down and get instantly the same numbers we have been arguing about for pages?

2) What a totally wrong decision to make all gain figures above 0dB zero, but leave the rest for what it is.
This results is a totally crippled plot giving that silly 50R for Resr in case of the file we were discussing.
There is nothing wrong with values above 0dB, it can be because of an LC resonance or a channel gain issue, but FRA Imp Viewer can never know  what the reason is.
In case of a channel gain difference, one thing the  user could do if it bothers is to subtract the same dB value from all samples, but a much better thing to do is to correct the file with the probe's calibration file.
Conclusion: FRA Imp Viewer is indeed willingly and totally superfluous corrupting files.
 
As explained this decision was made because it makes measuring single components like capacitors and inductors easier due to the gain approaching 1. I can agree that this way maybe not the best decision, but I told you immediately that this was done (and kept repeating it that this was the reason for the difference), yet you keep ignoring this and claiming my calculation was wrong.

3) Keep repeating yourself when it's not obvious what I mean with file compensation with the Probe's calibration file. Everybody else will perfectly understand what this means.
 

I somehow doubt that, but as explained for “me” to understand and know what I should add in my code and how it works, I needed the data in a certain way. For “me” it was not clear, and if you expect me to add your wishes to me application, I do feel I am entitles to ask for the data in a certain way…

It's obvious from the above that I'm done with you, the way you react is like stung by a bee and turning every discussion into an ordinary fight.
 

Hans, for several pages long you are claiming all sort of stuff is wrong with my app, and ignore my pointers completely to check your calculation. You make bold claims on how I do the mathematics wrong (which made me actually doubt what I have done and made spent quite a bit of time digging everything back up again, mathematics requires time & effort for me and is certainly not my preferred topic to spent my sparse free time on). When I can disprove one of your claims, you only keep finding new claims that “something” is wrong. (which would be still ok if you state that you see a difference, and are not sure who is correct, but you always state it as you are 100% sure it is me, and I have to find the proof it is not)

When I finally receive your Excel on which those claims are based, I only need to copy in the CVS data with gain set to zero, drag the formula’s down, and get exactly all the results I have with my app, while just before you claim to have done the same this with setting gain to zero, but still see differences:

You mentioned to limit the gain to one.
That will indeed increase the value of L considerably (and influence the capacity) , but also the value of Resr will increase to ca 47K at 100Hz and higher.
So after all the things I have done so far, it seems fair to say that now it's your turn to tell what exactly it is that you do on top of calculating the formulas , that may help to explain part of the differences.
 

For me this looked like you have all the data at your fingertips, yet it was up to me again to find proof. This was indeed very frustrating to me, hence me reaction.
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
Forgot to mentions one more thing, when I was checking your formula's you had an absolute value for both capacitance and inductance, which for me looked like you were fully aware a log plot in excel does not like negative numbers, yet made me look why ESR did not go negative in your plot...
 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
1) What an incriminating suggestion that the formulas in my Excel file were not pulled down and that only the first row was correct.

Somehow you made me doubt again that this was what actually happened, so I figured to redo what I have done before...

See formula bar to row1 and row2 or Resr. And this after we have been discussing about ESR negative or not  |O

 

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1514
  • Country: be
Re: LCR Impedance Viewer for Picoscope+Keysight+R&S Bode Plot Data (open source)
« Reply #133 on: September 12, 2021, 02:12:16 pm »
Due to a question in another thread (https://www.eevblog.com/forum/testgear/device-impedance-using-dso/) I wanted to run my app again, but it did not run any longer. I had updated recently to the latest version of "FRA for Picoscope", and it appears the FRA's API has changed, so a small update to my app was also required.

While I had the app open, I made 2 other small changes related to the discussion above:
- renamed the tabs to clearly indicate series capacitance & inductance are measured
- added the option to disable the positive gain limiting

As always, updated version added in the first post (version 1.014) To run this version, the latest version of "FRA for Picoscope" must be installed, which can be found here: https://bitbucket.org/hexamer/fra4picoscope/downloads/

For users that prefer to run with an older version of "FRA for Picoscope", version 1.013 can still be used (also attached in first post)
 
The following users thanked this post: 4cx10000, 2N3055, vmax


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf