Arduino Digital Clock Project
Arduino Digital Clock Project
Time is one of the most essential parameters in day-to-day life, and digital clocks are one of
the most common applications of microcontrollers. In this project, I have built a digital clock
using Arduino UNO that displays the current hours, minutes, and seconds on two 7-segment
display modules:
This project gives practical exposure to working with 7-segment displays, multiplexing
techniques, and button-based user input for setting time manually.
2. Components Used
4. Manual Calculation
The digital clock uses the Arduino's internal timing function `millis()` which returns the
number of milliseconds since the board started running the program.
To count 1 second:
- 1 second = 1000 milliseconds
- When `millis() - prevMillis >= 1000`, one second has passed.
- We then increment the seconds variable and update the display.
Display Multiplexing:
- The 6 digits are multiplexed using a small delay (about 2ms per digit).
- Total cycle = 6 digits × 2ms = 12ms per full refresh cycle.
- Approximate refresh rate = 1000ms / 12ms ≈ 83 cycles per second.
- This is fast enough that the human eye perceives all digits as continuously ON.
5. Observation
After uploading the code and wiring the circuit correctly:
6. How It Works
This digital clock works by continuously updating and displaying time using the Arduino.
Here's how the system works:
Time Keeping
- The Arduino uses the millis() function to count real time.
- Every 1000 milliseconds (1 second), it increments the seconds counter.
- When seconds reach 60, it resets to 0 and increments minutes.
- Similarly, when minutes reach 60, hours is incremented, and wraps around after 24.
Multiplexing the Display :
- The 6 digits on the 7-segment displays are not all lit at the same time.
- Instead, the Arduino lights one digit at a time very quickly.
- This fast switching makes all digits appear to be ON simultaneously to the human eye.
Button Input :
- Three buttons are used:
- One to increase the hour
- One to increase the minute
- Buttons are connected with internal pull-up resistors and are active LOW (pressed =
LOW).
Educational Impact:
- Helps understand how microcontrollers interact with displays and inputs.
- Demonstrates multiplexing, a core concept in embedded systems.
- Introduces basic concepts of digital timekeeping and hardware control.
Practical Applications:
- Can be developed further into a fully functional alarm clock.
- Useful for making low-cost timer or display systems.
- Can be integrated with RTC modules for long-term accuracy.
6. Conclusion
This Arduino-based digital clock project demonstrates the use of 7-segment displays for
building real-time systems. The use of a 4-digit and 2-digit display provides a clear and
efficient way to display HH:MM:SS. The project also showcases important embedded
concepts like timing with millis(), display multiplexing, and manual user input with push
buttons. It is a strong foundation for learning digital electronics, and can be expanded with
features like alarms, RTC modules, or brightness control.