You are on page 1of 18

Alarm clock using microcontroller IC 89C2051



Ds1307/1308 Alarm operation


8-bit Microcontroller (89c2051). Time keeping IC (DS1307) Battery 16x2 LCD. Buzzer. Power supply Resistors, Diode (IN 4007). RED LED Capacitors. Switches

In this project our objective is to develop an Alarm

clock system that is capable of displaying the Real time clock and other clock operations like date , day , month , year etc. collected by microcontroller and DS1307 which is displayed on the LCD.

89C2051 Microcontroller
2K bytes of Flash 128 bytes of RAM 32 I/O lines, two 16-bit timer/counters The AT89C51 is designed with static logic for operation

down to zero frequency and supports two software selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port and interrupt system to continue functioning. The Power-down Mode saves the RAM contents.

Pin configuration

Pin description

Supply voltage. GND : Ground. Port 0 to 7 : It is an 8-bit open-drain bi-directional I/O port. Port 0 may also be configured to be the multiplexed low order address/data bus during accesses to external program and data memory. Oscillator Characteristics XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier which can be configured for use as an on-chip oscillator. Pin 29: PSEN If external ROM is used for storing program then a logic zero (0) appears on it every time the microcontroller reads a byte from memory.


The DS1307 Serial Real Time Clock is a low power,

full BCD clock/calendar and 56 bytes of non-volatile SRAM Address. Data are transferred serially via a 2wire bi directional bus. The clock/calendar provides seconds, minutes, hours, day, date, month, and year information. The DS1307 has a builtin power sense circuit which detects power failures and automatically switches to the battery supply.

LCD is Liquid Crystal display . It is an electronic display module and

find a wide range of applications.

A 16x2 LCD means it can display 16 characters per line and there are

2 such lines. In this LCD each character is displayed in 5x7 pixel matrix. This LCD has two registers, namely, Command and Data.

Alarm operation
For normally open push button switches are used for

user input to set the time/date and alarm time . the following illustrates the functions of each push button 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 . P3.4 Switch#4 puts the clock into set , or display alarm with mode.

The SQW/OUT this pin is programmed to output a

1Khz. Using these higher frequencies however would result in a steady time for the alarm buzzer. 2N2222 NPN Transistor is a 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. The code 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 non-volatile RAM area and will remain unless you remove all power from circuit , including the external battery backup. The DS1307 internal power sense circuit that will automatically switch to the external battery power. The LCD is operated in 4-bit Mode because of limited I/O using the AT89C2051 Microcontroller.

Any microcontroller can be used but code should be

compatible with any 8051 variant. Any 8051 microcontroller with 13 available I/0 would be fine for this project. Operation of this alarm is handled by pin -7 , DS1307 and SQW/OUT which is square wave output

Touch screens:A high number of microcontroller

providers incorporate touch-sensing capabilities in their designs. Portable electronics such as cell phones, media players and gaming devices are examples of microcontroller-based touch screens.
manage engine variants. functions such as cruise control and anti-brake system have been made more efficient with the use of microcontrollers.

Automobiles: They are widely used in hybrid vehicles to

Medical Devices: Portable medical devices such as blood

pressure and glucose monitors use microcontrollers will to display data.

During the development of our project I studied and

analyzed many real world applications of Electronics and Software Engineering. Some of the theoretical knowledge which we have applied practically, is:
Use of voltage regulation and filtering in power

supply. Study of LCD. Study of Microcontroller.

Thank You