Arduino Nano LCD 16x4 Display

The LCD 16x4 Display project demonstrates how to interface an LCD 16x4 display with an Arduino Nano. The display can show four lines of text with up to 16 characters per line. This project initializes the display and prints static and dynamic messages on each line.

Components Needed

  • Arduino Nano
  • LCD 16x4 Display
  • Jumper Wires
  • 10K Potentiometer
  • Breadboard

Circuit Setup

1. Connect LCD 16x4 Display to Arduino Nano:

RS (Register Select) pin to D12 pin on the Arduino Nano.

E (Enable) pin to D11 pin on the Arduino Nano.

D4 pin to D5 pin on the Arduino Nano.

D5 pin to D4 pin on the Arduino Nano.

D6 pin to D3 pin on the Arduino Nano.

D7 pin to D2 pin on the Arduino Nano.

VSS pin to GND on the Arduino Nano.

VDD pin to 5V on the Arduino Nano.

V0 pin to the middle pin of the 10K potentiometer.

The other two pins of the potentiometer to 5V and GND.

A (Anode) pin to a resistor (220 ohms) then to 5V.

K (Cathode) pin to GND.

How the LCD 16x4 Works

The 16x4 LCD has 16 characters per line and 4 lines. The Arduino uses the 4‑bit mode (RS, E, D4–D7) and the LiquidCrystal library, initializing the display with lcd.begin(16, 4) and printing text on each line by setting the cursor position with lcd.setCursor.

Program: Arduino Nano LCD 16x4 Display (Static + Dynamic Messages)
#include <LiquidCrystal.h>

// Pin connections (RS, E, D4, D5, D6, D7)
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
  // Initialize the LCD (16 columns, 4 rows)
  lcd.begin(16, 4);

  // Static messages on 4 lines
  lcd.print("Line 1: Static");
  lcd.setCursor(0, 1);
  lcd.print("Line 2: Welcome");
  lcd.setCursor(0, 2);
  lcd.print("Line 3: Arduino Nano");
  lcd.setCursor(0, 3);
  lcd.print("Line 4: Ready");

  delay(3000);

  // Clear and show dynamic content
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Line 1: Running");
  lcd.setCursor(0, 1);
  lcd.print("Line 2: Time: 0 s");
  lcd.setCursor(0, 2);
  lcd.print("Line 3: Ready");
  lcd.setCursor(0, 3);
  lcd.print("Line 4: Go!");
}

void loop() {
  // Update line 2 every second with current time in seconds
  unsigned long seconds = millis() / 1000;
  lcd.setCursor(0, 1);
  lcd.print("Line 2: Time: "  + String(seconds) + " s");

  delay(1000);
}

Instructions

1. Circuit Setup:

Wire the LCD 16x4 display to the Arduino Nano as described in the circuit setup section.

Adjust the potentiometer to set the contrast of the display until the characters are clearly visible.

2. Code Upload:

Connect the Arduino Nano to your computer via USB.

Open the Arduino IDE and paste the provided LCD 16x4 code.

Upload the code to the Arduino Nano.

3. Testing:

Once the code is uploaded, observe the messages printed on the LCD.

The display will initially show four static lines of text.

After 3 seconds, the display will clear and show dynamic messages on each line, including a counter that updates every second.

Applications

Information Display: Utilize the four‑line display to show multiple sensor readings, status messages, or configuration values at once.

Menu System: Create a user interface with menu options displayed on different lines, moving a cursor highlight with buttons or a keypad.

Data Visualization: Show data in a compact tabular layout or log‑style lines for monitoring processes over time.

Troubleshooting

  • No text visible? Verify the 10K potentiometer and wiring to RS, E, D4–D7; ensure the V0 line is from the middle pin of the potentiometer.
  • Only first line shows text? Confirm lcd.begin(16, 4) is used and lcd.setCursor(0, 1), lcd.setCursor(0, 2), lcd.setCursor(0, 3) are used for lines 2–4.
  • Incorrect text position or missing lines? Check that the pin order in LiquidCrystal lcd(12, 11, 5, 4, 3, 2) matches your wiring exactly.

Best Practices and Notes

  • Always call lcd.begin(16, 4) once in setup() to properly initialize the display dimensions.
  • Use lcd.clear() before updating multi‑line content to avoid leftover characters from earlier messages.
  • For long‑running projects, avoid printing the whole screen every millisecond; update only the lines that change.

Extensions and Ideas

You can extend this project by displaying real‑time sensor data (temperature, humidity, etc.), building a multi‑line menu system, or scrolling long messages across the screen by updating the text position in loop().