A fully functional Arduino-based digital clock system built using embedded programming techniques.
This project implements real-time clock behavior using millis() instead of an RTC module, along with advanced features like alarm, snooze, and multi-mode user interaction.
- 12-hour format with AM/PM support
- Accurate timing using
millis()(non-blocking) - Manual drift compensation system
- No external RTC module required
- Set custom alarm time (hours & minutes)
- AM/PM-aware alarm triggering
- Alarm rings with buzzer pattern
- Auto-stop after 60 seconds
- Short press → Snooze (5 minutes)
- Long press → Stop alarm completely
- Snooze auto-reactivates alarm after delay
- Snooze cancel option
- Multiple buttons with:
- Debouncing
- Short press detection
- Long press detection
- Modes:
- Clock run mode
- Time setting mode
- Alarm setting mode
- 4-digit 7-segment multiplexed display
- Efficient refresh (~2ms per cycle)
- Leading zero suppression
- Blinking digits during setting modes
- Colon LED behavior:
- Normal → 1 Hz blink ( 1 second blink per 2 seconds)
- Alarm → fast blink
- Snooze → slow blink
- Setting mode → AM/PM indicator
- Alarm enable/disable blink indication
- Fully non-blocking code (no delay())
- Event-driven button handling
- Clean modular functions
- Efficient memory usage
- Real-time system behavior
- Arduino Uno / Nano
- 4-digit 7-segment display (common cathode)
- Transistors (for digit control)
- Resistors (for segments & base)
- Push buttons (x4)
- Buzzer
- Connecting wires & breadboard
| Component | Pin |
|---|---|
| Segments (A–G) | 2, 3, 4, 5, 10, 11, 12 |
| Digit Control | 6, 7, 8, 9 |
| Colon LED | 13 |
| Buzzer | A3 |
| Mode Button | A0 |
| Increment Button | A1 |
| Alarm Mode Button | A2 |
| Stop/Snooze Button | A4 |
- Uses
millis()for precise timing instead ofdelay() - Multiplexing displays digits rapidly for persistence of vision
- Button input handled via custom debounce + event system
- Alarm system compares real-time clock with set values
- Snooze implemented using time offsets
- Time accuracy depends on Arduino clock (may drift)
- Manual drift compensation is approximate
- No backup power (resets on restart)
- Add RTC module (e.g., DS3231) for high accuracy
- Store time/alarm in EEPROM
- Add brightness control
- Improve UI (hold-to-fast-increment)
- Convert to full finite state machine
Add images or videos of your project here
- Mahmud Mahi
- Email me: mahmudurahmanmahi26@gmail.com
Give it a ⭐ on GitHub and feel free to fork or improve it!
This project is licensed under the MIT License - see the LICENSE
😊 Thank You.