top of page

Real-Time Digital Clock with an Alarm - Microcontroller

This project is an implementation of a real-time digital clock with an alarm, which is controlled by a PIC18F4550 microcontroller with an internal oscillator of 8 MHz. The aim of this project is to implement the inter-integrated circuit (I2C) communication protocol on the PIC microcontroller to control a serial real-time clock (DS1307).


The project requirement is designing a digital clock system that allows for time and date updating. In addition, an internal alarm system can be configured to a specific time with choosing alarming LED pattern.

 

Circuit Components


• 1 PIC18F4550 • 1 DS1307 • 1 Crystal oscillator • 4 LEDs • 3 Push buttons • I2C debugger • 1 LCD (Liquid Crystal Display) • Resistors (10 kΩ, 330 Ω, 6.7 kΩ)

 

Circuit Design


the above Figure shows the connection of components with the PIC18F4550. Push Buttons are connected using 10 kΩ resistor and configured at PROTA from RA1 to RA4. 330 Ω resistor are used for the LEDs which were connected to PORTD from RD0 to RD3. LCD pins connected to PORTD and PORTE are shown in Figure 1 (LCD pins D4 to D7 connected to PIC pins RD4 to RD7, LCD pins RS and E connected to RE0 and RE2 on the PIC, respectively). Finally, DS1307 pins X1 and X2 connected to the crystal oscillator, and the SDA and SCL pins are connected to pins RB0 and RB1 of PIC18F4550 respectively.

 

Part 1: Digital Clock System In order to achieve the required design, three Push Buttons (set, Up, and Down) are used to update the time and date. The method is as follows: Set Button is initialized with zero then incremented by 1 when pressed and gets back to zero when number 7 is reached.

1st time: allow updating the hour. 2nd time: allow updating the minutes. 3rd time: allow updating the second. 4th time: allow updating the day. 5th time: allow updating the month. 6th time: allow updating the year.

In each time, Up and Down Buttons can be used to increment and decrement the values and each field limited to a specific range.

Hour: 0-23 hrs Minutes: 0-59 min Second: 0-59 sec

Days: 1-31 days Months: 1-12 months Years: 2015-2029

 

Part 2: Alarm System

Likewise, to the digital clock system, three Push Buttons (alarm, Up, and Down) are used to set the alarm. Alarm Button is initialized with zero then incremented by 1 when pressed and gets back to zero when number 4 is reached.

1st time: switch displaying to the alarm system and allow updating the hour. 2nd time: allow updating the minutes. 3rd time: allow choosing LEDs pattern. 4th time: finishing alarm setting.

In each time, except the fourth, Up and Down Buttons can be used to increment and decrement the values.


 

Demo Video

The program is uploaded in GitHub page:

done by: Ruba Bin Jabal, Nada Abughazalah






العلامات:

Recent Posts
Archive
Search By Tags
bottom of page