What is the fastest mains outage detector at <1ms? Anything that uses a 12V DC adapter or a mechanical relay is not an option for me because it has a long delay.

Is there an AC driven static/solid state relay/switch?

Or maybe an AC-DC converter using a diode/resistor just to trigger a solid state relay around 3-32V DC? is this fast?

What I need is at least a sensor/switch that can act as fast as possible after the mains outage so that a microcontoller can switch the AC load to a different source like an inverter within <10ms. As I know, computer power supplies and some AC-DC adaptors have a hold-up time of 16ms.

  • 1
    \$\begingroup\$ Instead of asking for products (which is off topic here) you might have a better chance of getting a helpful answer if you describe what problem you're trying to solve. You're thinking in relay type solutions while that might not be the proper solution for your problem. \$\endgroup\$ Nov 4, 2019 at 21:12
  • 3
    \$\begingroup\$ Are you aware that 60 Hz has a period of 16.7 ms? That makes detection within 1 ms difficult. How do you define an outage? \$\endgroup\$
    – Justin
    Nov 4, 2019 at 21:12
  • \$\begingroup\$ thank you for your responses. I am trying to make an Offline UPS but how do Offline UPS's be able to switch between 2 AC sources at <16ms? \$\endgroup\$
    – selnet
    Nov 4, 2019 at 21:22
  • 1
    \$\begingroup\$ @selnet most UPSes use some form of DSP to detect when the input sine wave no longer matches a reference sine wave. That gives the ~1ms response even when near the zero crossing. There's probably some analog method for doing it also. \$\endgroup\$
    – Aaron
    Nov 4, 2019 at 21:36
  • 2
    \$\begingroup\$ Most loads won't fail if input power is out for 1 or 2 cycles. Incandescent lamps have thermal mass. Motors have rotational inertia. AC-DC supplies have input capacitors. These will let the load continue to operate for a few 10's of ms if the input power fails. \$\endgroup\$
    – The Photon
    Nov 4, 2019 at 21:36

1 Answer 1


If you really wanted sub-half-cycle detection, I guess a dual-supply comparator zero cross circuit where if the voltage is within some +/-V limits close to 0V starts a timeout timer. If the voltage exceeds these limits leaves the boundaries then the timer gets stopped and reset.

Pretty trivial to build if you connect an open-drain comparator with some diodes and resistors to an MCU pin with some code. You'll need a small bipolar voltage supply for the comparator. I also recommend adding an opto in the signal chain somewhere for isolation.

You'll need two of these: one for the upper bound and one for the lower bound near zero. You can feed to an AND gate to save an MCU pin or feed both comparator outputs to two MCU pins and handle the rest in software.


simulate this circuit – Schematic created using CircuitLab

NOTE: Beware isolation and safety issues, as well as common ground issues with AC mains and MCU circuit. I have not addressed these in the design.


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.