How to Make a Digital Clock at Home Using Arduino | Full Tutorial
by ER GREAT in Circuits > Arduino
530 Views, 2 Favorites, 0 Comments
How to Make a Digital Clock at Home Using Arduino | Full Tutorial
This guide details how to build a large, custom Digital Clock using a multiplexed 7-Segment Display and an Arduino Uno (or a cheaper ATmega8A/ATmega328P IC for the final product). This project is perfect for learning about LED matrix display control and basic programming!
Materials and Components
LEDs x 116 Pieces - Use 5mm diffud LEDs. The color is your choice (e.g., Red, Blue, Green).
Arduino Uno - Used for initial prototyping and programming the final IC.
ATmega8A / ATmega328P IC - A cheaper alternative to run the clock permanently after programming.
Push-Button Switches x2 - For setting the Hour and Minute.
Toggle/Adjust Switch - Used to enter/exit the time-setting mode.
Resistor x1 - 220 Ohm resistor for the dot/colon LEDs.
Li-ion Battery (3.7V) - Recommended 2200mAh or more for long run time.
Li-ion Charger Module - With a micro-USB/Type-C port for charging.
USB Cable - Type A to Type B (for Arduino)
Wires & Headers - Jumper wires, male/female headers (optional but recommended for easy connections).
PCB Frame/Board - Custom-made PCB or perforated board to hold four 7-segment digits.
Enclosure - Custom box (e.g., plywood or acrylic) to house the circuit and display.
Building the 7-Segment Display (Common Anode)
The core of this project is the large four-digit, 7-segment display built from individual LEDs. This design uses a Common Anode configuration.
2.1 Solder Individual Segments
NOTE: Make a frame of 4-Digit, 7-Segment LEDs with 6mm MDF board, Acrylic sheet or with other material as used in the picture. Then make hole of 5MM with correct dimension.
- Insert LEDs: Insert the LEDs into the MDF board frame for one digit (7 segments, typically 4 LEDs per segment). Ensure the positive leg (Anode) of each LED faces the outer side of the segment.
- Solder Anodes: Bend the positive legs (Anodes) of the 4 LEDs in a single segment (e.g., Segment 'A') and solder them all together. This creates a Common Anode for that segment. Repeat this for all 7 segments (A through G).
- Solder Cathodes (Digit Wires): Now, for a single segment (e.g., Segment 'A'), connect the negative legs (Cathodes) of the 4 LEDs together as connected in above picture.
- After completing all soldering check segments again. If any LED is not glowing then make proper solder or replace that LED.
Repeat the Process for All 4 Digits and Dot LEDs
After completing the soldering for the first digit, repeat the exact same procedure for the remaining three digits.
Ensure that each digit contains:
- 7 segments (A–G)
- 4 LEDs per segment
- Common Anode connected segment-wise
Maintain the same pin orientation and wiring pattern to avoid any mismatch when connecting to the circuit.
3.1 Connecting the Dot LEDs
For the Dot (Decimal Point)
- Insert 4 LEDs for the dot section (as shown in the picture).
- Connect all positive legs (Anodes) together to form a Common Anode for the dot.
- Connect all negative legs (Cathodes) together in parallel.
This ensures that the dot behaves the same way as a segment and can be controlled easily through the driver circuit.
After completing the connections for all digits and the dot LEDs, test each segment and dot individually to ensure proper illumination and confirm that there are no soldering faults.
Wiring All Segments and Common Anodes
Once all four digits and the dot LEDs are assembled, proceed with the wiring as follows:
4.1 Connect Segment Lines (A–G) Across All Digits
- Start by connecting Segment A of all four digits together using a single wire.
- Similarly, connect Segment B of all digits with another wire.
- Repeat this process for all seven segments (A to G).
- This ensures that each segment receives the same control signal across all digits.
4.2 Connect the Common Anodes of Each Digit
Each digit must have its own dedicated common anode line:
- Connect the first wire to the Common Anode of Digit 1
- Connect the second wire to the Common Anode of Digit 2
- Connect the third wire to the Common Anode of Digit 3
- Connect the fourth wire to the Common Anode of Digit 4
These separate anode lines allow the Arduino to switch digits one by one.
4.3 Connect the Dot LED
- For the Dot (Decimal Point), connect two wires:
- One wire for the Dot Anode
- One wire for the Dot Cathode
- Connect these as per given circuit diagram in STEP-3.
4.4 Secure the Assembly
After completing all connections:
- Apply hot glue or adhesive on the backside to fix and protect the wires.
- Make sure no wires are loose or touching each other.
Now your 4-Digit, 7-Segment Common Anode Display is fully assembled and ready for circuit connection.
Connecting the 4-Digit Display to the Arduino Uno
With the display fully assembled, you can now connect it to the Arduino Uno following the circuit diagram. Carefully wire each segment and digit line as described below.
5.1 Connect Segment Pins (A–G)
Connect each segment wire to the corresponding Arduino digital pin:
- Segment A → D8
- Segment B → D7
- Segment C → D6
- Segment D → D5
- Segment E → D4
- Segment F → D3
- Segment G → D2
These pins will control which segments glow to form numbers.
5.2 Connect the Dot LED
- Dot Anode → D9
- Dot Cathode → GND
This allows the Arduino to blink in 0.5 second.
5.3 Connect the Common Anodes for Each Digit
Connect the anode wires of each digit to the Arduino pins as follows:
- Digit 1 (Hour Tens) → D10
- Digit 2 (Hour Units) → D11
- Digit 3 (Minute Tens) → D12
- Digit 4 (Minute Units) → D13
Enabling the Arduino to activate one digit at a time.
5.4 Final Check
Before powering the circuit:
- Recheck all segment connections
- Verify that no wires are shorting
- Make sure the dot LED polarity is correct
- Ensure all digit anode wires are connected firmly
Once everything looks correct, you can proceed to upload the Arduino code and test the display.
Uploading the Code to the Arduino Uno
With all hardware connections complete, the next step is to upload the program to your Arduino Uno.
👉DOWNLOAD Code, Library and Circuit diagrams- https://drive.google.com/file/d/1cVT_6N8AeOeelp9nmq31_qBrqxrKTOW5/view?usp=drivesdk
6.1 Connect Arduino to Your Computer
- Use a USB cable to connect the Arduino Uno to your laptop/PC.
- Open the Arduino IDE software.
6.2 Install the Required Library
This project requires the TIME Library.
- Go to Sketch → Include Library → Manage Libraries
- In the search bar, type “Time”
- Install the library named Time (or TimeLib by Paul Stoffregen)
- Ensure your PC/laptop has an active internet connection during installation
To confirm installation:
- Go to Sketch → Include Library
- Scroll down and check if Time library is listed
If it appears, you’re ready to compile the code.
6.3 Open and Compile the Code
- Go to File → Open
- Select the provided 12-Hour Digital Clock code file
- Click the Verify/Compile button
If the code compiles successfully, you’re ready to upload.
If there is an error, feel free to ask in the comments—I’m available to help.
6.4 Select Board and Port
Before uploading:
- Go to Tools → Board
- Select Arduino Uno
- Go to Tools → Port
- Select the COM port where your Arduino is connected
- Keep the remaining settings as shown in above images
6.5 Upload the Code
- Click the Upload button
- Wait until Arduino IDE shows “Done Uploading”
6.6 Testing the Display
- After upload, all segments should light up except the first digit (normal during initialization)
- Within 2 minutes, you will notice the time beginning to increment
- Your digital clock is now running successfully!
Adjusting the Dot LED Brightness
You may notice that the Dot LED glows with higher brightness compared to the other segments. This happens because the dot section uses multiple LEDs connected in parallel and receives full current directly.
7.1 Add a Current-Limiting Resistor
To equalize the brightness:
- Disconnect the Dot LED Anode wire
- Insert a 220Ω resistor in series with the Dot Anode
- Reconnect the resistor output back to the same Arduino pin (D9)
This resistor limits the current flow and balances the brightness with the other segments.
7.2 Check the Output
After adding the resistor:
- Power up the Arduino
- You will now see the Dot LED glowing at proper brightness
- The display looks more uniform and visually pleasing
Your Dot LED brightness issue is solved, and the display is now performing perfectly.
Connect the Time-Setting Switches
To adjust the clock time manually, we need to add push buttons and a toggle switch as shown in the circuit diagram.
8.1
You will use:
- 1 Toggle Switch (for switching between Normal Mode and Time-Set Mode)
- 2 Push Buttons (one for setting Hours, one for setting Minutes)
Wiring:
- Connect one side of all three switches together and link that common point to GND.
- Connect the other terminals as follows:
- Toggle Switch → A0 (Mode Select Pin)
- Minute Button → A1
- Hour Button → A2
These analog pins detect when the switch is pressed and allow you to adjust the time accordingly.
8.2 Using the Clock with Arduino Uno or ATmega8A
You have two options to run the clock:
Option 1: Run with Arduino Uno
- Simply upload the code
- Keep all wiring as shown in the Arduino circuit diagram
- Clock works directly from the Arduino board
Option 2: Use ATmega8A to Reduce Cost
To make the project more compact and budget-friendly:
- Program the ATmega8A IC using your Arduino Uno
- Remove the Arduino and replace it with the standalone ATmega8A circuit
- The ATmega8A wiring diagram (shown above in pictures) must be followed for proper connections
Using ATmega8A makes the project cheaper and suitable for permanent installation inside an enclosure.
8.3 Power and Battery Charging Module
To make the clock portable:
- Add a TP4056 Charging Module
- Connect the battery + and – to the module
- Add an SPST switch between the battery and your ATmega/Arduino circuit
- This allows you to turn the clock ON/OFF and charge it through a micro-USB or Type-C port
8.4 Final Assembly
Once all connections are tested:
- Place the circuit, ATmega8A/Arduino, display, and battery inside the box
- Secure all components with hot glue
- Close the enclosure
- Your DIY 4-Digit Arduino Digital Clock is now complete and fully functional!
Powering on and Adjusting the Time (Final Step)
Your digital clock is now fully assembled and ready to use.
9.1 Power Up the Clock
- Turn ON the SPST switch to power the circuit.
- You will notice that 3 digits glow initially while the first digit may remain off during startup — this is normal.
9.2 Enter Time-Adjust Mode
To set the correct time:
- Press the Toggle Switch to activate Time Adjust Mode.
- Use the two push buttons:
- Hour Button → Set the Hour
- Minute Button → Set the Minutes
Adjust the time as needed.
9.3 12-Hour Clock Format
This project uses the 12-hour format, meaning:
- After 12:59, the clock will automatically reset to 01:00
- Example: Set the time to 12:59, then press the toggle switch again to exit adjustment mode
9.4 Clock Running Indicator
When the clock starts running:
- The Dot LED (Decimal Point) will blink, indicating that the clock is actively updating time.
- After one minute, you will see the time progress—for example:
- From 12:59 to 01:00
This confirms that your clock is working perfectly.
9.5 Enjoy the Result
Congratulations!
Your hard work has paid off, and your homemade Arduino-based 12-Hour Digital Clock is now fully functional, stable, and ready for daily use.
Important Note
In this project, no RTC (Real-Time Clock) module is used.
This means that when the power is switched off, the clock loses its time and resets.
Once the power comes back, you will need to adjust the time again manually.
This is the main limitation of this design—but remember, this project is created for experimental learning purposes, helping you understand the basics of timing, and display control.
What’s Coming Next?
In my next blog, I will show you how to add an RTC Module (like DS3231 or DS1307) directly to this clock so it keeps accurate time even after power loss.
Also, I’m currently working on an exciting upcoming project:
👉 A 6-Digit 7-Segment Digital Clock with an RTC Module and Seconds Display
This will be a much more advanced and feature-rich version—and an amazing DIY build!
Stay tuned for the next tutorials!
Applications of This DIY Arduino Digital Clock
1. Home and Room Decoration
- Can be placed on a desk, wall, or bedside table
- Works as a stylish handmade digital timepiece
2. School and College Projects
- Excellent for science fairs, mini-projects, and engineering assignments
- Helps students understand multiplexing, time libraries, and microcontroller basics
3. Learning and Experimentation
- Ideal for beginners learning Arduino, coding, and DIY electronics
- Can be expanded into advanced projects like alarm clocks or temperature clocks
4. Industrial or Lab Timers
- Can be used as a basic timer display in workshops, factories, or labs
- With minor modifications, it can act as a countdown or process indicator
Project Summary
In this project, we created a fully functional 12-Hour Digital Clock using basic components like LEDs, resistors, switches, an Arduino Uno (or ATmega8A), and custom 4-digit 7-segment display.
We began by assembling each segment manually, wiring all digits correctly, and connecting them to the Arduino. After installing the required Time Library, the code was uploaded and the display tested.
Additional features like time-set mode, hour/minute adjustment, dot LED blinking, and battery charging module were added to make the clock convenient and practical.
Finally, the entire system was assembled in a compact case, resulting in a reliable, low-cost, and beautifully handcrafted digital clock.
This project not only helps you learn core electronics and coding concepts but also gives you a useful device you can proudly use every day.