Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino UNO Based LCD Timer Display

View and Edit Project In Cirkit DesignerImage of Arduino UNO Based LCD Timer Display

Circuit Documentation

Summary

This circuit features an Arduino UNO microcontroller interfaced with an LCD display and includes a trimmer potentiometer for contrast adjustment and a resistor for backlight current limiting. The Arduino UNO controls the LCD, displaying the elapsed time since the circuit was powered on. The potentiometer allows for the adjustment of the display's contrast, and the resistor ensures the correct current flows through the LCD's backlight.

Component List

Arduino UNO

LCD Display (16 pin)

Trimmer Potentiometer

Resistor

Wiring Details

Arduino UNO

LCD Display (16 pin)

Trimmer Potentiometer

Resistor

Documented Code

#include <LiquidCrystal.h>

// Initialize the LCD with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

unsigned long startTime;

void setup() {
  // Set up the LCD's number of columns and rows
  lcd.begin(16, 2);
  
  // Print a message to the LCD
  lcd.print("Elapsed Time:");
  
  // Initialize the start time
  startTime = millis();
}

void loop() {
  // Calculate the elapsed time in milliseconds
  unsigned long elapsedTime = millis() - startTime;
  
  // Convert elapsed time to seconds with one decimal place
  float elapsedTimeSec = elapsedTime / 1000.0;
  
  // Set the cursor to the second row, first column
  lcd.setCursor(0, 1);
  
  // Print the elapsed time to the LCD
  lcd.print(elapsedTimeSec, 1); // 1 specifies the number of decimal places
  
  // Add a small delay to avoid flickering
  delay(100);
}

This code is designed to run on the Arduino UNO microcontroller. It initializes the LCD display and continuously updates it with the elapsed time since the Arduino was reset or powered on. The time is displayed in seconds with one decimal place. The LCD is configured to use a 4-bit data interface with the Arduino, and the potentiometer is used to adjust the contrast of the display.