Pages: [1]   Go Down
Author Topic: Watchdog Timer  (Read 475 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 58
No time to learn
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 362
Posts: 17307
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 58
No time to learn
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1]   Go Up
Jump to: