Introduction: Simple (hardware) Watch Dog Timer for Arduino Projects

We all use and love the Arduino boards for our projects. But sometimes it can happen, that a software or hardware error causes a lot of frustration, by stopping out little board from running 24/7.

For this reason Arduino has a built in WDT (Watch Dog Timer), but in some of my projects (working a lot with external libraries) I found that the on-board solution doesn't always work as expected.

To resolve this issue, I have designed a simple external WDT, to monitor my project and reset the board if it seems to be stuck somewhere.

Step 1: Theory - What Is a WDT?

A Watch Dog Timer is a standard solution, realized via an internal or external circuit, that awaits and gets a pulse from your running app in the project every X milliseconds or even seconds.

If this pulse arrives in time, the WDT doesn't do anything, just waits for the next pulse, but if no pulse arrives in the given time frame, the WDT will initiale a reset of the system, freeing it from a deadlock or error state.

Each Arduino board has a dedicated Reset pin, that will restart the hardware on a short negativ running pulse.

Step 2: What's in the Circuit?

The design I made uses a simple 555 timer chip to measure the time frame where a pulse should arrive from the Arduino board.

I used the missing pulse detector circuit that can be found in the usage notes of the 555 timer datasheet.

In the attached circuit, I use the values R5 = 220 K Ohm and C3 = 10 u F which gives you a charge time of about 2.42 seconds.

You can set your own time limit by changing R5 and C3. Use the 555 monostabil formula to calculate your time: T = 1.1 * C3 * R5

Each new pulse from the Arduino will reset the 555 chip's charging capacitor (C3) with the help of the transistor (Q1), never allowing the timer to actually reach it's threshold.

But if the Arduino board stops sending pulses to the WDT, the 555 chip will charge it's capacitor (C3) and change the state of it's output pin. This will pull down the capacitor (C1) on the output, allowing a single pulse to activate the 4N35 opto-isolator, that will pull down the reset pin of your Arduino board for a few milliseconds.

You wouldn't need the isolator to to reset your project in theory, but I found that this is a nice way to keep the extra burst of power sent by the output capacitor (C1) reasonably low, when the WDT starts getting new pulses again.

Step 3: How to Use It?

All you need to do is, to add a function in your project's code, and call this function before the WDT charges up and resets your board.

Well, first you should define your WDT pin "in" before your setup() call:

const int WDTPin = 4;

pinMode(WDTPin, OUTPUT);

Now for the function:

void Reset_WDT() {

digitalWrite(WDTPin, LOW);


digitalWrite(WDTPin, HIGH);


That should be all. Just connect the WDT circuit Input pin (H1 - 1) to you WDTPin (in this example pin 4). Your WDT circuit RST pin (H1 - 2) to the Arduino Reset pin, and wire Arduino's 5V and GND pins to the WDT 5V (H2 - 1) and GND inputs (H2 - 2).

Just remember to call the Reset_WDT() function in your code, before or after and part that could take long time.

And if your board should hang at some point, the WDT will reset it, so that it can start from square one again.

Step 4: Hardware

I have quickly designed a PCB layout of this circuit with EasyEDA, and uploaded the Gerber files here.

You can send them to your favorite PCB manufacturer and get it made, if you don't prefer to do a proto-board by hand for this.

But I have to point out: I have designed the PCB layout, but never had it made. So, it should work, but keep your eyes open for any mistakes I might have built into it.

My version of this circuit is made by hand on a proto-board, and works without problems.

(also I didn't have a THT 555 at hand, so I used one side of a 556 timer, which is the same, but twice. :) I will try to upload some pictures of my running board later on.)