2

I would like to measure a phase controlled 240Vac waveform as a digital PWM input for an arduino. The signal would look something like this:

enter image description here

My intent was to use a zener clipping circuit to limit the positive portion of the waveform to 5V, and measure that signal. However, I want to make sure I'm properly grounding these items. This is what my proposed circuit looks like, with all components inside a metal chassis.

enter image description here

I feel like ideally I would isolate this waveform from the system controller/light with a 1:1 transformer, but I'm unsure if that is feasible given its irregularity. Can I safely connect the arduino ground to the system's neutral, or am I barking up the wrong tree?

Thanks!

2
  • The more I think about it, the more I think that I should tie Arduino ground to chassis ground and rely on N and G being within a few volts of each other.
    – mrmojo6
    Aug 25, 2017 at 18:58
  • How can you get current flowing around the circuit without that ground connection? However, you really want to invest in some form of galvanic isolation to keep the mains away from the Arduino.
    – Majenko
    Aug 25, 2017 at 19:45

2 Answers 2

0

You shouldn't really connect the mains direct to the Arduino like that - even with a zener. The potential for disaster is somewhat large.

Instead you should galvanically isolate the mains from the Arduino. I would use something as simple as an opto-isolator:

schematic

simulate this circuit – Schematic created using CircuitLab

Make sure that R1 is rated for at least 339V and can dissipate enough power (1W). The resistance of R1 needs to be small enough that the opto-isolator triggers properly, yet large enough that you don't need a great honking heater of a resistor to cope with the power. 150K seems a reasonable compromise.

D2 is needed to prevent the LED In the opto-isolator from being reverse biased with 339V in the reverse-swing portion of the waveform.

You can incorporate your zener as well if you want to "push down" the waveform to get a lower cross section of it (clip off the upper portion) instead of just reducing its amplitude:

schematic

simulate this circuit

In this R1 is the same as the resistor you were planning to use before. The added R3 resistor is to limit the current through the LED (drop the 5V to the LED forward voltage at a suitable current for the LED).

2
  • Thanks for the response, it does seem more reasonable to isolate the arduino from the mains voltage, and I didn't think about an optocoupler. Am I correct that your second circuit would effectively provide the inverted signal of my original plan? (5V until the positive portion of the waveform, when it would be 0V) Also, your recommendation is to pin the arduino to the chassis ground at the input? Thanks!
    – mrmojo6
    Aug 25, 2017 at 20:52
  • Yes the output will be active low. No need to ground the Arduino, no.
    – Majenko
    Aug 25, 2017 at 20:54
0

your circuit will work, and can be simplified a little bit further. But it will work.

it is safer to use isolation, however. there are multiple ways to go about doing it.

the key here is to detect zero crossing, and start counting from there.

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.