5
\$\begingroup\$

I need to detect a AC mains outage, isolated way. Output marked as [?] goes to AVR MCU. I don't need to detect undervoltage or zero-crossings. I actually need a simple feedback to MCU interrupt which will trigger interrupt only in mains outage. MCU are powered from UPS. I've picked following circuit found on the net based on PC817, but adjusted C1/R1 to 230VAC.

ac mains detector circuit

Any errors, i.e. will this work? Suggestions/comments on parts/values are welcomed.

\$\endgroup\$
3
  • \$\begingroup\$ Newbie question: Is the idea that C3 charges during the half cycle that the optocoupler is switched on, and discharges slowly enough during the "off" half cycle that the signal level is maintained? \$\endgroup\$ Commented Sep 14, 2023 at 16:12
  • 1
    \$\begingroup\$ @AdrianMcCarthy, yes, but not only that. Note the resistance of R3 are pretty high. RC time constant is a way higher than 1 half period of 50 Hz. So it also adds some delay when mains AC "disappears", forming a sort of hysteresis combined with that. I'm not sure if I'm accurate on the terminology here though. \$\endgroup\$
    – NStorm
    Commented Sep 20, 2023 at 23:06
  • \$\begingroup\$ can you replace R1 with R1 series with C1 and directly connect the cathode side of D1 to AC input1 \$\endgroup\$
    – Hamid s k
    Commented Mar 8 at 9:37

2 Answers 2

5
\$\begingroup\$

Simply use something like HCPL3700, which is basically your circuit in one package. You only need one input resistor and bypass cap to make it work.

Note, that either your circuit or HCPL3700-based one are not actually "isolated", but rather "optocoupled", because you still have to connect wires to mains somehow, so full voltage is present at least on part of the board.

Truly isolated circuit would be something like Non-contact voltage (NCV) sensor found in some multimeters. For example circuit like this or this can be used without ever coming in contact with mains.

\$\endgroup\$
2
  • 2
    \$\begingroup\$ I always thought that "isolated" and "non-contact" aren't the same thing. Optocoupler also called "Opto-isolator", because it provides galvanic isolation. I don't actually need NCV, any sort of galvanic isolation should be fine for me. I've picked OC because it seems to be reliable, low cost & footprint solution. \$\endgroup\$
    – NStorm
    Commented Jan 24, 2020 at 13:14
  • 1
    \$\begingroup\$ All I meant is that your circuit has mains voltage on it. Nothing wrong with it, except you have to make sure it is safe to handle. For example, you can use old wall adapter from some device, replace its electronics with your circuit and 2-conductor cable with 3-conductor, close everything up and have a safe device that you can simply plug into wall socket you want to monitor. \$\endgroup\$
    – Maple
    Commented Jan 24, 2020 at 15:57
5
\$\begingroup\$

Actually circuit from my questions confirmed to work flawlessly in real environment for a few months now. Here is a pic of device which utilizes this circuit (lower left HV area corner): enter image description here

\$\endgroup\$
3
  • \$\begingroup\$ Can you add your parts BOM, what capacitors have you used? \$\endgroup\$
    – Jay Dee
    Commented May 11, 2023 at 11:22
  • \$\begingroup\$ @JayDee, don't have this at hand, but iirc R1 are 47K Ohm 1W Flameproof Metal Oxide Resistor, C1 are X-class capacitor (picked due to it's properties, not a "classical" X-type application across the lines). C3, R3 are some basic cheapest SMD-mounted parts (the are in low voltage area). Rest is noted on schematics. \$\endgroup\$
    – NStorm
    Commented May 15, 2023 at 13:19
  • \$\begingroup\$ Its c1 im not sure what to use, i would like to order a pcb from jlcpcb to zero cross detect an ac line in order to identify current flow direction and this looks a good starting point. \$\endgroup\$
    – Jay Dee
    Commented May 15, 2023 at 22:42

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.