A common challenge when working with embedded systems is keeping track of real time. Luckily, most microcontrollers have timers that can be used with a precision quartz crystal — already present for the CPU clock — to keep track of real time. In this video tutorial, we show how you can use the timer interrupts on an ATMega168 chip to make a simple timer. Building off of this, it is possible to make your own reasonably accurate alarm clock, create systems to perform timed automated tasks, or create a multitude of other projects.
Crystal Real Time Clock – [Link]