How do I setup a hardware watch dog timer with an Arduino?
Best Answer
There are a number of dedicated hardware watchdog chips available, but it's easy enough to do using a regular 555 timer IC and a couple of supporting parts. With the 555 configured in astable mode with a very long "HIGH" period and a relatively short (perhaps 0.3 seconds) "LOW" period, the output can be connected to the Arduino's reset pin via a diode to make the watchdog an open-collector device. The Arduino can then periodically reset the watchdog using a digital output to turn on a transistor that discharges the timing capacitor attached to the 555, preventing it ever reaching a trigger point that will cause it to reset the Arduino.
An alternative would be to use a time delay relay designed for industrial control systems, such as this 820 Series from Magnecraft. This relay could be set in 'inteval mode" and installed in series with an existing toggle switch (on the load side). Then you would just turn the mixer on, and the relay will limit the run time of the mixer to the programmed time. turninh the power switch off and on again would initiate a new cycle. Turning off the switch will immediately stop the cycle.
So, since you mentioned that you're using an Arduino which comes with a 16 MHz crystal, to achieve an interrupt frequency of 24 Hz the value of the compare match register (OCR1A) should be 650, given a prescaler of 1024.
If you want to change the BPM, you'll have to set OCR1A on the fly.
Best Answer
There are a number of dedicated hardware watchdog chips available, but it's easy enough to do using a regular 555 timer IC and a couple of supporting parts. With the 555 configured in astable mode with a very long "HIGH" period and a relatively short (perhaps 0.3 seconds) "LOW" period, the output can be connected to the Arduino's reset pin via a diode to make the watchdog an open-collector device. The Arduino can then periodically reset the watchdog using a digital output to turn on a transistor that discharges the timing capacitor attached to the 555, preventing it ever reaching a trigger point that will cause it to reset the Arduino.
Some basic information about a project to do this is available at http://www.practicalarduino.com/news/id/471