Digital Clock Using Arduino


In this project, “Digital clock using Arduino” we will make a PCB board for digital clock and program our Arduino so that it displays a time in seven segment display.


Creating a digital clock using an Arduino is a popular project that combines electronics, programming, and timekeeping. Such a clock displays the current time in a digital format, making it a useful and practical device. In this introduction, we’ll explore the fundamental concepts and components involved in building a digital clock using an Arduino.

Bill Of Materials

1Arduino Board Arduino nano 1
2Connecting wiresjumper wiresome
4RTC Module5V1
5Seven Segment DisplayL293D1

PCB Manufacturer

PCBWAY is a highly skilled company specializing in PCB manufacturing. They offer their services at incredibly low prices, such as providing 10 PCBs for only $5. Additionally, new members receive a $5 bonus. The website allows customers to upload their Gerber Files and place orders.


PCBWAY is known for producing PCBs of exceptional quality and maintaining high standards, which is why many people trust them for their PCB and PCBA needs.

Below are some of my PCB’S manufactured by PCBWAY and I am fully satisfied by their Quality of service they provide.

Working Principle

The working principle of a digital clock using Arduino involves a combination of hardware components, such as the Arduino board and RTC module, and software programming to accurately track time and display it on a digital display. Here’s how it works:

Real-Time Clock (RTC) Module:

The heart of the digital clock’s timekeeping accuracy is the RTC module. It contains a real-time clock chip (e.g., DS1307, DS3231) that keeps track of the current time and date.

The RTC module typically has its own battery backup, which allows it to continue tracking time even when the main power to the Arduino is disconnected.

Arduino Microcontroller:

The Arduino serves as the controller and interface for the digital clock.

It communicates with the RTC module to request the current time and date information.


The Arduino is programmed to perform the following tasks:

Initialize the RTC module: The code sets up the communication with the RTC module, configuring it to maintain and retrieve time and date information.

Request time data: The Arduino periodically sends a request to the RTC module to fetch the current time.

Process time data: The retrieved time data is processed by the Arduino to separate hours, minutes, and seconds. The date information can also be extracted if needed.

Display time: The Arduino code formats the time data and sends it to the digital display for visual presentation. The code may include formatting options like leading zeros, AM/PM indicators, or date display.

Update the display: The digital display is updated at regular intervals, typically once per second, to show the most current time.

Digital Display:

The digital clock uses a display (e.g., 7-segment display, OLED, TFT) to visually represent the time. The choice of display can vary, with different displays offering varying levels of customization and clarity.

Power Source:

The clock can be powered by a USB connection, a battery, or an external power supply.

The RTC module’s battery backup ensures that time information is maintained even during power interruptions.

Enhanced Features (Optional):

Depending on the project’s complexity, you can add features like alarm settings, date display, temperature and humidity monitoring, and different display options.

User Interaction (Optional):

Some digital clocks using Arduino can include buttons or other user interface elements to adjust settings, set alarms, or switch display modes.

The digital clock operates by reading the time from the RTC module at regular intervals, processing this information through Arduino code, and updating the digital display to show the current time. The RTC module’s battery backup ensures that the clock continues to keep time accurately, even when power is temporarily interrupted.

This combination of precise timekeeping with an RTC module, Arduino’s processing capabilities, and display technology allows you to create a functional and accurate digital clock that can be customized to meet various needs and preferences.

Working Steps

  1. Connect the RTC Module: Wire the RTC module to the Arduino. Typically, you connect the SDA and SCL pins of the RTC module to the corresponding pins on the Arduino. You’ll also connect power and ground.
  2. Install Libraries: Utilize Arduino libraries to interface with the RTC module and your chosen display. Libraries like “RTClib” are commonly used for RTC modules, and there are display-specific libraries for different display types.
  3. Write Arduino Code: Develop Arduino code that initializes the RTC module, retrieves the time, and displays it on the chosen display. You can customize the code to format the time, include features like date display and alarms, and control the display’s appearance.
  4. Upload Code: Use the Arduino Integrated Development Environment (IDE) to upload your code to the Arduino board.
  5. Power the Clock: Connect your Arduino board to a power source (USB, battery, or an external power supply) to make the digital clock functional.
  6. Enhance Features: As you gain experience, consider adding additional features to your digital clock, such as alarms, date display, different time formats, or the integration of other sensors like temperature and humidity sensors.

Schematic Diagram

circuit of Digital clock using Arduino

PCB Diagram

PCB of Digital clock using Arduino

3D view

Source Code / Program

#include <Wire.h>
#include <RTClib.h>
#include <Adafruit_GFX.h>
#include <Adafruit_LEDBackpack.h>

RTC_DS3231 rtc;
Adafruit_7segment matrix = Adafruit_7segment();

void setup() {
  matrix.begin(0x70); // I2C address for 4-digit 7-segment display
  if (! rtc.begin()) {
    Serial.println("Couldn't find RTC");
    while (1);

void loop() {
  DateTime now =;
  int hour = now.hour();
  int minute = now.minute();
  int second = now.second();
  // Display the time on the 7-segment display
  matrix.print(hour * 100 + minute);
  matrix.drawColon(true); // Add a colon between hours and minutes
  delay(1000); // Update the display every second

Manufacturing Files


Bill of material


Order Directly from PCB WAY

I have already uploaded all these required manufacturing files in PCBWAY website. You can easily go to the below link and place you order, and get your Own  Home Automation PCB manufactured from one of the best pcb manufacturer PCBWAY



In conclusion, building a digital clock using Arduino is an engaging and educational project that allows you to combine your electronics and programming skills to create a functional timekeeping device.

Recommended For You

About the Author: admin

Leave a Reply

Your email address will not be published.