Introduction

Creating a clock with a running text display using an Arduino is a fun and educational project. In this tutorial, we will guide you through the process of building a 24-hour format clock that displays the time in a scrolling text format. By the end of this project, you’ll have a unique and functional digital clock.

Components You’ll Need

  1. Arduino board (e.g., Arduino Uno)
  2. 16×2 LCD display (compatible with Hitachi HD44780 controller)
  3. Potentiometer (for adjusting LCD contrast)
  4. Breadboard and jumper wires
  5. Arduino IDE (installed on your computer)

Step 1: Set Up Your Hardware

  1. Connect the 16×2 LCD display to your Arduino as follows:
    • VSS (Ground) to GND on Arduino
    • VDD (Power) to 5V on Arduino
    • VO (LCD Contrast) to the center pin of the potentiometer
    • RS (Register Select) to Digital Pin 7
    • RW (Read/Write) to GND on Arduino
    • E (Enable) to Digital Pin 8
    • D4 to Digital Pin 9
    • D5 to Digital Pin 10
    • D6 to Digital Pin 11
    • D7 to Digital Pin 12
    • A (Anode – LED+) to 5V on Arduino
    • K (Cathode – LED-) to GND on Arduino
  2. Adjust the LCD contrast by turning the potentiometer until the text is visible.

Step 2: Write the Arduino Sketch

Open the Arduino IDE on your computer and create a new sketch. Copy and paste the following code into your sketch:

#include <LiquidCrystal.h>

LiquidCrystal lcd(7, 8, 9, 10, 11, 12);

void setup() {
lcd.begin(16, 2); // Set the LCD to 16×2 character display
}

void loop() {
// Get the current time in 24-hour format
unsigned long currentTime = millis();
unsigned long seconds = (currentTime / 1000) % 60;
unsigned long minutes = (currentTime / 60000) % 60;
unsigned long hours = (currentTime / 3600000) % 24;

// Format the time as a string in HH:MM:SS format
String timeString = String(hours) + “:” + (minutes < 10 ? “0” : “”) + String(minutes) + “:” + (seconds < 10 ? “0” : “”) + String(seconds);

// Display the time on the LCD
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(“Time: “);
lcd.setCursor(0, 1);
lcd.print(timeString);

// Delay to control text scrolling speed
delay(500);

// Scroll the text to the left
for (int i = 0; i < 12; i++) {
lcd.scrollDisplayLeft();
delay(500);
}
}

Connect your Arduino to your computer using a USB cable and select the correct board and port in the Arduino IDE. Then, click the “Upload” button to upload the sketch to your Arduino.

Step 4: Watch Your Running Text Clock

Once the upload is complete, you’ll see the time displayed on the LCD. It will scroll the time in a loop, creating a running text effect. The clock will continuously update to reflect the current time.

Conclusion

Congratulations! You’ve successfully built a running text clock using an Arduino in 24-hour format. This project is a great way to learn about interfacing with LCD displays and using Arduino to create functional devices. You can further enhance this project by adding features like date display or alarm functionality. Enjoy your unique digital clock!

By admin

Leave a Reply

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