How to use the Watchdog with your industrial PLC

January 4, 2019 by
How to use the Watchdog with your industrial PLC
Boot & Work Corp. S.L., Support Team

In this post, we will see how to use the watchdog and what is the limit for your industrial controller Arduino designed for industrial automation.


Ethernet or 20 I/Os PLC Arduino:      Ethernet PLC        20 I/Os PLC

Watchdog library:  avr/wdt.h library

What is the watchdog?

Watchdog is an electronic timer that allows to reset the system in case of computer malfunctions and recover from it.

Watchdog consists of a decrementing timer, when the timer reaches zero the system resets. Then you always have to refresh the watchdog.


You should use the Watchdog library  “#include <avr/wdt.h>” provided by Arduino in order to program our own Watchdog.



wdt_reset()   __asm__ __volatile__ (“wdr”)


WDTO_500MS   5


WDTO_1S   6


WDTO_2S   7


WDTO_4S   8


WDTO_8S   9

IMPORTANT: The Ardbox PLC watchdog cannot work under 500ms. There are no limitations for M-Duino PLC.

Below you will find an example about how to use it: the Watchdog lib

   Copyright (c) 2017 Boot&Work Corp., S.L. All rights reserved

   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   GNU Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public License
   along with this program.  If not, see <>.

#include <avr/wdt.h>

void setup() {
  // Set the watchdog on 500 ms 

void loop() {
  // Refresh the watchdog

  // WORK HERE, but faster than 500ms
  Serial.println("Watchdog is working if you don't see the points");


Got questions about our open source based devices?

Contact our technical sales team to solve your doubts. We are waiting for you!

​Search in our Blog

How to use the Watchdog with your industrial PLC
Boot & Work Corp. S.L., Support Team January 4, 2019
Share this post

Looking for your ideal Programmable Logic Controller?

Take a look at this product comparison with other industrial controllers Arduino-based. 

We are comparing inputs, outputs, communications and other features with the ones of the relevant brands.

Industrial PLC comparison >>>