A watchdog IC is a small hardware device that monitors your microcontroller. If the MCU stops responding or freezes, the watchdog forces a reset or disables motors, preventing runaway behavior.
Software can fail due to:
- Crashes or infinite loops
- Peripheral lockups
- Timing errors under load
A hardware watchdog ensures that loss of control always triggers a safe shutdown.
- MCU sends a periodic “heartbeat” to the watchdog
- If the heartbeat stops, the watchdog resets the MCU or disables motors
- Place the watchdog on a stable logic supply, independent of noisy motor power
Example (conceptual):
void loop() {
// Normal robot logic
toggleWatchdogPin();
}
Instead of simply toggling a pin, a freshness counter can be sent to the watchdog:
- MCU increments a counter on each loop and sends it to the watchdog
- Watchdog triggers a fault if the counter does not increase
- Prevents “stuck” signals or repeated pulses from fooling the watchdog
Benefits:
- Detects software that is running but stuck in a repeated state
- Provides stronger safety against subtle lockups