As Dave Tweed already mentioned, the fact that the maximal separation is comparable to plates' dimensions makes this setup problematic. You may get accurate estimation of the distance while the plates are close together, but this setup won't work for the whole range.

Dave suggested that these nonlinearities may be accounted for, but I don't see how this can be achieved, satisfying the required accuracy, without very complicated calculations.

However, since you're going to use microcontroller, you may try the following trick: perform initial mapping of distances to capacitance, store this data in microcontrollers memory (assuming it is sophisticated enough) and use the stored data as a look-up-table to map the measured capacitance back to distance.

As to the required clearance, it depends on which objects may be present in the vicinity of your setup. Consider shielding it with conductive screens.

To measure the power consumption of each motor, you'd need to measure the voltage and current, before the motor driver.

(the 3 phase power after the driver will be very hard to measure).

Both voltage and current measurements will need to be filtered to remove the 40 kHz signal, which will otherwise cause all sorts of trouble, as you correctly anticipate.

Fortunately, 40 kHz is far away from your likely sample rate of about 50 Hz. A first order RC filter with its knee at 40 Hz will attenuate the 50 kHz ripple voltage by about 30 times, which might be enough. An inductor and two capacitors will be much better.

Voltage is fairly easy to measure - as a nice low impedance source, you can build a simple filter and feed it to your ADC. You only need one voltage measurement after the 24 V power supply. The ripple in the voltage should be fairly small anyway.

Current is a bit more tricky. You could use a sense resistor in the ground wire, and an op-amp to amplify the small voltage, then the filter. At some torque settings, the current might really be a square wave at 40 kHz, it'll be hard to measure and filter. It might be an idea to filter the *power line itself* with one LC, just to remove some of the ripple, and then filter the sense output again before the ADC.

One last digital idea would be to sample faster than you need to, perhaps at 1 kHz, and average these in the Arduino. The aliasing will still be a problem, however if you randomise the time of the samples, you may be able to average out the 40 kHz signal, preventing it from being properly aliased into your band of interest. Some experiments here would be valuable.

## Best Answer

It

ispossible to make the measurement in a single cycle. The general technique is called 'guarding', and it's the staple technique used by 'in circuit test equipment' (ICT) for measuring components on already populated boards.In the general case, a wanted resistor Runknown is shunted by a parallel path of at least two other resistors, for which a node on that path is accessible. This point is called the guard node.

In the worst case, the shunt path is very low resistance, and the unknown is high resistance.

^{simulate this circuit – Schematic created using CircuitLab}In this circuit, we apply a voltage of Vref across the unknown resistor, and measure the current flowing through it. The virtual ground amplifier keeps the sense node at 0v, and measures the current flowing out of the sense node.

How do we cope with the current also flowing through the parallel path?

The current flowing through Rtop is not measured. The current flows in at the force node, and out through the guard node, no current flows in the sense node. The force node needs to have sufficient output capacity to drive whatever current Rtop consumes. Power dissipation in Rtop is one of the limitations on how high a Vref can be used.

The current flowing through Rbottom is made to be zero, by keeping both ends of it at the same voltage. Therefore the only current that flows out of the sense node is the current through Runknown, due to Vref across it.

The effects of Rtop and Rbottom have been 'guarded out'.

There are a number of errors that will come into the measurement.

a) The VirtGND amplifier does not have zero offset voltage.

This will make the voltage across Rbottom non-zero, and consequently a current will flow through it and add to the measured current. This effect gets worse as the ratio of Runknown/Rbottom gets bigger. This can be mitigated by making the Vref/Voffset ratio as large as possible.

b) All three leads to the 'resistor delta' will have some finite resistance, which will cause measurement errors. In the case of ICT, there is one set of measurement gear, and an analogue multiplexer that is connected to potentially 1000 components on the board under test. Each path through the multiplexer could have 10s of ohms of resistance, and this lead resistance is too much to give a reasonable range of accurate measurement.

Fortunately, the connections to the force node and the sense node can each be connected by a 'voltage sense' lead, and a 'current drive' lead, much as you would make a '4 terminal' measurement of a resistor. The guard node also needs to be low impedance, but usually in ICT work, the ground connection is available to all terminals locally and does not have to go through the full multiplexer, so can usually be made by a single hard connection.

If there still turns out to be too much voltage drop through the guard connection for accuracy (the voltage drop in this lead appears across Rbottom, so drives an error current through to the sense node), then the simple guard can be replaced by an amplifier with a sense and drive connection to the guard node, and a zero voltage reference input.