16×2 LCD Interfacing with Arduino including the code

Are you struggling to figure out how 16×2 LCD interfacing with Arduino? Don’t worry, in this tutorial you will learn everything you need to know about 16×2 LCD displays briefly and to the point.

How to interface it with Arduino Uno with a potentiometer and without a potentiometer including the circuit diagram, and you will get the Uno code so you can use it on your project.

Complete this tutorial to the end to know all the details.

What is LCD (Liquid Crystal Display) module?

The LCD (Liquid Crystal Display) is an electronic screen mainly made from Liquid Crystals, there are many sizes available such as 16×2, 16×4, 20×2, 20×4, … 40×4.

But in this Tutorial, we will use this 16×2 LCD size because it is a basic size and commonly used in electrical circuits which we will talk about shortly.

LCD (Liquid Crystal Display)
LCD (Liquid Crystal Display)

16×2 LCD

A 16×2 LCD size is the most commonly used in the applications of embedded systems.

It is called 16×2 because you can display 16 characters in one column and it has 2 rows so, in total, you can display 32 characters on it.

But why is it commonly used in many applications?

  • It’s available in most of the stores.
  • It’s available in educational resources.
  • It’s easy to use and pogrammer-friendly.

16X2 LCD pinout diagram

In this picture down below you will see a 16X2 LCD pinout diagram and the pin configuration.

16X2 LCD Pinout Diagram
16X2 LCD Pinout Diagram
  • VSS: GND of the Arduino
  • VCC: the power supply of the 16×2 LCD connected with a 5V pin in Arduino.
  • VEE (LCD Contrast): to control the 16×2 LCD contrast and brightness by using a potentiometer.
  • RS (Register Select): this pin helps to toggle between command/data register and it is known as a register select pin.
  • RW (Read/Write): this pin decides if will read or write from the 16×2 LCD.
  • E (Enable): this pin works as permission to the internal registers so it will help transfer the instruction from the data pins and another command to the 16×2 LCD.
  • D0-D7 (Data Bus): this pin carries the 8-bit data and sends it to the display as a character in (ASCII code) so if set these pins as 0000 0001 you will see number 1 on the display.
  • LED+: it is a 5V.
  • LED-: it is a GND.

16×2 LCD datasheet

I have put the 16×2 LCD datasheet down below so you can download it.

But beware; you may have a different datasheet, so also look at your datasheet or even the labels on your screen before the connection.

LCD interfacing with Arduino

You can interface 16×2 LCD with any Arduino type you want but in this tutorial, we will use Uno Arduino.

16×2 LCD interfacing with Arduino Uno

You can interface 16×2 LCD with any Arduino type you want but in this tutorial, we will use Uno Arduino.

By using Arduino Uno you can display characters on the 16×2 LCD but there is some equipment to complete this experiment.

Equipment Requirement:

  1. Arduino Uno
  2. 16×2 LCD Screen
  3. Breadboard
  4. Hook-up wires
  5. 10k ohm potentiometer
  6. 220 ohm resistor

16×2 LCD interfacing with Arduino Uno with potentiometer

After you knew the equipment requirement we needed to connect it together so the picture downs below show the connection in detail.

16x2 LCD interfacing with Arduino Uno with potentiometer
16×2 LCD interfacing with Arduino Uno with potentiometer

Follow this table down below which explains the connection between Arduino Uno and 16×2 LCD.

16×2 LCDArduino pins
VSSGND
VCC+5V
RS digital pin 12
RWGND
Edigital pin 11
D4-D7digital pins: 2, 3, 4, 5
LED+5V through a 220 ohm resistor
LED-GND
The table that shows the pin connection between Arduino Uno and 16×2 LCD with potentiometer

And the potentiometer is connected to the +5V and GND in addition to the output to the VEE pin.

16×2 LCD interfacing with Arduino Uno without a potentiometer

The connection with a potentiometer is the same as a without potentiometer but there is a little bit of difference.

So the pictures downs below show the difference in connection in the detail.

16x2 LCD interfacing with Arduino Uno without potentiometer
16×2 LCD interfacing with Arduino Uno without potentiometer

Follow this table down below which and just remove the potentiometer and connect the VEE pin to pin 13 and the GND.

16×2 LCDArduino pins
VSSGND
VCC+5V
RS digital pin 12
RWGND
Edigital pin 11
D4-D7digital pins: 2, 3, 4, 5
LED+5V through a 220 ohm resistor
LED-GND
The table that shows the pin connection between Arduino Uno and 16×2 LCD without a potentiometer

16×2 LCD Arduino code 

After we finish 16×2 LCD interfacing with Arduino the most important thing is the code, this code will show you in the display “Hello world!” and the second-row “ROBOSANS”.


#include <LiquidCrystal.h>

// Creates LCD as an object. Parameters: (rs, enable, d4, d5, d6, d7)
lcd(LiquidCrystal)(12, 11, 5, 4, 3, 2);

void setup() 
{
	// set up the number of columns and rows for LCD:
	lcd.begin(16, 2);

	// Clear the LCD screen
	lcd.clear();
}

void loop() 
{
	// Print this message into the LCD.
	lcd.print(" Hello world!");

	// set the cursor to column 0, line 1
	// (note: line 1 is the second row, since counting begins with 0):
	lcd.setCursor(0, 1);
	// Print this message into the LCD.
	lcd.print(" ROBOSANS");
}

Frequently Asked Questions

What is a 16×2 LCD display?

The LCD (Liquid Crystal Display) is an electronic screen mainly made from Liquid Crystals, there are many sizes available such as: 16×2, 16×4, 20×2, 20×4, … 40×4.
A 16×2 LCD size is the most commonly used in the applications of embedded systems.
It is called 16×2 because you can display 16 characters in one column and it has 2 rows so, in total, you can display 32 characters on it.
But why is it commonly used in many applications?
·         It’s available in most of the stores.
·         It’s available in educational resources.
·         It’s easy to use and programmer-friendly.

What is 16×2 LCD Arduino?

16×2 LCD is a basic size and is commonly used in electrical circuits. You can display 16 characters in one column and it has 2 rows so, in total, you can display 32 characters on it by interfacing 16×2 LCD with Arduino.

How to connect 16×2 LCD to Arduino?

The picture down below shows the 16×2 LCD interfacing with Arduino in detail.
The connection with a potentiometer is the same as a without potentiometer but there is a little bit of difference.
Just remove the potentiometer and connect the VEE pin to pin 13 and the GND.

What is the equipment required for 16×2 LCD interfacing with Arduino?

Equipment requirement for 16×2 LCD interfacing with Arduino:

1- Arduino Uno
2- 16×2 LCD Screen
3- Breadboard
4- Hook-up wires
5- 10k ohm potentiometer
6- 220 ohm resistor

Thank you for being with us until the end of this tutorial, I hope you found what you need about 16×2 LCD Interfacing with Arduino if you are passionate about Arduino and want to learn more.

ROBOSANS is the best place to learn about Arduino with a brief tutorial and to the point.

If you want to learn more, read these articles down below.

Interfacing 7 Segment Display with Arduino 

Interfacing 4×4 Keypad with Arduino 

Interfacing LED with Arduino

Sources:

arduino.cc

wikipedia.org

Shopping Cart
Scroll to Top