Using Arduino to read Current Transformer's ac output....

I've tried to read up on the various techniques for doing this. To date they seem to revolve around adding a dc bias, then sampling the waveform via the Arduino ADC at a high rate to determine/approximate the peak-peak value of the input.

This seems like a lot of processor time and effort is being used getting readings when most of them will be discarded (only the peak high and peak low are used). For my application I don't need high resolution, in fact 5% of full scale will be fine, nor do I need good repeatability. I simply want to set a threshold to activate an output, and that output will be reasonably consistant, let's say within 2% of full scale.

I intend to do the following, and invite your opinions on it's feasability and possible pitfalls.

  1. Measure an ac current of 0 to 40 Ampere with an SCT-013 CT, nominal output 5v for 50A.
  2. Take the CT output (nominal 5v pk-pk)and bias it positively by about 3vdc.
  3. Feed this into a full wave rectifier, where I'll 'lose' about 1.1vdc across the diodes.
  4. Smooth and filter the rectifier output to produce a (gently!) rippling dc signal.
  5. Feed this signal into a voltage divider to keep the maximum signal below 5vdc, and then into the Arduino ADC.

My intention is to only read the ADC once every 200ms or so (every 10 mains cycles), which will be perfectly adequate for my needs.

Is it feasable?
Is it sensible?

If you are going to rectify there is no need to bias.

And, you can probably get-away with a half-wave rectifier. I assume this is a power line sine wave?

You can subtract-out the diode drop but you'll need some logic if you don't want to see negative voltages.

If you want to get rid of the diode drop you can build a [u]peak detector[/u] with an op-amp.

My intention is to only read the ADC once every 200ms or so (every 10 mains cycles), which will be perfectly adequate for my needs.

I don't see anything you are doing to clock the ADC to the line frequency or the peak of the current wave. Since you are using a current transformer, the AC output will be directly related to the AC current, not the AC line voltage. Therefore, you need to detect the clocking signal on the CT output.

Paul

Glorymill:
This seems like a lot of processor time and effort is being used getting readings when most of them will be discarded (only the peak high and peak low are used).

So what's the problem there. Do you need the processor for something else all the time?
An Arduino works equally hard doing nothing.
Leo..

It makes a lot of sense to me to use a few external components to condition an input signal and reduce the need for complex coding.

A current transformer does not convert ac current to voltage, but to an ac current proportional to and isolated from the main circuit. You need to add a "burden resistor" - kind of a shunt.

https://openenergymonitor.org/forum-archive/node/156.html

thereafter a simple diode detector circuit using a single diode - preferably a germanium or schottky diode which has a lower threshold voltage - with a suitable capacitor and resistor to make a filter will convert the resulting signal to a dc voltage with a bit of ripple.

4 components in all and no additional supplies needed, saving a lot of code.

johnerrington:
A current transformer does not convert ac current to voltage, but to an ac current proportional to and isolated from the main circuit. You need to add a "burden resistor" - kind of a shunt.

CT sensors - Interfacing with an Arduino | Archived Forum

Yes, thank you John. The version of CT I am using has a built-in burden resistor.

johnerrington:
...thereafter a simple diode detector circuit using a single diode - preferably a germanium or schottky diode which has a lower threshold voltage - with a suitable capacitor and resistor to make a filter will convert the resulting signal to a dc voltage with a bit of ripple.

4 components in all and no additional supplies needed, saving a lot of code.

I like simple and, unless there is a need for better accuracy/precision, I have no need to add more components.
It seems that John's solution will lose accuracy at the lower current measurements due to the forward bias voltage drop across the diode, but that's OK for my application.

Wawa:
So what's the problem there. Do you need the processor for something else all the time?
An Arduino works equally hard doing nothing.
Leo..

Thank you Leo. Perhaps it's the mechanical bias in my life that tends towards reducing the 'wear' by reducing the workload, though I did read an article on the STM32 microcontroller stating that on the low power version each operation adds a current overhead. This seems to suggest that a larger program will use more power (and probably generate more heat). I also add that I am a novice at software, and a simpler program is more manageable for me in terms of development. modification, and debugging.

But thanks for all your tips and suggestions.
GM

FWIW, program size is not a metric that correlates with power consumption.

No one ever concerns themselves with how much power an embedded controller consumes... unless it is running from a battery. Then the power consumed almost always becomes the primary driver of the overall hardware/software design.

Only when the program has consumed 100% of the processors time and you still have things that need to be done does it matter what the processor is actual doing. The majority of Arduino programs are written as a single thread of execution and the processor typically spends 99.99% of its time doing nothing, just waiting for something to happen.

Glorymill:
I've tried to read up on the various techniques for doing this. To date they seem to revolve around adding a dc bias, then sampling the waveform via the Arduino ADC at a high rate to determine/approximate the peak-peak value of the input.

I think a better technique is to sample at a fixed medium rate, perhaps 500Hz to 1kHz or so, and compute
the rms current directly from the samples. No need to see the peaks, and the technique is much more immune
to spikes on the mains and waveform distortion. Sampling at 500Hz leaves 94% of the processor time free
(assuming using the standard settings for analogRead()).

Reading only the peak and assuming the RMS is 70% of that only works for a linear load with PF = 1.0. Like an incandescent bulb, heater, or electric stove.

The reason for getting so many readings is not to toss out 99% of them, but to use those readings to calculate the actual RMS. If you also capture the zero crossings of the voltage source, you can also calculate power factor.