# AC Watchdog Circuit

I've designed a small AC-based watchdog circuit for my Raspberry Pi (schematic below). A buddy of mine looked at it and said that it was complicated, and there might be problems with asymmetric charge/discharge of the two capacitor's will be dependent on the rate & duty cycle of the watchdog tickle signal. I'm planning on tickling it with a software watchdog timer at around a 1Hz rate (the software watchdog will be running at sufficient priority to make that happen). VREF_MID is a resistor divider providing 2.5V.

Any problems with the circuit that jump out at anyone?

Circuit diagram http://www.krten.com/ac.jpg

• Can you tell us what you're feeding? i.e., a digital I/O or reset pin? It's not clear what the output of your circuit is supposed to do. Jan 19, 2016 at 23:24
• The output of the comparators goes through a 10k resistor to the base of a 2N2222 to drive a relay. There's more to the entire circuit; another capacitor/resistor/comparator circuit accomplishes a 90 second "holdoff" timer to allow the Pi to boot. Once the 90 seconds have elapsed, the holdoff powers the other half of the relay coil. When both circuits are active (meaning 90s has elapsed, AND the watchdog has failed), the relay trips and resets the Pi (and a bunch of other stuff). Jan 19, 2016 at 23:26
• Back in my day, we used to kick the dog. Jan 19, 2016 at 23:38

simulate this circuit – Schematic created using CircuitLab

Figure 1. Detection circuit using AC charge pump.

Would this circuit work for your application? C1 passes alternating signal through, D1 and D2 charge C2 which holds on the relay as long as the AC tickle runs.

I haven't worked out component values.

## How it works

• As the left side of C1 rises and falls so does the right side. If the right side goes negative D1 conducts and holds it slightly below zero.
• When the tickle goes high the right side of C1 goes high. D1 is reverse biased and D2 is forward biased. Some charge is transferred from C1 to C2 raising its voltage.
• After a few cycles C2 voltage will be high enough to turn on Q1 and RLY1.
• If the tickle stops alternating - either fails high or low - no charge will be pumped and C2 voltage will decay through Q1. The relay will drop out.
• If the AC tickle gets stuck at GND, doesn't that just keep the relay ON? Jan 19, 2016 at 23:39
• 'How it works' added. Jan 19, 2016 at 23:47
• I like it. It's definitely simpler than my circuit. I'm experimenting with capacitor values to make it work like my circuit -- that is, a relatively symmetrical 9 second trigger. With 2 100uF caps, it's rather asymmetrical with one side being less than a second and the other being closer to my goal of 9s. Experiments are proceeding :-) Jan 20, 2016 at 0:12
• Change Q1 to a small N-channel MOSFET with a suitable discharge resistor in parallel with the capacitor. Much easier to get longer delay times when your capacitor doesn't have to supply all that base current. Jan 21, 2016 at 20:43

I have used diode pumps like transistor has shown .I have always used a mosfet with a 1 meg gate source resister .This has meant that I have not needed electrolytics .I have never used the drain into a relay .I have always placed a 1K resister in series with the AC input.You could also use an exclusive OR gate or for that matter an exclusive nor gate .HC86 could be a start.I have not done the exclusive or gate because the mosfet and diode pump have worked for me .These days I find that the firmware people do not need Watchdogs .

• Is it symmetrical in terms of trip times for fail-on and fail-off? Jan 20, 2016 at 13:00
• The AC watchdog in general does not have equal turn on and turn off times . Jan 28, 2017 at 23:29