How to make an Arduino Clock – step by step complete tutorial

How to make an Arduino Clock - step by step complete tutorial

Hello guys, welcome back to my SriTu Hobby blog. This tutorial includes how to make an Arduino clock. Also, we can use this Arduino LCD clock for the bedroom, study desk, office room, etc. So, this project mainly used the Arduino UNO board, RTC module, and LCD. Through this, you can see the temperature in addition to the date and time. They can be viewed through the LCD. If you are not already familiar with the RTC module, For that, go to the  RTC Module Tutorial.

How does work Arduino LCD clock?

This Arduino LCD clock is based on the Arduino UNO board. Also, an RTC module is used to get the date and time. Due to the battery in this module, we can get the date and time continuously without changing. Also, this Arduino LCD clock is designed to display the date and time on an LCD. For this, we first need to enter the exact date and time. Then it will be stored in the RTC module. So that date and time remain the same even when this Arduino clock is not powered on.

So, let’s make this Arduino LCD clock project step by step. So, the required components are given below.

Disclosure: These Amazon links are Affiliate links. As an Amazon Associate, I earn from qualifying purchases.

Step 1

Step 2

Secondly, cut the foam board into the following sizes. You can change these sizes as you like.

Step 3

Thirdly, attach the Arduino Uno board to a 1.5 x 2.75-inch piece.

Step 4

Then attach the RTC module to a 2.75 x 4.5-inch piece. Use the diagrams below.

Step 5

Next, attach the piece we connected to the Arduino board we made earlier to the bottom of the Arduino LCD clock.

Step 6

Next, take a 1.5 x 4.5-inch piece and attach it to the bottom.

Step 7

Ok, now connect the RTC module to the Arduino board. For that, use the circuit diagram below.

How to make an Arduino Clock - step by step complete tutorial

Step 8

Now, let’s set up the top of the Arduino LCD clock. For this, connect (solder) the I2c module to the LCD. Then take a 2.75 x 4.5-inch piece and attach the LCD to it. Afterward, connect it to the Arduino board.

Step 9

Afterward, connect the remaining two pieces to the bottom.

How to make an Arduino Clock

Step 10

Lastly, connect the upper part of the Arduino LCD clock. Also, insert the battery into the RTC module.

Step 11

Now, let’s enter the date and time for the Arduino LCD clock. You can use the following program for that. If you have not already included the RTC Library and I2C Library in the Arduino IDE, download and install them from the links below.

Arduino LCD clock code

  • The complete program of this project – Download
/*RTC module with Arduino.
  created by the SriTu Tech team.
  Read the code below and use it for any of your creations.
*/

#include <DS3231.h>
DS3231 rtc(SDA, SCL);

void setup() {
  rtc.begin();
  rtc.setTime(8, 39, 0); //(12,00,00)Enter your time
  rtc.setDate(23, 8, 2020); //(07,09,2020)Enter your date
}
void loop() {
}
(adsbygoogle = window.adsbygoogle || []).push({});

Code explanation

First, insert the relevant library into the RTC module and create an object as “rtc”. After, I2C communication PINs were added to it.

#include <DS3231.h>
DS3231 rtc(SDA, SCL);

In the Void Setup, the DS3231 library starts first. The time and date entry code is also included.

void setup() {
  rtc.begin();
  rtc.setTime(8, 39, 0);  —- Please enter the Time for this. Enter it as HH:MM:SS
  rtc.setDate(23, 8, 2020);   —- Please enter the Data for this. Enter it as DD:MM:YY
}

There is nothing to include in the void loop.

void loop() {

}
  • OK, now upload this code to the Arduino board. For that, select the correct board and port. Afterward, upload this code.

Step 12

Now, let’s display the date, time, and temperature range entered above in the LCD. Use the following program for that.

  • The complete program of this project – Download
#include <LiquidCrystal_I2C.h>
#include <DS3231.h>
LiquidCrystal_I2C dis(0x27, 16, 2);
DS3231 rtc(SDA, SCL);

void setup() {
  dis.init();
  dis.backlight();
  dis.setCursor(0, 0);
  dis.print("Table Clock");
  dis.setCursor(0, 1);
  dis.print("Loading");
  for (int a = 7; a <= 15; a++ ) {
    dis.setCursor(a, 1);
    dis.print(".");
    delay(400);
  }

  dis.clear();
  rtc.begin();
}

void loop() {
  dis.setCursor(0, 0);
  dis.print("T:");
  dis.print(rtc.getTemp());
  dis.print("/");
  dis.setCursor(8, 0);
  dis.print(rtc.getTimeStr());
  dis.setCursor(3, 1);
  dis.print(rtc.getDateStr());
}

Code explanation

The first includes the I2C library and the RTC library. Next, create an object called “lcd” for the I2C library and add the I2C address and the length and width of the LCD we are using. Then create an object called “rtc” for the RTC library and insert the I2C communication pin into it.

#include <LiquidCrystal_I2C.h>

#include <DS3231.h>

LiquidCrystal_I2C dis(0x27, 16, 2);

DS3231 rtc(SDA, SCL);

In the Void setup, the LCD is initialized and the backlight is turned ON.

void setup() {
  dis.init();
  dis.backlight();
  dis.setCursor(0, 0);
  dis.print("Table Clock");
  dis.setCursor(0, 1);
  dis.print("Loading");
  for (int a = 7; a <= 15; a++ ) {
    dis.setCursor(a, 1);
    dis.print(".");
    delay(400);
  }

  dis.clear();
  rtc.begin();
}

The temperature, date, and time in the void loop are displayed on the LCD.

void loop() {
  dis.setCursor(0, 0);
  dis.print("T:");
  dis.print(rtc.getTemp());
  dis.print("/");
  dis.setCursor(8, 0);
  dis.print(rtc.getTimeStr());
  dis.setCursor(3, 1);
  dis.print(rtc.getDateStr());
}

Now, upload this code to the Arduino board.

(adsbygoogle = window.adsbygoogle || []).push({});

Step 13

Finally, connect the power source to the Arduino LCD clock. You can use any power source for that. Remember to give a potential of 7 – 12 v.

Now, you can test this project. The full video guide is below.

How to make an Arduino Clock – step by step complete tutorial

OK, let’s make this Arduino LCD clock using an Arduino Nano board. Also, this project used an LCD holder. Then we can do this very easily. So, let’s do this project step by step. The required components are given below.

Disclosure: These Amazon links are Affiliate links. As an Amazon Associate, I earn from qualifying purchases.

Step 1

Firstly, Let’s identify these components.

Step 2

Secondly, connect the LCD holder correctly and attach the LCD to it.

Step 3

Thirdly, solder the Arduino Nano board to the dot board using the female headers.

Step 4

Then, connect the RTC module to the dot board.

Step 5

Now connect these components to the Arduino Nano board. For that, use the circuit diagram below.

How to make an Arduino Clock - step by step complete tutorial

Step 6

OK, now set the date and time, use the program below. The above code can be used for this.

  • The complete program of this project – Download
/*Table clock with Arduino.
  created by the SriTu Tech team.
  Read the code below and use it for any of your creations.
*/
 
#include <DS3231.h>
DS3231 rtc(SDA, SCL);
 
void setup() {
  rtc.begin();
  rtc.setTime(0,0,0);//Set time
  rtc.setDate(0,0,0);//set date
}
 
void loop() {
}
  • Then, select the correct board and port, After, upload this code.

Step 7

Okay, let’s upload the final program. It is as follows.

/*Table clock with Arduino.
  created by the SriTu Tech team.
  Read the code below and use it for any of your creations.
*/
#include <LiquidCrystal_I2C.h>
#include <DS3231.h>
LiquidCrystal_I2C dis(0x27, 16, 2);
 
DS3231 rtc(SDA, SCL);
 
void setup() {
  dis.init();
  dis.backlight();
  rtc.begin();
 
  delay(1000);
  start();
  dis.clear();
}
 
void loop() {
  TimeDate();
}
void TimeDate() {
  delay(500);
  dis.setCursor(0, 0);
  dis.print("TIME -- ");
  dis.print(rtc.getTimeStr());
 
  dis.setCursor(0, 1);
  dis.print("DATE -- ");
  dis.print(rtc.getDateStr());
 
}
void start() {
  dis.setCursor(0, 0);
  dis.print("HELLO SRITU TECH");
  dis.setCursor(0, 1);
  dis.print("CLOCK READY");
  for (int a = 11; a < 16; a++) {
    dis.setCursor(a, 1);
    dis.print(".");
    delay(700);
 
  }
}
  • Finally, upload this code to the Arduino board.

Step 8

Now, connect the power source and enjoy it. Remember to give a potential between 7 -12 VDC. The full video guide is given below. We will meet in the next tutorial. Have a good day.

How to make an Arduino Clock – step by step complete tutorial

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *