Vous êtes sur la page 1sur 6

Programmable Alarm Clock

1. Abstract

Alarm clocks are designed to make a sound, or some other signal, at a specific
time. The primary utility of these clocks is to awaken people from their night's sleep or
short naps; they are sometimes used for other reminders as well. This can be done by
using a buzzer, a bell, or an electronic speaker to generate the sound signal at the
desired instant of time. It is dicult to read the time from an analog clock at night.
Setting the current time and the alarm time is also quite complicated. To solve these
problems, digital clocks are available in the market. However, they are way too costly.
This project aims to develop a programmable alarm clock which has a bright 7
segment display, a loud buzzer and is cost eective.

2. High Level Design

a. Block Diagram

The device runs on a 12V regulated power supply. The micro controller is the
heart of the device. It provides the data for the display, alarm and time adjustment
circuit. The time adjustment circuit is used to input data into the micro controller.

b. Tradeos and Limitations

The current design makes the device bulkier than a traditional clock. Also, it
makes use of a DC wall adapter which has to be always plugged into the power outlet.
Power loss resets the device and the clock has to be set again. Snooze time is not
programmable. The default snooze time is 15 minutes.

c. Assumptions Made

It is assumed that the user is acquainted with the 24-hour clock format.

3. Hardware Design
a. Overview

The device makes use of a 12VDC wall adapter. The micro controller used is
PIC18F452 which sits on one circuit board while the display, alarm and time
adjustment circuit is built on a totally dierent circuit board.

b. Schematic

The schematic for the circuit is shown below:

c. Explanation of each Component

Following is the list of components used in the device:

Micro controller - PIC18F452 40 Pin DIP package.

12VDC Power Adapter and a DC jack.

5V Voltage Regulator IC - 7805 provides a constant 5 volts for the

two circuits.

10F and 100F electrolytic capacitors for the voltage regulator.

16Mhz crystal oscillator with 33pF mica capacitors.

For the reset circuit, a tactile switch, and a 4.7K pull-up resistor.

6 seven segment displays for the display of time.

For the 6 displays, 6 BC548 NPN transistors each with 10K

resistors connected to their base terminals.

8 current limiting 220 resistors for the data terminals of the


10. 5 tactile switches: Two for setting the hours and minutes, one for

alarm dismissal, one for alarm snooze, and one for mode


11. One piezoelectric buzzer for providing the sound signal on alarm

condition connected through a BC548 NPN transistor and a 10K

resistor connected to its base terminal.

4. Software Design
a. Overview
The micro controller keeps track of the current time in an ecient manner so as
to reduce the time lost over a long period of time. It makes use of the Timer 0
for maintaining time. The timer is programmed to generate an interrupt every
one second which is used to increment the clock.

There are separate flags defined in the program for recording the critical
events happening during the course of execution of the program.
For example, the mode switch is continuously monitored by the micro controller
to check if the user wants the device to display the time or to jump into the
mode which allows them to set the current time or the alarm time.

The display circuit consists of 6 seven segment displays multiplexed in time to

provide the necessary visual output of the time. Each display unit is
continuously refreshed with the live data so as to provide the user with an
accurate representation of the time.

The buzzer is switched ON and OFF at a programmed rate so as to play an

alarm tune.

Buttons are provided to set the current time & alarm time, dismiss an alarm, or
snooze it for 15 minutes.

b. Flow chart or logical flow of events

The flow chart is shown below:

Set current time

current time
equal to alarm

Set alarm time

Keep counting up

Sound buzzer

c. Pictures of the device

5. Conclusions
The alarm clock works as expected and is incredibly useful to get information
about the current time especially at night. The total cost of the device was only a
fraction of the clocks available in the market. The code is bug-free and usage of the
device does not require any programming knowledge or any other advanced
6. References

PIC Microcontroller and Embedded Systems by Muhammad Ali Mazidi, Rolin D.
Mckinlay, Danny Causey - Programming the PIC18F452 to be able to generate
interrupts on timer overflow.

Saeeds Blog [http://saeedsolutions.blogspot.in/2013/03/pic16f877-up-downcounter-code-proteus.html] - An interesting way to check the de-assertion of a tactile

switch is using the while loop to monitor its status.

maxEmbedded.com [http://maxembedded.com/2013/01/seven-segmentmultiplexing/] - An introduction to 7 segment displays and how to multiplex them.