Why do you need an External Hardware WatchDog on an Arduino or Raspberry Pi?
The reason is the internal watchdog is disabled in the boot loader for the Arduino and the Raspberry Pi watchdog is unreliable and difficult to use. The SwitchDoc Labs Dual WatchDog Timer is designed to make small computer such as the Arduino and Raspberry Pi more reliable by detecting and recovering from computer or software malfunctions. It has two WatchDog Timers that can be used independently or together to reset non-responsive computers. It directly can drive the Arduino Reset line, the Raspberry Pi B/B+ and 2/3 reset line or a to a relay to reset a Raspberry Pi.
Documents
- You can download the Dual WatchDog Product Brief here (Version 2.02 as of December 12, 2016).
- You can download the Version 1 Dual WatchDog Product Brief here.
The SwitchDoc Labs Grove/Pin Dual WatchDog Timer is based on the 555 timer IC running in astable mode. The 555 timer acts as a “continuous” pulse generator. The pulse starts on power up or any time the trigger input is brought to ground. The setting of the TM1 potentiometer determines the length of the pulse (30-240 seconds). When the pulse ends the Arduino Reset output is taken to ground (and the PulseHigh output goes to VDD) for approximately 200ms. Then the cycle starts over again.
Learning About WatchDog Timers
Here is a recent series of articles by SwitchDoc Labs about WatchDog Timers.
Features
- Grove Connector
- Works with Pin Headers
- Dual Independent WatchDog Timers
- Arduino and Raspberry Pi Compatible
- LED Timer State Indicators
- 3.3V or 5V operation
- Programmable timeout from 30-240 seconds
- Open Drain or Pulse Driven Operation
- Low Power
- Low Cost
- Full Test Code Supplied
Note: For boards version 110216-01-001 and earlier, Pin 1 and Pin 2 of the Grove Connector needs to be connected to VDD for the pin header inputs to work correctly.
Read more: http://forum.switchdoc.com/thread/283/documentation-model-connection-watch-dog?page=1#ixzz4mRZmLyJX
Where is TP3 / COut on the USB PowerControl Board?
The WatchDog board and the USB PowerControl board are often used together.
If you look at the pin locations diagram in the USB PowerControl specification, you will see the TP3 test pad marked. This is the COut / TP3 signal mentioned in the specification. It is also clearly marked on the board itself. Since it is in an image, a keyword search will not find it.
Read more: http://forum.switchdoc.com/thread/882/cout-tp3-usb-powercontrol-watchdog?page=1#ixzz5knVtLvqa
Software
The software on the Raspberry Pi and Arduino is very straightforward.
To use a single timer on the WatchDog board, you connect a GPIO line to the DOG1_TRIGGER input. This GPIO pin needs to be set to high-impedance mode (input mode) when the trigger is not being applied to avoid interfering with the charging process of the 555 timer.
The Code for "Patting The Dog" in Python and Arduino
To “pat the dog” or trigger the External WatchDog Timer, you need to use the following code. Since the line has to be held in high impedance mode and then just taken to ground when you pat the dog, the code for the Arduino looks like this:
#define RESET_WATCHDOG1 9 void ResetWatchdog1() { pinMode(RESET_WATCHDOG1, OUTPUT); delay(200); pinMode(RESET_WATCHDOG1, INPUT); Serial.println("Watchdog1 Reset"); }
And in Python for the Raspberry Pi, the code looks like this:
#define RESET_WATCHDOG1 18 def resetWatchDog(): GPIO.setup(RESET_WATCHDOG1, GPIO.OUT) GPIO.output( RESET_WATCHDOG1, False) time.sleep(0.200) GPIO.setup(RESET_WATCHDOG1, GPIO.IN)
You put these functions in your code such that you pat the dog more often than Wto. Wto is defined as the maximum amount of time the WatchDog Timer can count before it needs to be reset (in other words, when it will reboot the computer if the computer goes away).