I'm currently designing a circuit controlled by GPIO to switch my central heating on/off via a relay (using a suitable transistor). I think I've got to grips with it, but I want to add a failsafe.
If the program controlling the circuit crashes or the Pi hangs, I understand that any GPIO pins will remain in the state they were set at. So if my heating is on (GPIO pin high) the heating will stay on in the event of a crash.
I want the circuit to go low and the relay to deactivate if something goes wrong. I've looked into the built-in Broadcom watchdog which will reset the Pi. That sounds great, but then I have to rely on the GPIO pins I'm using being in a low state at boot -- apparently that's bad practice and could change in a future firmware or kernel.
So I thought that a hearbeat coming out of the GPIO pin would be more appropriate to drive the circuit. The circuit would remain high only if a heartbeat pulse was received in the last x seconds.
This is where I'm stuck. What component should I drive from the GPIO pin with a heartbeat? I thought maybe a 555 timer in monostable mode acting as an active high trigger? Am I on the right lines? But then what happens if the heartbeat pin gets stuck high?!
