July – Is the AC on?

No, not the air conditioner, the alternating current. In this problem, we discussed ways to have a microcontroller tell if the A/C mains are energized. We first brainstormed some solutions:

  • roll your own circuit (opto isolators, transistors, …)
  • USB phone charger
  • Coulomb counter / Split core transformer (link)
  • 1M resistor
  • Wall wart
  • Light bulb and CdS sensor (link)
  • Extension cord with neon light (link) + photo transistor

We talked about the problem.  Do you just want a 1 bit answer (on/off) or do you want to detect voltage sags.  Over what time period do you need the answser?  Milliseconds or seconds?

It was stressed that when working with mains power, you need isolation (like a transformer or opto-isolator) to avoid the potential for getting shocked.  More info here.  Some cheap wall warts are not isolated.  Check for UL approval.   A 1M resistor is not isolated.

For 1-bit answer, USB phone charger with a pulldown resistor seems the easiest solution.