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

0 Members and 2 Guests are viewing this topic.

Offline _Wim_Topic starter

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

Offline _Wim_Topic starter

  • Super Contributor
  • ***
  • Posts: 1518
  • 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: 1518
  • 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: 1518
  • 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: 1518
  • 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: 1518
  • 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: 1518
  • 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: 1518
  • 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: 1518
  • 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: 1518
  • 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: 1518
  • 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: 1518
  • 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: 1518
  • 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: 1518
  • 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
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf