"Because waking up late shouldn't be a hardware problem."
This project is a Digital Alarm Clock built using the AT89C52 (8051) microcontroller. It features:
- ⌨️ 4x3 Keypad input for setting time and alarms
- 📟 16x2 LCD display to show current time and alarm status
- 🔔 Buzzer alert when alarm triggers
- 🕒 Real-time clock simulation using Timer 0 Designed as a simple embedded systems project, this serves as a beginner-friendly dive into 8051 microcontroller programming, LCD interfacing, keypad scanning, and GPIO control.
- ✅ Set current time (Hours:Minutes)
- ✅ Set alarm time via keypad
- ✅ Real-time clock with second updates
- ✅ Buzzer rings when time matches alarm
- ✅ LCD displays current time and alarm messages
- AT89C52 / 8051 Microcontroller
- 16x2 LCD
- 4x3 Matrix Keypad
- Buzzer
- Crystal Oscillator (typically 11.0592 MHz)
- Capacitors & Resistors for timing and pull-up
- Breadboard / PCB and power supply
- LCD Initialization – LCD is set in 8-bit mode and ready to display messages.
- User Time Input – Keypad is used to input hours and minutes.
- Alarm Setting – Alarm time is stored and monitored in real-time.
- Timer 0 – Used to simulate 1-second delay (software polling).
- Clock Display – Time is updated and displayed on LCD.
- Alarm Trigger – If real-time matches the alarm, buzzer is activated.
lcdcmd()
andlcddata()
– Low-level LCD controlkeypad()
andscankey()
– Keypad scanning and inputsettime()
– Set the current timecheckconditions()
– Alarm time input and logicclockdelay()
– Simulated second-by-second update using Timer 0main()
– Initializes system, sets time, and starts clock
🧾 You can find the full source code in alarm.c
File Name | Description |
---|---|
alarm.c |
Main C code for 8051 microcontroller |
alarm.hex |
Compiled HEX file for flashing |
alarm.Uv2 |
Keil µVision project file |
Digital Clock using 8051 Microcontroller.pdf |
Project report with diagrams and explanation |
- Load
alarm.hex
to your AT89C52 using a suitable programmer. - Connect the circuit as per the project schematic (see report).
- Use the keypad to:
- Set the current time
- Set the alarm time
- Watch time update on LCD.
- Hear the buzzer ring when alarm time is reached!
- Time resets incorrectly if it reaches 13:60:60.
- No debounce handling on keypad input.
- Timer is software-polled (not interrupt-based).
- Use interrupt-driven Timer 0 for accurate timing.
- Add EEPROM support to save alarm time across resets.
- Include AM/PM format or 24-hour support.
- Add multiple alarms or snooze functionality.
Siddartha Reddy
This project is open-source and free to use under the MIT License.
If you found this project useful or learned something new, consider giving this repo a ⭐ and sharing it with your peers.