0
\$\begingroup\$

I am trying to read AC voltage with an Arduino to be able to detect parameters such as phase angle, peak voltage on load and source sides for comparision.

For this, I have a 230VAC to 15VAC transformer where I am using a voltage divider circuit using 10k and 2k 1/4 watt resistors for a 2.5VAC output which I am feeding straight into analog pin A1 of an Arduino Uno.

I have already built and tested the circuit and everyting seems to be working fine and I am ablhe to see a sine wave on thr Arduino plotter.

Before I finalize it and build a PCB for it, I was wondering if others can peruse through the description and circuit diagram below and let me know if there's anything critical that I may've missed. Mainly, can the circuit I've built be considered "safe" for the Arduino (as well other electronics connected to it,) or do I need to add protection elements like a polyfuse or Zener for over current and over voltage protection?

Simplified circuit diagram:

enter image description here

Waveform with approx 2.5V to -2.5V after mapping in the code:

enter image description here

\$\endgroup\$
10
  • \$\begingroup\$ To add further, as per my calculations the maximum current at Vout will be 0.00125Amps which is absolutely safe for Arduino and In case of short, I'd expect the resistors to burn off before it causes any damange downstream. Is this a safe assumption ? I can add a polyfuse however I'd prefer to keep the circuit simple if the risk is manageble. \$\endgroup\$
    – Prashant
    Sep 5, 2022 at 13:00
  • 2
    \$\begingroup\$ Feeding negative voltages directly into the inputs of an ATmega isn't going to do it any favors, and it won't measure them either. You'll need to level shift it up somehow so that the measured signal never goes negative. \$\endgroup\$
    – Hearth
    Sep 5, 2022 at 13:06
  • \$\begingroup\$ I don't see a sine wave. What you mean by 'mapping in the code'? \$\endgroup\$ Sep 5, 2022 at 13:09
  • \$\begingroup\$ @Hearth Bruce Abbott You both are right. This is more for the asthetics when I trend these waves in my GUI application. Functionally speaking, I will get to capture zero crossing of both waves which is my key requirement. I am using "outputValue = map(sensorValue, 0, 1023, -2.5, 2.5);" function to map "floating VAC" to -2.5 to 2.5 VAC. Stepping down voltage with resistors is something I've never done before so I'm just not sure if this is how you will design the circuit ? \$\endgroup\$
    – Prashant
    Sep 5, 2022 at 13:19
  • 1
    \$\begingroup\$ @Prashant I'm pretty sure that's not reliable. You should have the grounds connected anyway. I couldn't begin to guess what's going on with your reference voltage, and I'm pretty sure that's the reason you're not getting a good sine wave output. \$\endgroup\$
    – Hearth
    Sep 5, 2022 at 17:28

1 Answer 1

0
\$\begingroup\$

Everything from the transformer output on is 'floating', so the signal finds a return path through the protection diodes on the Arduino's analog inputs. Depending on which way the current is going it might go through Vdd or Ground, switching from one to the other as the polarity of the AC waveform changes.

You cannot reliably measure voltage without a proper reference point. Your problem is that you can't just connect the transformer output 'Neutral' to ground because the Arduino can only measure positive voltage, but the AC waveform goes both above and below ground.

One way around this is to bias the 'Neutral' at half the Arduino's supply voltage. Then the waveform can go above and below 2.5 V and you just have to subtract 2.5 V from the ADC result. The 2.5 V reference needs to be 'stiff' enough to not be significantly affected by leakage through the transformer or from the chopper/load to anything else, as well as loading from the ADC inputs.

The simplest circuit for this 'virtual ground' is a just a resistor voltage divider with a capacitor to smooth out AC variations, like this:-

schematic

simulate this circuit – Schematic created using CircuitLab

Here I used two capacitors - a large one to the handle AC mains frequency and harmonics, and a small one for rf frequencies above the large capacitor's resonant frequency.

Note that this will only work if the low voltage AC circuit remains isolated from any ground or other voltage.

A safer way would be to connect 'Neutral' to Ground and use a level shifting circuit. Since you have to reduce the voltage anyway, something like this should work:-

schematic

simulate this circuit

I chose these resistor values to output almost 2.5 V peak from 15 VAC rms, centered on +2.5 V. If the actual transformer output is higher you will need more attenuation to avoid clipping the tops and bottoms of the waveform.

\$\endgroup\$
3
  • \$\begingroup\$ Thanks for the details response Bruce. You are right in saying that connecting Neutral with DC ground will not work and this is what i found in my experiment as well. In your second circuit, you used 10K (R1) for current limiting, while this will cost me (voltage drop = lesser resolution), will you consider this as a "real" protection meaning, is this how you will design current protection in a production grade circuit or are there better ways to implement this ? \$\endgroup\$
    – Prashant
    Sep 6, 2022 at 5:32
  • \$\begingroup\$ I come from a digital circuit background and have never interfaced power circuit to digital circuit without having some sort of optocoupler, fuse etc for isolation which is why I'm again and again harping on this "protection" side so apologies for being repetative. I am aware of using rectifier circuit for this but am wondering if there's any other way to implement this using passive components without compromising on resolution and other characterstics of AC power signal. \$\endgroup\$
    – Prashant
    Sep 6, 2022 at 5:36
  • \$\begingroup\$ The 10k is not 'for current limiting' but to divide the voltage down to inside the ADC's input range. However it will limit current to a few milliamps if the voltage goes a bit higher than normal, and so should protect the Arduino (unless you do something really silly like putting mains voltage on it). \$\endgroup\$ Sep 6, 2022 at 8:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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