background preloader

Arduino, Zigbee and Embedded Development: Sleeping Arduino - Part 5 Wake Up Via The Watchdog Timer

Arduino, Zigbee and Embedded Development: Sleeping Arduino - Part 5 Wake Up Via The Watchdog Timer
OverviewWelcome to the fifth and final part of the "Sleeping Arduino" series, where we will cover how to wake the Arduino from sleep mode using the Watchdog Timer (WDT). When waking your Arduino from sleep, you could use one of the standard internal timers of an Arduino as I have detailed in Part 4, but if you are looking for the maximum sleep time and/or minimum sleep power consumption, you have the use the WDT;As I have mentioned in this table, the WDT can give us a sleep time of 8 seconds, whereas the 'longest' 8/18bit timer will only give us a sleep time of ~4 seconds.Watchdog Timer (WDT)The Watchdog Timer on the Arduino's microprocessor only has one source to drive it: it's own separate internal 128kHz oscillator (as opposed to the 8/16bit internal timers, which can use either the 16Mhz system clock or an external clock). The WDT also has a prescaler, which is used to configure the timeout period. It supports timeout periods from 16ms to 8 seconds: All parts of this series:

AVR Tutorial - Fuses AVR TutorialFuses ladyada.net Fuses are an extremely important part programming a chip, but are rarely explained thoroughly. You only need to set them once, but if you don't do it right, it's a disaster! Comments? You know about flash, eeprom and RAM as parts of the chip. The fuses are documented in the datasheets, but the best way to examine the fuses is to look at a fuse calculator such as the avr fuse calculator from the palmavr project Click on that link in a new window and select ATtiny2313 for the fuse calculations We'll use the Quick Configuration so use those menus, not the checkboxes The first option is how the chip is clocked. The Clock Source can be either of the following: External Clock, Internal 8MHz clock, Internal 4MHz clock, Internal 128KHz clock, External Crystal (0.4-0.9 MHz), External Crystal (0.9MHz - 3.0MHz), External Crystal (3.0MHz - 8.0MHz) or External Crystal (8.0MHz +) The Clock Startup can be either of the following: 14CK + 0 ms, 14CK + 4 ms, 14CK + 65 ms. text

AVR Fuse Calculator for ATmega328P This is a javascript based AVR fuse calculator. You must have javascript enabled to use this. There are lots of places with mouse-over text (alt-text) to provide some help. You can select a AVR chip from the dropdown menu at the top of the page. If a chip is marked as "similar", it means that chip has identical fuses and preset collections as the currently selected chip When you select another chip, the fuse settings from the current chip will be applied to the new chip (even if the chips are not similar). Presets are known defined settings available for the AVR chip you've selected. Manually manipulating the fuse bits will also cause the calculator to find the preset that matches the fuse bit setting. Be extra careful about anything with a star *, the star * means the setting is related to ISP programming. The AVRDUDE commands may be used as arguments with AVRDUDE to program the fuses. Please submit any bug reports or comments to this blog post Copyright 2009 Frank Zhao.

Setting Arduino fuses manually in AVR Studio Here is a little tutorial about setting the fuses on a blank ATmega328P in AVR Studio so you can use it with Arduino IDE: You need: a board where you have a ISP connector for a hardware programmer a blank ATmega328P a hardware programmer a USB-serial cable (or just a USB cable if your board has the FTDI chip on board) Insert your blank chip in it's socket, careful at the orientation, make sure you insert it with the little D shaped indentation in the same direction as the socket indentation. Plug your hardware programmer cable in the 6 pin male header labeled ISP, make sure the arrow on the connector is towards the marked pin (with a line) of the header. Plug the programmer into your computer's USB port, then plug the USB-serial cable into the board, make sure you plug it with the black wire in the pin marked GND, then plug the cable into your computer's second USB port (use a hub if you have only one USB port available). Let's take them one by one, top to bottom: Go to the Program tab:

Related: