8051 microcontroller digital alarm – Project requirements
- 8051(89c51 or 89c52) microcontroller
- alarm(I used buzzer)
- 16×2 lcd
- Potentiometer/variable resistor (For setting lcd contrast)
- 4×3 keypad(You can also use 4×4. 4×4 contains 4×3 in it :D)
- Crystal(11.0592 MHz)
- Bread board(Designing circuit. You can also design circuit on PCB(Printed circuit board))
Tutorials regarding 8051 digital alarm clock project
- How to generate one second delay with 8051 microcontroller.
- How to generate one minute delay with 8051 microcontroller.
- How 16×2 lcd works.
- Digital clock with 8051 microcontroller.
All the above tutorials play a vital role in 8051 digital alarm clock project. I will say the code of all the above tutorials is part of this project. I just arranged the code in sequence with some minor modifications and made a stream line code flow to achieve digital alarm clock functionality.
Digital alarm clock – Code flow
Note: No external RTC(real time clock) is interfaced with 8051 microcontroller for time calculation. Rather internal timers of 89c51 mirocontroller are utilized for producing clock time(Visit above digital clock with 89c51 tutorial).
89c51 microcontroller digital alarm – Circuit diagram
89c51 microcontroller digital alarm clock – Project code
Then keypad() function is declared. This function scans the keys pressed on the 4×3 keypad. Next comes tochar() function. It is used to deal with integer type numbers to be displayed on the 16×2 lcd. Integer numbers must be converted to 8-bit character format for displaying on 16×2 lcd.
Then single bits of ports are declared for connecting our buzzer and 4×3 keypad. Next character arrays are declared they are used as messages to be displayed on 16×2 lcd on suitable conditions. delay() function is used to generate some delay for suitable purposes. lcdcmd() function is sending commands to lcd. lcddata() function is sending and printing data on lcd screen. checkconditions() function is checking conditions like if seconds reached to 60 increment the minute, if minutes reached to 60 increment hour, check if clock reached the alarm time ring the buzzer.
clockdelay() function is producing seconds, minutes and hours for us. lcdinit() initializing the lcd. settime() function is setting time of clock on every reset of the program. User have to input the time using 4×3 keypad. start() function is printing the time on 16×2 lcd at start of the program execution.
The above tutorials are very important if you want to understand the functions used in the code. If you don’t care about code than just burn the hex code make the circuit and enjoy your creation 😀
Filed Under: 8051 Microcontroller, Microcontroller Projects