Sunday, August 18, 2019
Saturday, 16 June 2012 20:32

Arduino and watchdog timer

arduino-wdt Have you ever encountered situations when your Arduino-based device hangs?

There are many reasons for this - from millis() overflow in 49 days to moisture in outdoor sensors (causing them not to respond)...

But what if your device is not easily accessible and\or works for long periods without human supervision? Such situations should be prevented in this case. You don't want your plant watering system that you left to look after your plants and flowers during your vacation to hang on the second day, leaving your loved plants without water, really?

Most MCUs, including those used in Arduino, has a special feature, called Watchdog timer. Once it is configured, it checks for 'heartbeat' signals (or commands) that your MCU should issue. As soon as the time since the last pulse exceeds configured treshold, watchdog initiates reset sequence. This is really convenient, and ensures that your system will be in hanged state for no more than watchdog threshold.

I once encountered sudden hangs of my standalone arduino-based device. I run all possible tests, double-checked all circuitry, replaced MCU - with no effect. Finally I examined wires to external OneWire DS18B20 temperature sensor. The resistance between Vcc and GND was 600 Ohm! Then I looked through the window - it was foggy and raining... The insulation of the sensor was rather old and had a leak. As soon as I disconnected the wires leading from the sensor all problems were gone.
Semyon Tushev

I don't know, why there's not even a word about this in Arduino docs. Such things save a lot of trouble.

Published in Arduino


Here I publish articles related to my areas of interest, my brief notes that may save some time to others, as well as some of my works.

This site is a work in progress. I will add more sections in the future, such as

  • More photos to photogallery
  • More Joomla!-related articles
  • ...



New Posts

Spam/Forgery Notice

If you've received a spam email from, please know that this emails are...

07-03-2019 in Blog


Using dynamic GeoIP module with nginx (CentOS)

nginx introduced dynamic module support in v. 1.9.11. This brief article provides step-by-step procedure...

13-04-2016 in Linux, BSD, Unix


Visual difference between pseudo and true random data

This is is "random" image generated using PHP rand() function: And this is an image...

20-11-2015 in Blog

Scroll to top

We use cookies, just to track visits to our website, we store no personal details Privacy policy