I recently learned about watchdog timers, and am trying to implement one for my circuit for the purpose of resetting my (AVR) microcontroller if it hangs (i.e., doesn't respond to the watchdog).

Based on some research, it appears to me that there are around four options:

  1. Connect my microcontroller with an external dedicated watchdog-timer-specific IC.
  2. Connect my microcontroller with an additional microcontroller (some very basic, inexpensive one), the latter coded for the sole dedicated purpose of watchdog-timing.
  3. Lay out my own 555-timer-based watchdog circuit and connect it to my microcontroller.
  4. Use the internal watchdog timer capability on my microcontroller.


Which of the above approaches would you rank higher and why?

I would like to set a watchdog time of around 6 seconds, based on certain criteria for the way I'm making the rest of my design and code (the device will be a battery-powered, periodic temperature logger).

A little note: My preference would be Option 1, for simplicity, however, based on the couple I have found, these parts either appear to be expensive (I'd like a solution under 1.25 USD at most), or only allow only less than 2 seconds for the watchdog timing period.

  • 1
    \$\begingroup\$ 4) is cheap and simple. Is your objection only that you can't set it to 6 seconds? That's quite a long time by microcontroller standards \$\endgroup\$
    – pjc50
    Oct 12, 2012 at 16:47
  • 1
    \$\begingroup\$ @pjc50: It is definitely cheap :) And even the 6-second timing is possible I believe. However, articles like this one suggest that the internal watchdog may not be as robust as a dedicated external one. And the reason for the 6 second time is, on my microcontroller, I have an Arduino bootloader which includes a wait time of 4 seconds on first start. (I could learn to re-program this but that is still on my learning curve) \$\endgroup\$
    – boardbite
    Oct 12, 2012 at 16:53
  • 1
    \$\begingroup\$ You should definitely fix the bootloader. The 4 seconds of waiting are 4 extra seconds of battery consumption which you can get rid of. Instead of waiting, have it e.g. sample a dedicated pin which is pulled down when in deployment. \$\endgroup\$ Oct 12, 2012 at 16:58

3 Answers 3

  1. More expensive, as you already found out. But it should give you the highest level of reliability: because the watchdog is completely independent of the microcontroller it will still keep running, and reset the microcontroller when the latter is on fire, so to say. See 4)
  2. Brian is against it, but there are cheap microcontrollers in a small package, like the PIC10F200 in SOT-23, which you can use as a retriggerable MMV (monostable multivibrator), which the watchdog actually is. If you would consider a 555, a 10F200 is better: no external parts, and more accurate timing (1% accuracy).
  3. a 555? Seriously?
  4. The internal watchdog will do if the dedicated IC is too expensive. If you're really paranoid you can think of a scenario where some hardware error will lock up the microcontroller and the watchdog with it. I've never known this happen, but I don't know how well you sleep.

Like pjc50 says 6 seconds is a long time. A typical microcontroller will execute tens of millions of instructions in that time, and then a lot can go wrong. Suppose you're controlling some load with PWM, and a low 10 % duty cycle keeps the dissipation low. Microcontroller goes bananas and the output gets stuck at a high level, 100 % duty cycle. The load doesn't like it, and dies. You don't want to wait 6 seconds for that to happen. There should be some part of your code where you pass much more frequenct. A main loop may be as short as 10 ms, then you could set the watchdog's timeout at 100 ms, for instance. If you kick the dog once every 10 ms, then a timeout means that you missed it 10 times! Once, OK, but ten times is disaster, and you have to take action. The load will be switched off after 100 ms instead of 6 seconds, which may be the difference between dead or alive.

  • 2
    \$\begingroup\$ @Nick - Nice that you like it, but actually I did spend more time writing the rest of the answer :-). \$\endgroup\$
    – stevenvh
    Oct 12, 2012 at 17:29
  • 1
    \$\begingroup\$ What's wrong with 555 timers? :) \$\endgroup\$ Oct 12, 2012 at 19:16
  • 3
    \$\begingroup\$ @Justin - There are people for whom a 555 is religion: you can solve all world problems and then some with a 555. Well, a 555 is quite versatile, typical applications are monostable and astable multivibrators, PWM, but it's not the best for everything. In this question/answer OP spend a couple of weeks to design a 555 circuit for a task which isn't made for. The same job could be programmed into a microcontroller in an hour. I'm not questioning OP's skills here nor his approach, as I understand it he had to use a 555... \$\endgroup\$
    – stevenvh
    Oct 13, 2012 at 15:40
  • 2
    \$\begingroup\$ Every time someone uses words like "absolutely" I feel compelled to find a counter-example. In this case: A microcontroller is more sensitive to cosmic rays and radiation than a 555, so IMO in some applications a 555 would be preferable in terms of reliability. \$\endgroup\$ Oct 14, 2012 at 11:10
  • 2
    \$\begingroup\$ @apalopohapa - I stand corrected. In spacecraft 555s may be a better choice than microcontrollers. Of course, computers made of 555s are (guesstimate) 15 orders of magnitude less accurate, larger, more power hungry, and not so easy to program in C++ or Ada... :-) \$\endgroup\$
    – stevenvh
    Oct 14, 2012 at 17:27
  1. Watchdog timer is simple, works, cheap. Ovbious choice.
  2. An additional microcontroller is overkill. It isn't helpful since you have to program it, it is more expensive, more area.
  3. This makes sense. But I would do 1 instead. More modern.
  4. I would use this if it works. They only question is can it be set to 6 seconds.
  • \$\begingroup\$ Thanks for the comparison. The only thing though is that #1 does not appear to be cheap! I haven't found any watchdog-timer-capable IC with quantity-pricing less than a dollar as I mentioned, whereas as you probably know, there are many microcontrollers (for option #2) that are less than USD 0.50. \$\endgroup\$
    – boardbite
    Oct 12, 2012 at 16:51

If your circuit/device is not controlling life-critical hardware, you can probably get away with using the internal watchdog. Otherwise (or actually, in any case) check out these two great articles from Jack Ganssle:



By the way, if you can't set watchdog to long interval, you can try the approach of waking up often enough to kick the watchdog, but only going the full taking measurements/writing logs thing once in a while.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.