Saturday, May 1, 2010

--> Programmable Alarm Clock Using the Atmel AT89C2051

This project uses the Atmel AT89C2051 Microcontroller with the Dallas DS1307 64 X 8 Serial Real Time Clock IC to build a Battery Backed Alarm Clock.SCHEMATIC
Click HERE for the schematic for this project.
THE DS1307
The DS1307 is a Serial Timekeeping Chip that will count seconds, minutes, hours, date of the month, month, day of the week, and year with leap year compensation. It has 56 bytes of nonvolatile RAM for data storage, 2-wire serial interface, a programmable square wave output, and automatic power fail detect and switch circuitry. The DS1307 requires the use of a 32.768 KHz quartz crystal with a load capacitance of 12.5pF for the internal clock oscillator circuitry. An external 3 volt battery is used to maintain the internal RAM data.
THE ATMEL AT89C2051 MICROCONTROLLER
The AT89C2051 is an 8-Bit Microcontroller with 2Kbytes Flash Program Memory. I prefer using this micro due to its quick programming and ease of use.
NOTES ON OPERATION
Four normally open pushbutton switches are used for user input to set the time/date and alarm time. The following illustrates the functions of each pushbutton switch.
P3.0 switch #1 will increment the time/date etc..
P3.1 switch #2 will decrement the time/date etc..
P3.2 switch #3 acts as the ENTER key, push this switch when you are finished with each setting.
P1.2 switch #5 puts the clock into set, or display alarm time mode.

Alway press the ENTER key when you finish each setting to move to the next setting. You can use the ENTER key to move to each individual area of the display until you get to the function you wish to set. Operation of the alarm is handled by the DS1307 pin-7 SQW/OUT. This pin is a programmable square wave output.
The SQW/OUT pin is programmed to output a 1Hz square wave and pulse the alarm buzzer at a rate of 1 beep per second for the alarm. This pin may be programmed to output different frequencies of 1Hz, 4KHz, 8KHz and 32KHz. using these higher frequencies however would result in a steady tone for the alarm buzzer, instead of the intermittent beep like most alarm clocks.
You can refer to the schematic to see how the 2N2222 NPN Transistor is setup to drive the alarm buzzer. Make sure to use an alarm buzzer with an internal resistance sufficient to keep from over loading the transistor.
ALARM OPERATION
The code that comes with this project will sound the alarm buzzer for 1 minute, then turn the alarm off. You can easily modify this routine to leave the alarm on for any length of time. The time and alarm settings you set are stored inside the DS1307 nonvolatile RAM area and will remain unless you remove all power from the circuit, including the external battery backup.
The DS1307 has an internal power sense circuit that will automatically switch to the external battery power supply when it detects a power failure. I have included the complete data sheets for the DS1307 and the Atmel AT89C2051 in the file clock.zip to help you with this project.
The code for this project will also require that you use a 16 X 2 LCD, unless you modify it to use another. The LCD is operated in 4-Bit Mode because of limited I/O using the AT89C2051 Microcontroller. You can use any 8051 derivative Microcontroller for this project that you would like, the code should be compatible with any 8051 variant. You may want to modify the pin assignments for whatever I/O you will have available. Any 8051 type micro with 13 available I/O pins will work just fine.
PARTS LIST
1 Atmel AT89C2051 Microcontroller, or any 8051 variant with 13 available I/O pins.
1 DS1307 Serial Real Time Clock I.C., Dallas Semiconductors 1-800-336-6933.
1 32.768KHz Quartz Crystal, 12.5pF Load Capacitance, Digi-Key part #SE3203-ND $1.35 each
1 11.0592MHz crystal for the microcontroller
1 3 Volt Battery, for the battery backup circuit.
1 16 X 2 LCD

The rest of the required parts you can see on the schematic, and are pretty generic, you most likely have them lying around in your parts-bin
CODE
Click HERE for the complete code for this project.

SCHEMATIC
Click HERE for the schematic for this project.

NOTE: The file name is clock.zip and contains all of the following files:

bulletat89c2051.pdf, the Atmel AT89C2051 Microcontroller Data Sheet in PDF format.
bullet1307.pdf, the DS1307 Data Sheet in PDF format.
bulletAT1307.asm, the ASM code for this project.
bulletAT1307.lst, the assembly list file.
bulletAt1307.hex, the assembled HEX file ready to burn into any 8051 variant microcontroller.
bulletapp95.pdf, App-Note: Interfacing the DS1307 with an 8051-Compatible Microcontroller
bulletclock.gif, the project Schematic in GIF format.


download   link 1
                    link 2

5 comments:

Unknown said...

CAN I HAVE THE COMPLETE PROJECT? PLS

admin2010 said...

done ......... now you can download ....... and now have fun ...........

iHaridz said...

ellop er link 4 code is dead can reupload or send me by mail rune_mirrage@yahoo.com plzz tq

boy alone 2012 said...

link die, help me

Unknown said...

link die
plz help

Post a Comment