How to Use a 16×2 LCD Display with Arduino: A Beginner’s Guide

Are you ready to add a cool visual element to your Arduino projects using 16×2 LCD Display? It’s like having your own mini-screen to show off data, messages, and more. In this beginner’s guide, you’ll learn how to use 16×2 LCD Display with Arduino.

What You’ll Need to Use 16×2 LCD Display:
  1. Arduino Board: Any Arduino board will work, but we’ll use an Arduino Uno for this guide.
  2. 16×2 LCD Display: You can easily find this online or at your local electronics store.
  3. Potentiometer (10k ohms): It helps adjust the display’s contrast.
  4. Jumper Wires: To connect everything up.
  5. Breadboard: Makes it easy to build temporary circuits.
Get those product:

Arduino Uno, LCD Display, 10k Potentiometer, Jumper Wires, Bread Board.

16×2 LCD Display Pinout:
16x2 lcd display pinout
Figure 1:16×2 LCD Display Pinout
Brief Description of 16×2 LCD Display:

The 16×2 LCD display is a compact yet versatile component widely used in electronics projects. With its 16-character width and 2-line display, it offers a clear and easy-to-read interface. Operating at 5V, it’s compatible with Arduino and other micro-controllers. A potentiometer controls contrast, ensuring optimal visibility. Ideal for showcasing data, messages, and custom characters in your DIY electronics endeavors.

We have divided this tutorial into 5 Steps:
  1. Wiring it up.
  2. Adding 16×2 LCD Display Library
  3. Code Time
  4. Understanding Code
  5. Upload and Enjoy
Step 1: Wiring it up
16x2 lcd display wiring
Figure 1.1: 16×2 LCD Display Wiring

Let’s start by wiring the components together:

  • Connect the VSS pin of the LCD to GND on the Arduino.
  • Connect VDD to 5V on the Arduino.
  • Hook up the V0 (contrast) pin to the center terminal of the potentiometer.
  • Connect one end of the potentiometer to 5V and the other end to GND.
  • Now, connect the RS, RW, and E pins of the LCD to digital pins 12, GND, and 11 on the Arduino.
  • Wire the data pins D4-D7 on the LCD to digital pins 5-2 on the Arduino.
Step 2: Adding 16×2 LCD Display Library

First download the library from the link. (Download Link)

When this github page will open goto Code>Download ZIP. After clicking on Download ZIP the file will start downloading automatically. After the download is complete, the file needs to be added to the Arduino IDE.

Go to top left corner and click on Sketch>Include Library>Add .ZIP Library. After clicking on Add .ZIP Library, you need to select the downloaded .ZIP file. Then click OK. The library file added successfully.

Step 3: Code Time

Now, let’s get the code ready. We’ll display a simple “Hello, Arduino!” message on the LCD.

#include <LiquidCrystal.h>

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

void setup() {
  // Set up the LCD's number of columns and rows
  lcd.begin(16, 2);

void loop() {
  // Print a message to the LCD
  lcd.print("Hello, Arduino!");
Step 4: Understanding Code

Let’s break down the code:

  • #include <LiquidCrystal.h>
    We’ve included the LiquidCrystal library to make using the LCD easier.
  • LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
    We initialize the LCD with LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
    specifying the pins we’ve connected.
  • In void setup(), we tell the Arduino the LCD’s dimensions (16 columns and 2 rows) with lcd.begin(16, 2);.
  • In loop(), we simply print “Hello, Arduino!” to the LCD with lcd.print("Hello, Arduino!");.
Step 5: Upload and Enjoy

Upload the code to your Arduino, and you’ll see your message scrolling across the LCD. The potentiometer helps you adjust the contrast for optimal readability.

Beyond the Basics:

You’ve now successfully used a 16×2 LCD display with your Arduino. But there’s so much more you can do:

  1. Display Sensor Data: Connect sensors like a temperature or humidity sensor and display real-time data on the LCD.
  2. Create Custom Characters: Design your own characters and symbols to display.
  3. Scrolling Text: Make text scroll to display longer messages.
  4. Menu Systems: Build interactive menus for your projects.

If you encounter issues, here are some common troubleshooting tips:

  • Check Wiring: Double-check your connections. Wiring errors are common.
  • Library: Ensure you’ve installed the LiquidCrystal library perfectly.
  • Contrast: Adjust the potentiometer until the text is visible.

Congratulations! You’ve unlocked the power of the 16×2 LCD display with Arduino. This beginner’s guide has taken you through the basics of wiring, coding, and troubleshooting. Now, it’s time to let your creativity flow. Experiment, build, and enhance your projects with this nifty little display. Happy tinkering!