Materials
Arduino Uno Buy at Amazon | |
Breadboard Buy at Amazon | |
Jumper Wires Buy at Amazon |
Instructions
- Connect the LCD display and RTC module to the Arduino.
- Wire the LCD to the I2C pins (SDA and SCL).
- Upload the following code to your Arduino:
#include
#include
#include
LiquidCrystal_I2C lcd(0x27, 16, 2);
RTC_DS3231 rtc;
void setup() {
lcd.begin();
rtc.begin();
}
void loop() {
DateTime now = rtc.now();
lcd.setCursor(0, 0);
lcd.print(“Time: “);
lcd.print(now.hour());
lcd.print(“:”);
lcd.print(now.minute());
lcd.print(“:”);
lcd.print(now.second());
delay(1000);
}
Explanation
This code reads the current time from the RTC DS3231 module and displays it on the 16×2 LCD. It’s a straightforward project to understand how to use LCDs with Arduino.
Conclusion
This project demonstrates how to create a digital clock with Arduino. It’s a practical application for learning about timekeeping and LCD interfacing.