> Use a diode off one side of the mains transformer's secondary, through a > largeish resistor, to a PIC pin, to detect AC cycles. (Keep the current > through the protection diodes low so you don't mess yourself up, by > large enough resistor value. 100kish or so?) > uh, guys... There are some impressive voltage spikes running about on the power lines. An optocoupler is a better solution, and you presumably will need some isolation anyway at the output end if it's to interact with a human.