A while back we saw a logic clock that used the alternating current frequency from the power grid to keep time. We asked for information on your projects that use this method and we got a lot of comments and tips. Today we’re sharing [Doug Jackson’s] method which he used in his word clock.
The schematic above is from that project and we’ve outlined the important part in green. [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 file but he sent us the C code pertaining to this timing circuit. It’s written for PIC but you’ll have no trouble adapting it to other microcontroller families. Take a look after the break.