Ceska verze

The simplest digital real time clock with AVR

     This is probably the simplest possible real time digital clock. It displays real time in the HH.MM form (Hours.Minutes). They are microprocessor controlled using Atmel AVR ATtiny2313 (ATTiny2313, ATTiny2313V). The program (in Assembler or in HEX file) can be downloaded for free below. There's also the configuration bits setting shown. The clock display is a four-digit LED display. Cathodes of displays are connected to port B, anodes to bits 0, 1, 4 and 5 of port D. Using superbright LED display allows you to omit the current amplifying transistors. The display is controlled multiplex (matrix) way and connected as multiplexed displays usually are. I built it from 2 two-digit displays DA56-11SRWA. In the 2nd piece of the clock I have used two LD-D056UR-C, that have even higher brightness and are internally connected into multiplex, so it reduces number of traces on the board. Setting is done simply by pressing "clock" and "minutes" buttons. Resistors R1 and R2 protect IO1 in case that the pins PD2 and PD3 were accidentally programmed as outputs. Theoretically, they can be omitted after succesfull test. Resistors R3 and R10 determine the current display and thus its brightness. They are chosen not to exceeded the maximum output current (40 mA). The clock is powered from a supply of about 5V. ATTiny2313 operates from 2.7 V, ATtiny2313 and ATTiny2313V already operates from 1.8 V. With such low voltages the display would not light up, but it's usefull when adding a backup battery. Consumption at 5V is about 15 to 30 mA dependent from the number of segments shining (most is the consumption of the LED display). The clock is controlled by 4MHz crystal (XTAL). The clock speed can be fine adjusted by modifying the values of C1 and C2 (lower value = faster). You may also like The simplest LED alarm clock with AVR.
     The program for download:
source code in Assembler (ASM)
compiled in HEX file (372 B)
How to write the program into the AVR is described here.

I can send you the programmed microcontroller. For more info click here.


The schematic of the simplest real time clock with Atmel AVR ATtiny2313.


Configuration bits setting in PonyProg.
(Hexadecimal values are Low Fuse: FD, High Fuse: DF.)


The clock (buttons will be on cables).


Testing the clock in breadboard (using BQ-M512RD display wiht low brightness).



Added: 15. 3. 2012
home