I am trying to sense voltage, current, and power with an Arduino (Due) for monitoring and diagnostic applications. To get reasonably good input (better than Kill-A-Watt), I have designed an AC sensing front-end for the Arduino. As this is my first design, I ask the community to have a look and to tell me if the whole thing makes any sense and if it would work. If the whole thing makes sense and works, I will put it on my blog so other people can use the idea.

enter image description here

So here is how the attached schematic works:

  1. For voltage. TR1 isolates the device from AC and decreases voltage to 6.3 V RMS. This is divided by R7 and R8 and the signal is buffered by IC2A, shifted by R2 and R1 and fed to the Sample and Hold amplifier SMP04, and then to the ADC.

  2. For current, I use the LEM LTSR15-NP Hall effect transducer. Signal is again divided (maybe there is no need), buffered, and shifted and send to the S&H IC.

  3. For power I use the analog multiplier AD835 whose output goes to the S&H IC.

The S&H signal is going to be generated by the Arduino.

Version 2: Thanks for solving my bugs. Here is my second attempt:

enter image description here

Version 3: In version 2 I fixed the current handling as taught and then did something stupid with the voltage signal processing circuit. This is now version 3 where I have followed the advice of Techdude:

enter image description here


Bunch of problems here.

You can't operate the LTSR15-NP like that - its 0V supply pin needs to be @ Ground potential to power its internals properly. Its output Vout is already at its Vref for 0-current, 2.5V +/-0.025V, so there's no need to do any shifting here. So IC1A & its C2/R5/R6 is not needed*.

LTSR15-NP also provides its Vref as an output, and you'd be well advised to use that as your system-wide Vref, all the way into the Arduino's Vref input pin. Let that be your reference voltage, because this is better than using the default 5V 'Vcc' suppy rail as your reference for analog measurements (because it changes, you'll get poor accuracy & even crappier long term repeatability).

The LTSR15-NP's Vout should therefore be voltage-divided 2:1 (e.g. R3=R4=10k) so that 0-amps = 1.25V, & full scale +ve = 2.5V, & full scale -ve = 0V.

IC2A is not acting as a buffer, merely as a level shifter to get your "0-volt crossing point" to be at half-Vcc. Again I'd instead use LTSR15-NP's Vref output into this level-shifter [edit:] through a 2:1 Vdivider, another pair of 10k, so that the 0-volt AC crossing point will be at 1.25V. Then i'd reuse the IC1A as an actual buffer in voltage-follower arrangement.

Then redo your R7/R8 calculations so that 150Vac (assuming you're on a 110/120Vac mains system) on TR1 primary results in no more than [edit:] 2.5Vpp, preferably a bit less. Then put some Schottky diodes on the R7/R8 divider node (before the Vfollower op-amp input) up to Vcc & down to Ground (i.e. both normally reverse-biased) to clamp spikes.

Also, you're only interested in 50/60Hz, so you'll want to filter out higher frequencies as much as possible (sampling theory, Nyquist etc), otherwise that noise (inherent in AC power distribution) is not only going to affect your measurements directly, but the noise above your sampling freq. will also fold back into your sampling frequency range of interest. Add caps on those two voltage-divider nodes with appropriately calculated RC timeconstants to start rolling off at, say, 100-200Hz. Do your resistor power calculations here!

Put 100nF (0.1uF) ceramic caps ('decoupling caps') across the power supply pins of all your chips [edit: and on the LTSR15-NP's Vref output].

I'm guessing (hoping) that IEC mains connector symbol is just a place-holder for your external wiring that puts the load in series with this, otherwise you'll only be measing the current/power of your own TR1 :).

Also, "as an exercise for the student", it might be interesting to do the V & I multiplication yourself in Arduino code, & compare it to the AD835's output :)

And all the applicable warnings for working with mains voltages apply - this is really dangerous stuff. If you've not done it before seek out help from someone who does. I'd strongly recommend working on this during the development phase with an Earth Leakage Circuit Breaker between you and the mains wall socket. Add a fuse. Always insulate all mains wiring so human contact is impossible or at least unlikely.

  • 1
    \$\begingroup\$ For safety during initial development and de-bugging you can use a step down transformer to say 18VAC ... just remember the scaling changes when you connect to the real mains. :-) \$\endgroup\$ – Spoon May 15 '15 at 7:46
  • 1
    \$\begingroup\$ And to make the Arduino use this external reference voltage (wired over from the LTSR15-NP) instead of its internal reference, add: analogReference(EXTERNAL); to your setup();. \$\endgroup\$ – Techydude May 15 '15 at 10:14
  • 1
    \$\begingroup\$ Your current transformer handling is better, but the voltage measurement side of things isn't quite there yet. Firstly, TR1 secondary is currently floating, so you won't be measuring anything (meaningful) at the R7/R8 node - I'd put IC2A back into the arrangement you had it (& what I say henceforth is w.r.t. that original schematic) with the op-amp's output to the bottom of TR1 secondary; but have pin3 (non-inverting input) connected to half of Vref (i.e. Vref through R1/R2=10k/10k to ground, middle connected to IC2A-pin3). Then... \$\endgroup\$ – Techydude May 16 '15 at 9:50
  • 1
    \$\begingroup\$ Then, going back to your 2nd schematic, have the R7/R8 node going into IC1A-pin3 (& take out R9/R10), with the 2 protection diodes. But the diodes both need to point upwards (forwrd-boased gnd to signal, & forward-biased signal to +5 rail). I'm just doing this in my head, so let's see what that looks like, then we can fix what remains :) \$\endgroup\$ – Techydude May 16 '15 at 9:56
  • 1
    \$\begingroup\$ hey - i think i have confused myself between the 2 schematics, i think two different lines of thought collided! i don't have time right now, but will have a closer look over the next 24 hours. \$\endgroup\$ – Techydude May 18 '15 at 13:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.