In this project, we’ll see how to display the time and date on an LCD screen. This project can be very useful for making an alarm clock or just a clock. All you need to do is add batteries to the Arduino board and print a box using a 3d printer, and you’ve got a truly autonomous clock.


Materials required

We will now list the hardware required for the project:

  • Arduino Uno board
  • 16×2 Liquid Crystal LCD display
  • Potentiometer
  • A 220 ohm resistor
  • Connecting wires (about fifteen!)

Schematic diagram

What's the potentiometer for?

The potentiometer adjusts the screen brightness. You can do without it by connecting 5V directly to the brown wire, and the GND that runs from the potentiometer to the screen can be connected directly to the Arduino board.

Project program

#include <LiquidCrystal.h> // Library for LCD Displays

int heure_date[6] = {10,34,18,18,10,2022}; //second minute hour day month year
int mod[6] = {60,60,24,31,12,3000}; // increment limit
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); // We initialize the library with the pins where the display is connected

void setup() {
  lcd.begin(16, 2); // We initialize the screen with its size

void loop() {
  heure_date[0]++;//time increment
    for (int i = 0; i < 6 ; i++){
      if (heure_date[i] == mod[i]) { // limit verification
        if (i<5) {heure_date[i+1] ++;}
        heure_date[i] = 0;
    lcd.setCursor(0,0); //Place the cursor on the first line
    for (int j = 3; j < 5; j++) { //date display
      if (heure_date[j]<10){
        else {lcd.print(heure_date[j]);}
    lcd.setCursor(0,1); //Place the cursor on the second line
    for (int j = 2; j >= 0; j--) { //time display 
      if (heure_date[j]<10)
        lcd.print ("0");
      }else {lcd.print(heure_date[j]);}
      if (j != 0){

Change time and date in the program!

As you can see from the picture, the start date and time is fixed and not necessarily on the right day. You can therefore change this date yourself in the program.

Here’s the line to change:

int heure_date[6] = {10,34,18,18,10,2022}; //seconde minute heure jour mois année

How can I keep the current time when the Arduino is switched off?

As you can see, the clock and date do not continue to update once the Arduino board has been switched off. This can be annoying if you’re making a clock, for example. To solve this problem, you can add an rtc clock module (like the DS3231) to your project, which will calculate the time even when the Arduino board is switched off, thanks to a battery independent of the Arduino board’s power supply.

Simulation of the project

Here is the project simulation on tinkercad: