# Gas station without pumps

## 2020 June 5

### Compensation in impedance analyzer

Filed under: Circuits course — gasstationwithoutpumps @ 00:18
Tags: , ,

The Analog Discovery 2 has an impedance analyzer that includes short-circuit and open-circuit compensation to correct for the impedances of the test fixture, and I’ve been thinking about how that might be computed internally.  The open-circuit and short-circuit compensation can be applied independently or together, but each requires making and recording an impedance at each frequency for which impedance analysis is done.

Since there are three impedances that are measured (open-circuit, short-circuit, and device-under-test), I came up with two circuits that could model the test setup:

The measurement is made at the two ports, and Z_DUT is the device being measured—the other two impedances are parasitic ones of the test fixture that we are trying to eliminate.

Let’s look at the short-circuit compensation first.  For the first model, if we replace Z_DUT with a short circuit, we measure an impedance of $Z_{sc} = Z_{s1}$, while for the second circuit we measure $Z_{sc} = Z_{p2} || Z_{s2}$.   In the first model, we can do short-circuit compensation as $Z_{DUT} = Z_{m} - Z_{sc}$, where $Z_{m}$ is the measured impedance with the DUT in place.  For the second circuit, we would need to measure another value to determine the appropriate correction to get $Z_{DUT}$.

For open-circuit compensation, in the first model we get $Z_{oc} = Z_{s1} + Z_{p1}$ and in the second model we get $Z_{oc} = Z_{p2}$.  So for the first model we would need another measurement to get $Z_{DUT}$, but for the second model $Z_m=Z_{oc} || Z_{DUT}$, so $Z_{DUT} = \frac{1}{1/Z_m - 1/Z_{oc}} = \frac{Z_m Z_{oc}}{Z_{oc}-Z_m}$.

If we do both compensations, we can use either model, but the corrections we end up with are slightly different.

For the first model, we have $Z_m = Z_{s1} + (Z_{p1} || Z_{DUT}) = Z_{sc} + ((Z_{oc}-Z_{sc}) || Z_{DUT})$. We can rearrange this to $Z_m - Z_{sc} = (Z_{oc}-Z_{sc}) || Z_{DUT}$, or $\frac{1}{Z_m - Z_{sc}} = \frac{1}{Z_{oc}-Z_{sc}} + \frac{1}{Z_{DUT}}$.

We can simplify that to $Z_{DUT}=\frac{1}{1/(Z_m-Z_{sc}) - 1/(Z_{oc}-Z_{sc})} = \frac{(Z_m-Z_{sc})(Z_{oc}-Z_{sc})}{Z_{oc}-Z_m}$.  If $Z_{sc}=0$, this simplifies to our open-compensation formula, and if $Z_{oc}\rightarrow\infty$, this approaches our formula for short-circuit compensation.

For the second model, the algebra is a little messier. We have $Z_m = Z_{oc} || (Z_{s2} + Z_{DUT})$, which can be rewritten as $\frac{1}{Z_m} - \frac{1}{Z_{oc}} = \frac{1}{Z_{s2} + Z_{DUT}}$, or $Z_{s2}+Z_{DUT} = \frac{1}{1/Z_m - 1/Z_{oc}} = \frac{Z_m Z_{oc}}{Z_{oc} - Z_m}$.

We also have $1/Z_{sc} = 1/Z_{p2} + 1/Z_{s2}$, so $Z_{s2} = \frac{1}{1/Z_{sc} - 1/Z_{oc}}=\frac{Z_{sc}Z_{oc}}{Z_{oc} - Z_{sc}}$, and so

$Z_{DUT} = \frac{Z_m Z_{oc}}{Z_{oc} - Z_m} - \frac{Z_{sc}Z_{oc}}{Z_{oc} - Z_{sc}}$

$Z_{DUT} = Z_{oc} \left( \frac{Z_m}{Z_{oc}-Z_m} - \frac{Z_{sc}}{Z_{oc}-Z_{sc}}\right)$

$Z_{DUT} = Z_{oc} \left( \frac{Z_mZ_{oc} - Z_{sc}Z_{oc}}{({Z_{oc}-Z_m})(Z_{oc}-Z_{sc})}\right)$

$Z_{DUT} = \frac{Z_{oc}^2(Z_m - Z_{sc})}{({Z_{oc}-Z_m})(Z_{oc}-Z_{sc})}$

Once again, when $Z_{sc}=0$, this formula simplifies to our formula for just open-circuit compensation, and when $Z_{oc}\rightarrow\infty$, this approaches out formula for short-circuit compensation.

We can make the two formulas look more similar, by using the same denominator for both, making the formula for the first model

$Z_{DUT} = \frac{(Z_{oc}-Z_{sc})^2(Z_m - Z_{sc})}{({Z_{oc}-Z_m})(Z_{oc}-Z_{sc})}$

That is, the only difference is whether we scale by $Z_{oc}^2$ or correct the open-circuit measurement to use $(Z_{oc}-Z_{sc})^2$.  At low frequencies (with any decent test jig) the open-circuit impedance is several orders of magnitude larger than the short-circuit impedance, so which correction is used hardly matters, but at 10MHz, changing the compensation formula can make a big difference.

For example, for the following compensation measurements using the flywires, a breadboard, and some short leads with alligator clips to make the test fixture

the choice of compensation formula would make a 3% difference is the reported impedance at 10MHz.  Notice that $Z_{oc}$ is approximately a small capacitor and $Z_{sc}$ is approximately a small resistor in series with a small inductor.  Shorter wires and no breadboard can make these parasitic values much smaller, so that the compensation is not so crucial.  For example, here are measurements of the impedance analyzer board:

Because the open-circuit impedance here is much higher than the input impedance of the measuring oscilloscope channel, I believe that corrections have already been made for known characteristics of the oscilloscope channels.

The exact values of the $Z_{oc}$ measurements are often limited by the noise in measuring the current through the sense resistor, at least at lower frequencies, where the impedance of the parasitic capacitance is very high.

1. Thank you for the interesting post! Have you ever tried verifying what the AD2 is actually doing internally? I’m working a lot with impedance measurements lately and it seems to me that the device is doing something a bit elaborate when performing the short- and open-circuit compensation, since I did not manage to reproduce their compensated impedance curve based on short-/open- and uncompensated DUT measurement alone. Do you perhaps have any input on how the ProbeRes and ProbeCap settings of the impedance tool might come into play here?

Comment by Fabian — 2021 April 9 @ 02:31

• I have no access to internals of the AD2 (nor, more relevant here, to the code in WaveForms). I have not done a series of measurements to see whether the theory I posted here matches what they do exactly. That might be something fun to try when I have some spare time.

I have never used the ProbeRes and ProbeCap settings—those would seem to be crude attempts to do compensation without actually measuring. The open-circuit compensation does usually look fairly capacitive, but short-circuit compensation usually looks more inductive than resistive.

Comment by gasstationwithoutpumps — 2021 April 9 @ 08:30

• Okay, it turns out I made a simple error in my calculations and now everything matches pretty well. I plotted it here in case you are interested: https://imgur.com/a/L7jIHl3 So the AD2 is exactly doing what you stated. In my case it doesn’t matter if I include the Z_sc correction term, since Z_oc is several orders of magnitude above Z_sc, even at high frequencies. Therefore I can’t tell which of the two equations is actually implemented.

In my particular setup the DUT has a rather high capacitance and seems to form a perfect LC-circuit with the inductance of the wire, resonating right in the middle of my measurement interval at around 1 MHz. So the open-/short- circuit compensation is crucial, as the uncompensated measurement gives a completely wrong picture. I saw that sometimes the compensation is done assuming a third unknown impedance Zs2, requiring a third measurement using a known resistor (or capacitor/inductor for that matter). I’ll investigate that next if that will yield improved results or whether short-/open-circuit compensation is sufficient.

Thanks again for your input. I really enjoy reading your blog and this post in particular was very helpful for my work. :)

Comment by Fabian — 2021 April 9 @ 09:03

• The simpler correction is likely the one that they are doing, but the difference is usually going to be insignificant, for exactly the reason you mention: the short-circuit impedance is usually orders of magnitude smaller than the open-circuit impedance. (If that is not the case, then the measurements are likely to be pretty bad anyway.)

Comment by gasstationwithoutpumps — 2021 April 9 @ 09:07

This site uses Akismet to reduce spam. Learn how your comment data is processed.