0
\$\begingroup\$

If you want just to detect AC line (220VAC) existence using micro-controller, does using optocoupler has any advantages rather to simple RC circuit? Even if you want to meet EMC/EMI/Industrial considerations.

RC ZCD detector from ST app note AN2263 (GND is connected to main neutral):

enter image description here

Second method (AVR app note AVR182):

enter image description here

\$\endgroup\$
3
  • 1
    \$\begingroup\$ I would help if you put a link to the app-note. I found it: The microcontroller is supposed to be connected directly to mains. So galvanic separation is not an issue for this part of the circuit. \$\endgroup\$ – Oldfart Dec 8 '19 at 10:16
  • \$\begingroup\$ Yes. you are true, I didn't attention to this note! (So I edited the question). \$\endgroup\$ – electro Dec 8 '19 at 11:12
  • \$\begingroup\$ 1st cct will pass around 0.5 mA through the body diodes with 110 VAC. This may work flawlessly and may cause massive obscure problems. Doing this is an invitation to disaster. | The 1st cct uses two series resistors to allow use of resistors without mains voltage rating. 2nd cct doesn't. Current and power are inside resistor rating but unless resistors are mains rated you could get death of equipment and/or people. CCt is slightly safer - probbly just potentially lethal. \$\endgroup\$ – Russell McMahon Dec 8 '19 at 12:03
3
\$\begingroup\$

... does using optocoupler have any advantages rather to simple RC circuit?

Yes, several.

It's not obvious from the schematic posted but the circuit GND has to be connected to mains neutral. This then means that you have to consider the whole circuit live. That means there is a risk of electric shock and that you can't, for example, connect to a programmer while the circuit connected to mains.

It may be tempting to think that the neutral will be very close to 0 V with respect to ground but various fault conditions can cause the 'neutral' voltage to rise.

  • Polarity reversal. (Wired or plugged in backwards.)
  • Break in the external neutral (loss of neutral connection to your building or on the power to the circuit you are monitoring) can make your circuit neutral live.

I would go for opto-isolation unless the circuit was for mass production, was fully tested and there was no possibility of the user contacting the circuit. Otherwise use an opto-isolator.

\$\endgroup\$
2
  • \$\begingroup\$ Thanks @Transistor, yes it is true. But I added a new image to my question from AVR app note, how about this method? Is this solve the problem? \$\endgroup\$ – electro Dec 8 '19 at 11:13
  • 1
    \$\begingroup\$ @Transistor. That was also my first comment but in that case the whole circuits in the app note is unusable as you need a separate power supply as well. I am now leaning towards: "If you have to ask that question you should NOT use the ST app note AN2263." \$\endgroup\$ – Oldfart Dec 8 '19 at 11:21

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.