# Capturing 0-2v AC with 3.3V ADC

#### MikeA

Joined Jan 20, 2013
258
I have a few little current clamps that I'd like to monitor with a 3.3V Arduino clone + ESP8266 device. I'll use the Arduino clone with an external ADC that provides 12+ bits of resolution, 4+ analog inputs, and can take roughly 600-700 samples per second across all inputs.

The current clamps I have provide 100mv RMS output per 1A of current flowing through their center with a 100 ohm resistor, and I will be monitoring 15A circuits.

I have some ideas how to interface the current clamp output. Rectify into DC, some caps and resistors to get a stable voltage reading since I'm only interested in taking a sampling every 10 second. Is there a more elegant solution or some things that I'm missing?

Last edited:

#### MrChips

Joined Oct 2, 2009
24,173
The one thing to remember is that a diode is not an ideal rectifier at low voltages.
You will need a precision rectifier circuit.

Joined Mar 10, 2018
4,057
Are they current transformers ? If so can you offset the sense winding
and do a differential measurement ? I am thinking an onboard SAR
versus rectification to manage the measurement, differentially.

Why the limitation 1 sample / sec ?

You could do this all on one chip -

PSOC 5LP, board would be \$ 10 -

Regards, Dana.

Last edited:

#### MikeA

Joined Jan 20, 2013
258
The one thing to remember is that a diode is not an ideal rectifier at low voltages.
You will need a precision rectifier circuit.
Is there a specific precision rectifier circuit you'd recommend in this context?

#### eetech00

Joined Jun 8, 2013
2,571
Hi

Scale the input down then perform calculation in ADC. Sinewave will be offset approx. 1.46v at output. Should be able to come close to resistor R2 and R3 values...

Measurement: amps
step ((voutmax-1.46)/.0705)
1 1.01297
2 2.01586
3 3.01875
4 4.02163
5 5.02452
6 6.02741
7 7.03029
8 8.03317
9 9.03606
10 10.0389
11 11.0418
12 12.0447
13 13.0475
14 14.0501
15 15.0499
16 16.0401
17 17.0349
18 18.0368
19 19.0396
20 20.0424

#### MikeA

Joined Jan 20, 2013
258
Here are some references:

ZXCT1041 as precision rectifier (application note).

Precision Rectifier Circuits

Looks like the packaged up solution needs 5-20v DC to power it up.

If I were to build the precision rectifier circuit above, what features would an op-amp need? 3.3V rail to rail? I'm only dealing with 60hz here.

#### crutschow

Joined Mar 14, 2008
27,709
Here's the LTspice simulation of a simple precision full-wave rectifier with an output filter.
The rectified output average is amplified by a gain of 1.11 so that the DC output equals the RMS of the AC input (for a sinewave).
With a 5V supply you can use a single-supply type op amp, such as the LM339.
If you use a 3.3V supply, the op amp will need to be a rail-rail input and output type.

Last edited:

#### MikeA

Joined Jan 20, 2013
258
I finally got some free time and put this together on an etched circuit board with an LM358N.

The readings I'm getting are very good! (circuit powered by 5v, and using a handheld Uni-T current clamp as the reference)

0.3999v DC @ 3.960A
0.0799v DC @ 0.801A
0.0605v DC @ 0.602A
0.0399v DC @ 0.399A
0.0205v DC @ 0.202A

I'm seeing 1.6mv output with no current. Is that an artifact of the op-amp?

#### MikeA

Joined Jan 20, 2013
258
So I'm trying to build something a little more complex now.
I'd like to connect multiple current clamps to the circuit below through a multiplexer like CD74HC4067, which only tolerates Gnd to Vcc on the pins.

Any idea how to couple the AC voltage from the clamp to the multiplexer and then to this circuit?

#### ebeowulf17

Joined Aug 12, 2014
3,282
So I'm trying to build something a little more complex now.
I'd like to connect multiple current clamps to the circuit below through a multiplexer like CD74HC4067, which only tolerates Gnd to Vcc on the pins.

Any idea how to couple the AC voltage from the clamp to the multiplexer and then to this circuit?
I strongly suspect that you'll need individual conditioning circuits (like the one you built) for each CT. You can use a multiplexer to feed all of the resulting outputs into some other thing (ADC, etc.,) but I don't think you can feed the CT through a multiplexer and get useful results.

We'll see... Crutschow has vastly more knowledge and experience than me, so maybe he'll have a trick I'm not seeing.

#### crutschow

Joined Mar 14, 2008
27,709
Any idea how to couple the AC voltage from the clamp to the multiplexer and then to this circuit?
You mean without a plus and minus supply?

If so, as ebeowulf17 suggested, you could precondition the signal from each sensor to be unipolar before the mux.
You just need the op amp first stage consisting of U1, D1, R1 and R2, which then goes to the mux input.
Ths mux output can feed a single common second stage (U2 and filter).

One advantage of that configuration is there is no significant signal current going through the Mux, so its on-resistance will have no effect on the signal level.

Last edited:

#### crutschow

Joined Mar 14, 2008
27,709
Here's a simpler alternate circuit which has the input resistor only at the Mux input along with a Schottky diode clamp to prevent the input going significantly negative when the Mux input is not active.
The Mux signal thus never goes negative, since the op amp input is a virtual ground for negative going signals and thus also never goes significantly negative.

The simulation shows it switching from the top to the bottom source at 1 second.

I didn't have a model for the 4067 mux so I used two 4066 switches to emulate a 2-input mux.

Last edited:

#### ebeowulf17

Joined Aug 12, 2014
3,282
The other question here is how fast the selections need to change. With most of the conditioning circuit after the MUX, it takes a while for the signal to settle at a new level after changing sources (about 0.8 seconds in sim above.)

If you have more of the filtering happen before the MUX, such that you've got DC signals at each MUX input, then you can get meaningful signals much more quickly after each MUX input switch.

If readings only need to be taken at intervals of a second or more, then the circuit above would do the trick (and looks pretty clever!) but if readings need to be taken several times per second from different inputs, then I think the transition times would be a problem.

#### crutschow

Joined Mar 14, 2008
27,709
Originally the TS stated:
I'm only interested in taking a sampling every 10 second.

#### ebeowulf17

Joined Aug 12, 2014
3,282
Originally the TS stated:
Oops, sorry I missed that. In that case, your system looks brilliant!

#### MikeA

Joined Jan 20, 2013
258
Here's a simpler alternate circuit which has the input resistor only at the Mux input along with a Schottky diode
Thanks! This is exactly what I was trying to do, but in LTspice I was sticking the diode between R1 and the input (maybe someday I'll be able to visualize exactly how that circuit works inside my brain and not rely on trial-and-error).

The other question here is how fast the selections need to change.
While it's not critical, it would be nice to get in as many good ADC readings as possible. Say my ADC is reading at 1000 samples per second, and I have 10 clamps that I want to read every 10 seconds. So I can dedicated 1 second of the ADC to each clamp. The more samples I grab, the more precise the average of all the readings will be.

One trick I tried is using a digital pin from the ESP8266 processor to sink current from C1 between mux pin changes for a few milliseconds. That returns C1 to 0v for the next reading.

A more elegant solution might be to use a processor pin to set C1 to Vcc/2, if my clamp readings were all over the place. In theory that should cut the settle time in half on average. I'm open to ideas for improvement.

#### crutschow

Joined Mar 14, 2008
27,709
A more elegant solution might be to use a processor pin to set C1 to Vcc/2
Yes that would help if the difference between readings is more than Vcc/2.

But the settling time can be significantly reduced for a given output ripple by using a multiple-pole active filter in place of the single-pole passive filter.
Below is the simulation with a 3-pole active low-pass filter:

The settling-time can reduced even more with a higher-frequency corner on the filter but there's a trade-off between settling-time and ripple voltage.
How much ripple can you tolerate, or what accuracy are you looking for?

You could also average multiple samples in the processor over one or more input cycles to minimize the ripple.

Last edited:

#### MikeA

Joined Jan 20, 2013
258
You could also average multiple samples in the processor over one or more input cycles to minimize the ripple.
That's exactly the reason behind trying to get in as many ADC samples per time slot allotted to each clamp. The ADC has internal noise too, so averaging helps with both.

I'll be a proud owner of a bench top signal generator soon, and I'll try building an active filter out of real parts then. Thanks for all the help!

#### crutschow

Joined Mar 14, 2008
27,709
Say my ADC is reading at 1000 samples per second, and I have 10 clamps that I want to read every 10 seconds. So I can dedicated 1 second of the ADC to each clamp. The more samples I grab, the more precise the average of all the readings will be.
That's exactly the reason behind trying to get in as many ADC samples per time slot allotted to each clamp. The ADC has internal noise too, so averaging helps with both.
Then you might consider just averaging many samples using an RC passive filter as in the post #13 circuit, with a higher corner frequency so it settles in a shorter time.
For example an RC time-constant of 50ms will settle to within 99.3% of the final value in 500ms, so then you average the last 500ms to reduce the ripple and get a low-noise value.

It would be important to average an integral number of input cycles which minimizes the ripple noise.
What's the signal frequency?
Can you precisely control the A/D sample frequency?