choices for AC measuring

Using a 12v secondary transformer from mains, I can ether:

A/ use a divider and also bias the Arduino input to 2.5 to avoid negative voltages. AC into the Arduino.

B/ use a standard bridge, cap, and divider to put DC into the Arduino.

Is there some benefit to one way over the other?
Seems like DC is a simpler measurement - the AC values would need software smoothing to get a usable value.

For A you'll need to grab multiple syncronized samples.

B will detect noise on the peaks as increased voltage.

Either way involves multiple samples to overcome noise in the ADC. The AC voltage waveform is usually a pretty consistent sine wave, so I'd just use a 0.1uF cap across the transformer secondary, bridge rectifier, cap, and make sure the divider provides some load. RMS = 0.707Peak but you'll also need to take into account the approximately 1.4V dropped out by the bridge.

If you want to be accurate, get one of these babies:

I'd use a single diode, voltage divider, and capacitor.

Put the voltage divider on the DC side (Arduino side) of the of the diode to minimize (voltage divide) the voltage-drop across the diode. But, you'll still need to compensate for the remaining diode drop in software.

To protect against power surges, it would also be a good idea to put a "protection diode" between the Arduino's input and 5V. That diode gets wired in the "reverse" direction so it conducts only when the input voltage exceeds the 5V supply.

You won’t see a clean sine wave these days, too many SMPS corrupting the mains, so peak
measurement isn’t great. But what do you want to measure in the first place? ie which
harmonics, power factor, etc etc…

Only really need rough measure of voltage.

DVDdave, why do you suggest just half wave rectified?
Wouldn't I need a bigger cap?

Is there some benefit to one way over the other?

Benefits of option A "AC into the Arduino":

  • Less external components
  • No lost signal in zero crossing region
  • No added distortion
  • More accurate
  • Easy to level shift to zero in software (subtract 512)
  • Easy to perfectly rectify in software (absolute value)
  • Easy to smooth to average DC in software (rolling average)
  • Easy to convert to rms DC in software (0.707/0.636)*average