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

How to make an Arduino Clock

        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 display. 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 is 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 do this Arduino LCD clock project step by step. So, the required components are given below.

Step 1

Firstly, Let’s identify these components.

Arduino UNO board.

RTC Module.

LCD Display.

I2C Module

Jumper wires.

Li-ion battery holder & Battery.

5mm Foam board.




Step 2

Secondly, cut the foam board into the following sizes. You can change these sizes as you like.
How to make an Arduino Clock

Step 3

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

Step 4

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




Step 5

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

How to make an Arduino 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 8

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

How to make an Arduino Clock

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

Let us now 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.

RTC(DS3231) Library

I2C Library

Arduino LCD clock code

/*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() {
}




Code explanation

For this program, we 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. Also includes a time and date enter code.
void setup() {
  rtc.begin();
  rtc.setTime(8390);  —- Please enter the Time for this. Enter it as HH:MM:SS
  rtc.setDate(2382020);   —- 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 us display the date, time, and temperature range entered above in the LCD. Use the following program for that.

#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(0x27162);

DS3231 rtc(SDA, SCL);

 

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

void setup() {

  dis.init();

  dis.backlight();

  dis.setCursor(00);

  dis.print(“Table Clock”);

  dis.setCursor(01);

  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(00);

  dis.print(“T:”);

  dis.print(rtc.getTemp());

  dis.print(“/”);

 

  dis.setCursor(80);

  dis.print(rtc.getTimeStr());

  dis.setCursor(31);

  dis.print(rtc.getDateStr());

}

 

Well, let’s upload this code to the Arduino board.




Step 13

When all this is done, connect the power source to the Arduino LCD clock. You can use any power source you like for this. Remember to give a potential of 7 – 12 v. The full video guide is given below.

How to make an Arduino Clock





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.

Step 1

Firstly, let’s identify these components.

Arduino Nano board.

RTC module.

LCD display.

LCD holder.

I2C module.

Dot board.

Female & Male headers.

Wires.

Jumper wires.




Step 2

Secondly, connect the LCD holder correctly and attach the LCD to it.
How to make an Arduino Clock

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 wire this circuit, For that, use the circuit diagram below.
How to make an Arduino Clock
How to make an Arduino Clock




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() {
}
Select 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);
 
  }
}
Now, upload this code.



Step 8

Lastly, 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.
How to make an Arduino Clock

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

Similar Posts

Leave a Reply

Your email address will not be published.