Go Down

Topic: Watchdog Timer (Read 494 times) previous topic - next topic

BBX

Hi,

I'm fairly new to Arduino and programming in general.
I recently made a quick sketch that would have a servo lock a door. While searching around for ways to make it more efficient, I read about the Watchdog timer.

I'd like to know how the watchdog improves efficiency, as far as I can tell, all it does is protect code from hanging. Can it also be used to make my arduino enter a power save state for ~8 seconds between cycles?

retrolefty


Hi,

I'm fairly new to Arduino and programming in general.
I recently made a quick sketch that would have a servo lock a door. While searching around for ways to make it more efficient, I read about the Watchdog timer.

I'd like to know how the watchdog improves efficiency, as far as I can tell, all it does is protect code from hanging. Can it also be used to make my arduino enter a power save state for ~8 seconds between cycles?


The watchdog timer has little or nothing to do with inefficiency or power savings. A watchdog timer is a device to help you protect against software/hardware failures that could cause a critical failure or critical fault to go undetected. It's designed to restart a program or to try and perform error recovery functions. Think of it as a optional 'oh hell' hardware interrupt that you can enable.

What you need to research are the various power saving modes that are available in the AVR controller chip. The Arduino supplied functions in the IDE do not cover or utilize power saving modes, but there have been many many posts in this forum that explain and show their possible uses.

Good luck;
Lefty

BBX

Thank you for clearing that up for me!

I guess the original post I read that lead me wrong was this one:
http://interface.khm.de/index.php/lab/experiments/sleep_watchdog_battery/

Of course, now I can see that it mentions sleep functions separate from Watchdog.

I'll look into the power modes, though from what I've already read on them, I don't think they'll work for me. I'd like my arduino to wake up every three or four seconds and check for a state change on a button. Interrupts haven't been working at all for me for some reason.

Thanks again.

Go Up