I sometimes have home automation projects that require detecting AC voltage (on/off only), previously have experimented with non-contact AC detection. Here is another approach that may be more suitable for low-power AC detection node: using a NE2 neon lamp and an LDR
The bulb will reduce LDR’s resistance and the circuit will read LOW when AC is present and HIGH when it is not (reversed logic). Since the weak pull-up resistor is 150K, this can run on battery operated node in sleep mode with pin change interrupt approach.
Here are some pictures how the sensor came along:
Relatively safe and isolated, cheap to build too. Be careful when playing with AC.
Nice idea, but wouldn’t an (AC) optocoupler be simpler to use? No ‘mechanical’ work involved, safety approved. Same power usage (I mostly use something like LTV814S with 150k series resistor on input and internal uC pullup on output). Putting an additional P4SMA200CA in series on the input adds a certain degree of AC voltage discrimination (or ‘measuring’) by modulating the pulse width according to input voltage.
Just some ideas ….
BR, Jörg.
Good comment, I only had these parts handy and went for DIY. Quick and dirty as well.