### Phase Error in Voltage and Current Sensors

I have updated the test reports on the Ideal AC-AC adapter and the YHDC current transformer.

Some months ago, there was much discussion about the effects of phase error on power measurements, and Martin Roberts developed a sketch for the emonTx in which he calculated the phase shift by comparing with a synthesised sine wave, only to realise that he had re-invented the Discrete Fourier Transform. With the code converted by Martin into a spreadsheet, I applied it to the AC adapter quite easily, but with the different and very wide range of signal levels available from the current transformer, I ran into severe problems. It took me a long time to realise that at low currents, I was actually measuring the phase shift of crosstalk inside the soundcard that I was using as an oscilloscope. Once the problem was identified, a pair of op-amp 'followers with gain' introduced in front of the soundcard to keep the input there at a reasonable level and constant removed that part of the problem completely, but still left the difficulty of ensuring both halves of the c.t. core were mated correctly when the c.t. was closed around the cable. Judicious gentle tapping on the c.t. casing has proved to be the best method to get consistent results.

The spreadsheet works on one cycle of the waveform and calculates the amplitude and phase of the desired harmonic component, the phase of course being relative to the sampling window. This inherently rejects the contribution of higher order harmonics that can shift the zero crossing and so confuse the measurement that the X-Y 'scope method gave, the method that I had used initially. And as the DFT effectively averages a whole cycle's worth of samples (882), it is capable of much greater precision.

Using only the fundamental frequency component and two channels, it is easy (if somewhat laborious) to derive the relative phase across a wide range of currents; and by varying number of turns of the primary winding and varying the amplifier gain I managed to get credible measurements over the range 100 mA - 100 A, and an indication of the error down to 40 mA (around 10 W). The results are presented in the updated reports.