Steve Zafeiriou (b. 1998, Thessaloniki, GR) is a New Media Artist, Technologist, and Founder of Saphire Labs. His practice investigates how technology can influence, shape, and occasionally distort the ways individuals perceive the external world. By employing generative algorithms, electronic circuits, and interactive installations, he examines human behavior in relation to the illusory qualities of perceived reality, inviting observers to reconsider their assumptions and interpretations.

Audiovisual performance titled Qualia, cover image showing 3 people partying with digital AI effects

Qualia

In search of IKIGAI
dark mode light mode Search SAPPHIRE LABS Menu
Search

Arduino LCD: Wiring, I2C Code, and Live Sensor Data for Interactive Projects

Learn how to connect and program an Arduino LCD in this beginner-friendly guide. Discover wiring, examples, and troubleshooting to master your projects.
Front-facing view of a 16x2 Arduino LCD module displaying 'Hello, Steve! ArduinoLCD Guide,' connected via an I2C adapter to streamline wiring.

An Arduino LCD is a character display — almost always a 16×2 or 20×4 module built on the Hitachi HD44780 controller — that prints text straight from your sketch. You can wire it in 4-bit parallel mode using six I/O pins, or solder on an I2C backpack and drive the whole screen with two.

Whether you’re creating a temperature monitor, a digital clock, or an interactive smart home display, Arduino LCD screens are essential for turning ideas into functional designs.

I’m a new media artist and technologist, and I’ve had one of these screens on my bench for most of the last decade — wired into prototypes for interactive art installations long before anything reached a gallery wall. Below is the wiring, the I2C shortcut, working code, the failures that actually cost me time, and an honest account of where a character LCD belongs in a real build — and where it doesn’t.

Short answer: For an I2C LCD, connect SDA → A4 and SCL → A5 on an Uno (20/21 on a Mega), VCC → 5V, GND → GND. Install LiquidCrystal_I2C, then call lcd.init(), lcd.backlight(), and lcd.print("Hello, World!"). If the screen stays blank, your address is 0x3F rather than 0x27, or the contrast pot needs turning — those two account for nearly every failure.

Breadboard setup featuring an Arduino Nano connected to an I2C-equipped 16x2 LCD display, illustrating proper wiring for displaying text like 'Hello, Steve!' on the screen.
Breadboard setup featuring an Arduino Nano connected to an I2C-equipped 16×2 LCD display, illustrating proper wiring for displaying text like ‘Hello, Steve!’ on the screen.

What Is an Arduino LCD and Why Use It?

An Arduino LCD (Liquid Crystal Display) is a tool for displaying information in electronics projects.

These screens are popular among makers, artists, and developers for their functionality.

Available in configurations like 16×1, 16×2, and 20×4, they often include the Hitachi LCD controller HD44780, which ensures compatibility with various Arduino boards.

What makes Arduino LCD displays so effective is their flexibility.

They can be set up in 4-bit mode with seven I/O pins or 8-bit mode with eleven, allowing you to adjust complexity based on your project’s requirements. Whether you’re designing a temperature display, Arduino art projects or experimenting with custom characters, these screens adapt to your needs.

With their user-friendly integration and adaptability, Arduino LCDs make it easy to incorporate clear and functional visual elements into your projects, no matter the scale or complexity.

Why Use an Arduino LCD?

Versatility

An Arduino LCD can display anything from a simple “Hello” to detailed graphics. For projects requiring visual complexity, a graphical LCD (GLCD) with resolutions like 128×64 is ideal.

These displays, supported by controllers such as KS0108 and SSD1306, make it straightforward to showcase images, characters, or any custom design.

Ease of Use

With options like Zero Insertion Force (ZIF) connectors or through-hole designs, Arduino LCD wiring is simple and efficient, removing the need for extensive soldering.

This streamlined setup process makes connecting an Arduino LCD display quick and hassle-free.

Efficiency

When equipped with an SPI interface, Arduino LCDs reduce wiring complexity and improve data transfer speeds.

This efficiency makes them a go-to choice for projects where timing and performance are critical.

Creative Potential

From a functional Arduino digital clock to an interactive weather display or a custom quiz interface, the possibilities are endless.

These displays are compatible with various boards like Arduino Uno, Nano, and Mega, making them accessible for beginners and professionals alike.

If you’re just starting, an Arduino Starter Kit can simplify your introduction to Arduino LCD programming.

Close-up view of an Arduino LCD 16x2 module with an I2C adapter connected for simplified wiring, showcasing key components such as SDA, SCL, GND, and VCC pins for seamless integration.
Close-up view of an Arduino LCD 16×2 module with an I2C adapter connected for simplified wiring, showcasing key components such as SDA, SCL, GND, and VCC pins for seamless integration.

Tools and Components Needed to Set Up an Arduino LCD

To set up an Arduino LCD, you’ll need a few essential tools and components. Here’s what you’ll need to get started:

Arduino Board (e.g., Uno, Nano, Mega)

The microcontroller board is the foundation of any Arduino project. Depending on your project’s requirements, you can choose between:

Arduino BoardDescription
Arduino UnoA versatile option for beginners, offering sufficient I/O pins for most Arduino LCD projects.
Arduino NanoCompact and ideal for projects where space is limited.
Arduino MegaEquipped with a high number of I/O pins, making it suitable for larger or more complex setups.

If you’re uncertain about which board to pick, consider exploring an Arduino Starter Kit, which includes everything you need to kickstart your Arduino LCD setup.

For this guide I will use the Arduino Nano as example as I have a lot of them.

LCD Module (16×2 or 20×4)

For displaying text and numbers, an LCD module is a must-have. I opted for a 16×2 LCD module for a straightforward setup with two lines of text.

If your project requires more space for information, the 20×4 LCD module offers extra lines and characters, making it ideal for more detailed displays.

LCD ModuleDescription
16×2Two lines, 16 characters each—compact and efficient.
20×4Four lines, 20 characters each—great for more detailed output.

Both modules use the Hitachi HD44780 controller, which integrates seamlessly with Arduino, making them reliable choices for Arduino LCD projects.

Whether your focus is simplicity or detail, these modules deliver dependable performance.

Potentiometer for Contrast Adjustment

A potentiometer is essential for fine-tuning the Arduino LCD contrast.

By adjusting it, you can ensure the text on the screen is crisp and easy to read, whether you’re displaying simple messages or detailed data.

I2C Adapter for Easy Wiring

An I2C adapter simplifies the often complex wiring involved in connecting an Arduino LCD display.

Instead of dealing with multiple pins, you only need four connections: VCC, GND, SDA, and SCL.

This not only makes the setup cleaner but also frees up additional pins on your Arduino board for other components or sensors.

AdapterDescription
I2C AdapterReduces wiring to four pins and preserves Arduino pins.

With this toolkit, an LCD module, potentiometer, and I2C adapter, you’ll have everything needed to get started with Arduino LCD programming.

Working with these displays isn’t just functional; it’s an exciting way to bring your ideas to life.

Learn more about Arduino Serial Communication.

Detailed wiring of an Arduino Nano connected to a breadboard and an I2C-equipped 16x2 LCD module, demonstrating a compact setup for efficient LCD programming and data display.
Detailed wiring of an Arduino Nano connected to a breadboard and an I2C-equipped 16×2 LCD module, demonstrating a compact setup for efficient LCD programming and data display.

How to Connect an Arduino LCD: Step-by-Step Guide

Setting up an Arduino LCD display is a straightforward process that can enhance your project by adding clear visual output.

Follow this guide to connect and configure a standard LCD module for your Arduino board.

Tools and Components You’ll Need:

  1. Arduino board: Uno, Nano, or Mega (or any other microcontroller such esp32).
  2. LCD module: 16×2 for basic text or 20×4 for more space.
  3. Potentiometer (10kΩ): For adjusting the Arduino LCD contrast (except if you use the i2c adapter witch already has a potentiometer implemented into the board).
  4. Jumper wires: Enough to connect everything securely.

Step 1: Wiring the LCD to Your Arduino

Use the table below to connect the pins of the LCD module to your Arduino board.

LCD PinFunctionArduino Pin
1 (Ground)GNDGND
2 (5V Power)Power supply5V
3 (Contrast)Contrast adjustmentMiddle pin of potentiometer
4 (RS)Register Select12
5 (R/W)Read/WriteGND
6 (EN)Enable11
7–10 (D0–D3)Data pins (unused)Not connected
11 (D4)Data Pin 45
12 (D5)Data Pin 54
13 (D6)Data Pin 63
14 (D7)Data Pin 72
15 (Backlight +)Power for backlight5V
16 (Backlight -)Backlight groundGND

Step 2: Adjusting Contrast

Connect the potentiometer to control the contrast of your LCD:

  1. One end of the potentiometer goes to 5V.
  2. The other end goes to GND.
  3. The middle pin connects to LCD Pin 3 (Contrast).

Twist the potentiometer to adjust the display’s clarity until your text appears clearly.

Step 3: Power and Test

Once the wiring is complete, upload your Arduino LCD sketch using the LiquidCrystal library.

Start with basic examples like displaying “Hello, World!” to confirm your setup works.

Understanding the Key Arduino LCD Pins (RS, EN, D4-D7)

Understanding the function of each pin on an Arduino LCD module is crucial for a successful setup.

Here’s a breakdown of the key pins and their roles:

  1. RS (Register Select): This pin determines whether you’re sending data (text to display) or instructions (commands for the LCD). It’s connected to Pin 4 on the LCD and typically mapped to Arduino Pin 12.
  2. EN (Enable): The Enable pin acts like a trigger, signaling the LCD to process the incoming command or data. It’s connected to Pin 6 on the LCD and usually wired to Arduino Pin 11.
  3. D4-D7 (Data Pins): These pins transfer the actual data to the LCD, whether it’s text or graphical content. They’re connected as follows:

    D4: LCD Pin 11Arduino Pin 5
    D5: LCD Pin 12Arduino Pin 4
    D6: LCD Pin 13Arduino Pin 3
    D7: LCD Pin 14Arduino Pin 2

Each pin has a specific role in ensuring the LCD interprets and displays the intended information accurately.

Familiarity with these functions helps streamline your Arduino LCD wiring and avoids common setup issues.

Simplified Wiring with an I2C Adapter for Arduino LCDs

Using an I2C adapter streamlines the process of connecting an Arduino LCD display, reducing the number of wires and saving GPIO pins for other components. Here’s how you can set it up:

Tools You’ll Need:

  1. Your preferred Arduino board.
  2. An LCD module fitted with an I2C adapter.
  3. A set of jumper wires.

Step 1: Connect the I2C Adapter to the Arduino

Use the table below to connect the I2C adapter to your Arduino board:

I2C PinFunctionArduino Pin
GNDGroundGND
VCCPower supply5V
SDAData lineA4 (on Uno & Nano)
SCLClock lineA5 (on Uno & Nano)

Note: On some boards like the Arduino Due, SDA and SCL pins may be located differently, so refer to the board’s pinout.

Step 2: Install the LiquidCrystal_I2C Library

  1. Open the Arduino IDE.
  2. Navigate to Sketch > Include Library > Manage Libraries.
  3. Search for “LiquidCrystal_I2C” and install the required library.

Why Use an I2C Adapter?

Switching to I2C significantly reduces the wiring complexity by consolidating connections to just four pins: GND, VCC, SDA, and SCL.

This is especially useful when you need to conserve GPIO pins for other peripherals.

Best Sensors for Interactive Art Installations
Best Sensors for Interactive Art Installations

Programming the Arduino LCD: Easy Code Snippets

Working with an Arduino LCD display can turn your projects into interactive systems.

Here are some simple steps and code snippets to help you get started, troubleshoot, and explore advanced features.

Installing the LiquidCrystal Library

To get started with Arduino LCD programming, you’ll need the LiquidCrystal library, which includes all the functions needed to control the display.

  1. Open the Arduino IDE.
  2. Navigate to Sketch > Include Library > Manage Libraries.
  3. Search for LiquidCrystal and click Install.

Writing a “Hello, World!” Program

A classic first step is displaying “Hello, World!” on your LCD. Here’s the code:

#include <LiquidCrystal.h>  

// Initialize the library with the pins connected to the LCD  
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);  

void setup() {  
  lcd.begin(16, 2);  // Set up the LCD's dimensions (16x2)  
  lcd.print("Hello, World!");  // Display a message  
}  

void loop() {  
  // Nothing to do here  
}  

Enhancing Display: Text Positioning and Scrolling

You can control where text appears and add scrolling effects for dynamic displays.

#include <LiquidCrystal.h>  

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);  

void setup() {  
  lcd.begin(16, 2);  
  lcd.setCursor(0, 0);  // Position cursor on the first row  
  lcd.print("Line 1");  
  lcd.setCursor(0, 1);  // Position cursor on the second row  
  lcd.print("Line 2");  
}  

void loop() {  
  for (int i = 0; i < 15; i++) {  
    lcd.scrollDisplayRight();  // Scroll text to the right  
    delay(150);  
  }  
  for (int i = 0; i < 15; i++) {  
    lcd.scrollDisplayLeft();  // Scroll text to the left  
    delay(150);  
  }  
}  

Displaying Sensor Data: Temperature and Humidity Monitor

Using an Arduino LCD to display real-time sensor data, like temperature and humidity, makes your project interactive.

Here’s an example with a DHT11 sensor:

#include <LiquidCrystal.h>  
#include <DHT.h>  

#define DHTPIN 2  
#define DHTTYPE DHT11  

DHT dht(DHTPIN, DHTTYPE);  
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);  

void setup() {  
  lcd.begin(16, 2);  
  dht.begin();  
}  

void loop() {  
  float temp = dht.readTemperature();  
  float humidity = dht.readHumidity();  

  lcd.setCursor(0, 0);  
  lcd.print("Temp: ");  
  lcd.print(temp);  
  lcd.print(" C");  

  lcd.setCursor(0, 1);  
  lcd.print("Humidity: ");  
  lcd.print(humidity);  
  lcd.print(" %");  

  delay(2000);  
}  

Once you’ve mastered the basics, consider exploring ESP32 projects to integrate advanced features.

To take your projects to the next level, experiment with various Arduino sensors to build interactive and innovative applications.

Happy tinkering!

Check out my comprehensive guide on Arduino If Else Statements for a deeper understanding of the programming logic.

Writing a “Hello, World!” Program using LiquidCrystal_I2C.h

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

// Set the I2C address for the LCD (common addresses are 0x27 or 0x3F)
// Use an I2C scanner sketch if you're unsure of your adapter's address
LiquidCrystal_I2C lcd(0x27, 16, 2);

void setup() {
  // Initialize the LCD
  lcd.init();
  // Turn on the LCD backlight
  lcd.backlight();

  // Print messages on the LCD
  lcd.setCursor(0, 0); // Set cursor to column 0, row 0
  lcd.print("Hello, Steve!");

  lcd.setCursor(0, 1); // Set cursor to column 0, row 1
  lcd.print("ArduinoLCD Guide");
}

void loop() {
  // No continuous tasks required for this setup
}

Important Notes for Setup:

  1. Verify the I2C Address: The I2C address (commonly 0x27 or 0x3F) depends on your adapter. If you’re unsure of the address, run an I2C scanner sketch to detect the correct value.
  2. Library Initialization: Use lcd.init() to initialize the display. Use lcd.backlight() to turn on the backlight.
Front-facing view of a 16x2 Arduino LCD module displaying 'Hello, Steve! ArduinoLCD Guide,' connected via an I2C adapter to streamline wiring.
Front-facing view of a 16×2 Arduino LCD module displaying ‘Hello, Steve! ArduinoLCD Guide,’ connected via an I2C adapter to streamline wiring.

Common Issues and Troubleshooting Tips

When working with Arduino LCDs, encountering problems is part of the learning process.

Here are some common issues and practical fixes to get your display up and running:

Screen Not Displaying Text

This is often caused by wiring errors or improper contrast settings.

  1. Check Your Wiring: Ensure all connections between your Arduino and LCD are secure and correctly matched. Double-check critical pins like RS, EN, and D4-D7.
  2. Adjust the Potentiometer: The potentiometer controls the LCD contrast. Rotate it to find the ideal contrast level where the text becomes visible.
  3. Backlight Issues: If the backlight isn’t working, check the power and ground connections to the backlight pins. Use analogWrite() to control brightness. Example:
analogWrite(10, 255);  // Sets backlight to maximum brightness  

Random Characters or No Response: Library and Code Problems

When your Arduino LCD shows random symbols or remains unresponsive, the issue often lies in library setup or code configuration.

Here’s how to address these problems:

  1. Library Installation: For standard LCD modules, use the LiquidCrystal library, available in the Arduino IDE’s Library Manager. For I2C-based LCDs, the LiquidCrystal_I2C library is recommended, as it simplifies setup and often auto-detects I2C addresses.
  2. Library Configuration for I2C: If you’re using an I2C adapter, getting the I2C address and pin mapping correct is critical. The LiquidCrystal_I2C library typically detects these settings automatically, but you can also use an I2C scanner sketch to confirm the address.
  3. Sample Code for Initialization: To test your setup, start with a simple “Hello, World!” program to verify everything is working correctly.
#include <Wire.h>  
#include <LiquidCrystal_I2C.h>  

LiquidCrystal_I2C lcd(0x27, 16, 2);  // Address 0x27, 16 columns, 2 rows  

void setup() {  
  lcd.begin();          // Initialize the LCD  
  lcd.backlight();      // Turn on the backlight  
  lcd.print("Hello, World!");  // Display text  
}  

void loop() {  
  // Nothing to do here for now  
}  

One library gotcha worth knowing before you lose an evening to it: older sketches (including some still circulating on forums) call lcd.begin() with no arguments. The widely installed LiquidCrystal_I2C library by Frank de Brabander expects lcd.init() instead, and passing no arguments to begin() will fail to compile or leave you with a lit backlight and no characters. If a copied sketch won’t build, swap begin() for init() before you start rewiring anything.

Advanced Troubleshooting: I2C Conflicts and Backlight Issues

If you’re facing persistent issues with your Arduino LCD, such as I2C address conflicts or erratic backlight behavior, these advanced tips can help you resolve the problem:

  1. I2C Address Conflicts: Use an I2C scanner sketch to identify all connected devices and confirm their addresses.
  2. Backlight Control: Double-check the wiring to the backlight control pin. Use analogWrite() to adjust brightness levels.
  3. Check for Power Supply Issues: Verify that your Arduino is receiving a stable power supply. For power-intensive projects, consider using an external power source to avoid overloading the Arduino.

By addressing these issues, you can ensure your Arduino LCD display operates smoothly.

For more detailed guides, explore resources on the web server setup and Arduino installation control.

How I Actually Use Arduino LCDs in My Installations

Here is the honest version, and it contradicts most tutorials: a 16×2 character LCD is a diagnostic instrument, not an exhibition display. In the pieces I’ve shown, the audience-facing screen is a TFT — GeoVision runs an ESP32-S3 driving a Waveshare 1.69″ panel, because a gallery visitor should see a rendered interface, not two rows of monospace text. The HD44780 lives one layer behind that, inside the enclosure, telling me what the machine is thinking.

That role is worth more than it sounds. On install day you are on a ladder in a room with no Wi-Fi, the piece is misbehaving, and your laptop is three metres away on the floor. A 16×2 taped inside the housing showing the raw sensor value and the Wi-Fi state answers “is it the sensor or is it my code?” in one glance, with no Serial Monitor attached. That single question is most of debugging.

Three things I’ve learned the hard way, none of which show up in the standard wiring tutorial:

  • Don’t refresh the screen every loop. Pushing a full 16-character line over I2C at 100 kHz costs a couple of milliseconds of blocking time. Do that on every iteration while you’re also sampling an MPU6050, and you’ve quietly added jitter to your motion data to display numbers no one reads at 200 fps. I refresh on change, or every 200 ms — whichever is rarer.
  • The backlight is a light source, and galleries are dark. A stock LCD backlight throws a genuinely visible blue-green glow across a floor in a blacked-out room. If the screen is inside a piece, either dim it with analogWrite() on the backlight pin, or put gaffer tape over the housing seam. I have been caught by this at an opening.
  • I2C is about pins, not convenience. Parallel mode eats six GPIO. On a board already carrying sensors that’s six pins you don’t have — and the ESP32 in particular has strapping pins and ADC2 conflicts that shrink your usable set further. The LCD at 0x27 shares the bus happily with an MPU6050 at 0x68 and a temperature sensor at 0x76. Different addresses, same two wires.

So: build with the 16×2, and keep it. Just be clear-eyed about who it’s for. It earns its four dollars on the workbench and inside the enclosure — and the moment the work is about what a visitor feels rather than what a sensor reads, you want a different screen.

esp32 soil moisture sensor with lilygo t-display s3 with custom user interface measuring real-time data on a plant
esp32 soil moisture sensor with lilygo t-display s3 with custom user interface measuring real-time data on a plant

Creative Arduino LCD Projects to Try

Experimenting with Arduino LCD displays opens the door to a world of creative and functional projects.

Here are some exciting ideas to inspire your next build:

ProjectMain ComponentsUse Case
Digital ClockArduino, RTC DS1307, LCDKeeping Time
Temperature/HumidityArduino, DHT11, LCDMonitoring environmental conditions
Countdown TimerArduino, LCD, ButtonsTiming tasks in kitchens or labs
Gaming Leaderboard/QuizArduino, LCD, ButtonsAdding fun to games or interactive events

Digital Clock with LCD

A digital clock is a classic yet rewarding project that combines practicality with creativity.

Using an Arduino board, an RTC DS1307 module, and a 16×2 LCD display, you can create a real-time clock that shows both the time and date.

Temperature and Humidity Monitor

A temperature and humidity monitor is a practical project that’s both fun and functional.

Pair an Arduino Uno, a DHT11 sensor, and a 16×2 LCD module, and you can display real-time environmental data.

Countdown Timer for Kitchen or Lab Use

A countdown timer is a simple yet highly functional project, ideal for everyday use in kitchens or labs.

Using an Arduino board, an LCD module, and a few push buttons, you can create a timer that:

  • Counts down from a set time.
  • Triggers a buzzer when the time reaches zero.

This project is perfect for mastering the basics of Arduino programming, button control, and LCD display wiring while creating something you can actually use.

Gaming Leaderboard or Interactive Quiz Display

Looking to add a fun and interactive twist to your Arduino LCD projects? Build a gaming leaderboard or an interactive quiz display.

With an Arduino board, an LCD module, and a few input buttons, you can:

  • Track player scores during games in real-time.
  • Display quiz questions and record answers for friendly competitions.

This project is perfect for family gatherings, classrooms, or even as an interactive feature in art exhibitions.

It combines coding, wiring, and creativity for a unique user experience.

FAQ: Arduino LCD

Conclusion

Arduino LCD screens offer a gateway to endless creative and interactive possibilities. By mastering their wiring, programming, and troubleshooting, you gain the ability to turn ideas into tangible, functional projects.

Whether you’re just starting or an experienced maker, there’s always room to explore and innovate.

Total
0
Shares
Nostalgie world generative universe illustration of the main character falling from the sky

Bonded Studio grew from years of artistic research into attention, intimacy, behavior, and the "connected but disconnected" generation paradox.

Now, that research is becoming a real two-person connection app designed to help people move beyond small talk, share more meaningful moments, and feel more present with one another.

Join the waitlist to get early access, product updates, and the opportunity to help shape Bonded before its public launch.

Technology should help us become more present, not more performative.