# 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.