[Doug] pulls a signal from the 9V AC power before it hits the bridge rectifier, using a 100K resistor and a zener diode to protect the microcontroller pin. The code for that project comes as a hex ...
as mentioned by several readers, you’ll want to use a 5 volt regulator ic instead of the resistor/zener-diode combo i ... which will give your 9 volt a longer battery life.