Mains Power Detection, Minus the Mains
I wanted an ESP8266 to answer a simple question: is mains power available? The ESP8266 was willing to help, provided nobody introduced it to 230 V. An ordinary isolated 5 V wall adapter already gives us a useful signal: its DC output disappears when its mains supply disappears. We can watch that output and leave the mains side inside the adapter, where it belongs. Two resistors make the voltage suitable for the development board's ADC. The slightly less obvious requirement is keeping the observer alive when the thing being observed switches off. ...