Re: Questions on interfacing to current sense transformer



On Fri, 26 Jun 2009 20:33:03 -0700 (PDT), David Jacobowitz
<david.jacobowitz@xxxxxxxxx> wrote:

On Jun 26, 7:42 pm, John Larkin
<jjlar...@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
Bias the low side of both the voltage and current sense transformers
to +2.5 volts DC to keep the ADC happy.

Your software should sample the voltage and current as close to
simultaneously as possible... within 10 usec is OK. Sample fairly
often, but it's not really important. I've done good meters that
sampled as slowly as 27 times a second. Nyquist is not an issue here.

Interesting, and yes, I will sample as closely together as I can. The
uC I'm using, an AVR has multiple analog inputs, but they are muxed to
only one ADC, so I'll have to sample serially, but it should be close.

You can also add a little differential analog RC lag to one or the
other to make up for sample delays. Or alternate E:I then I:E to
average things out. But current transformers usually add phase lead
that varies with current... and fixing THAT in software is a trick.

I prefer to use a shunt and couple that with a signal-level
transformer. That's more constant on phase. Or use a shunt and float
the whole meter on it, no magnetics at all.



Process the samples as follows:

Average blocks of, say, 1024 samples, and subtract the average from
each sample. That removes the 2.5 volt offsets.

Ah, clever, the simple average will tell me the bias; that's what I
was wondering about.

You can actually compute the DC average to a fraction of an ADC LSB.
It works.


Square and average the volt and amp samples independently (block
average or lowpass filter) and then square root. That gives you true
RMS volts and amps. Multiply them to get KVAs.

For some reason I had not thought of this. I was going to measure the
peaks and adjust for RMS, but if I'm sampling reasonably quickly, I
can do a true RMS!

Yes. Voltage waveforms are rather distorted nowadays, and currents can
be much, much worse. True RMS is the way to go.


Multiply and average (block or lowpass filter) the product of the
voltage and current sample pairs. The result is true power.

Basically, I'm calculating the instantenous power with the products of
the coincident samples, and I can integrate over a cycle (or longer)
to give the true power.

Many cycles, since the signals will be very noisy. You can block
integrate and then divide, or you can simulate a multipole, continuous
lowpass filter for a nice smooth analog meter effect.



You can integrate power to KWH. You can also compute power factor as
true power over KVAs, but you lose the lead/lag sign.

Something like that.

No, this is great. Once I've got the data into two sample streams,
it's all straightforward math.

Add some random noise to the analog current signal, a few LSBs maybe,
to smear out the ADC quantization error and extend the low-end

Like audio dither? How much noise do I add?

A few adc lsb's p-p. Random noise is good, but a triangle works well
too. Just make sure it's uncorrelated to the line frequency. The noise
will raise the RMS current noise floor a little, but since it's
uncorrelated to the voltage waveform, it contributes no longterm power
or energy error. And it makes the low end power measurement
beautifully linear. I've done metering-quality stuff (resolution 1
watt in 20,000) using a dithered Wilkinson-type 7-bit ADC.

No point in dithering the voltage signal, since it's big and nearly
constant.


I'm excited to do this project. I think it's going to work!

The math is fun. There's some really interesting math involved in
selecting the sample rate. You'd like a block of N samples (2^M
typically maybe) to hit uniformly-spaced phase angles of the sine wave
over a number of cycles. Turns out that there are some magic numbers
involved that result in super-stable results.

Oh, one last trick: most multiplexed ADCs have a little bit of
carry-over between channels. That can produce a low-level fake power.
You can digitize ground between the E and I samples to "discharge" the
ADC guts, or take two I samples and throw the first one away. Or cal
the error out (it usually goes as E^2)

This is actually an interesting problem. It's not easy to make an
electronic meter that's as good as the ancient rotating disk.

John


.



Relevant Pages