How to use an LCD Display with Arduino

632

In this tutorial, we will learn how to use an LCD 16×2 Display with Arduino. We will use an LCD 16×2 Display.

The full form of LCD Display is Liquid Crystal Display and generally used in many electronics applications.

In Arduino projects to show the sensor readings, status, messages we use LCD Display.

In LCD 16×2 there are 2 lines with 16 characters in each line. Each character is made up of a 5×8 (column x row) pixel matrix.

A potentiometer is also used along with LCD Display for adjusting the brightness of LCD.

lcd display 16x2

Here some more tutorials for you:



Components Needed


LCD Display 16×2 Pin Description Pinout

lcd display pinout

Pin Connections of LCD 16×2 with Arduino

Pin No.LCD PinsArduino Pins
1VSS/GNDGND
2VDD/VCC5v
3V0Potentiometer Vout
4RS12
5RWGND
6E11
7-10D0-D3No connection
11D45
12D54
13D63
14D72
15A/LED+5v
16K/LED-GND

Circuit Diagram For LCD Display with Arduino

Circuit Diagram of LCD Display with Arduino

LCD displays have more wires connecting to Arduino than most other recipes we discuss. Incorrect connections are the major cause of problems with LCDs, so take your time wiring things properly and triple check the connection.

An inexpensive multimeter capable of measuring voltages and resistance is a big help for verifying that your wiring is correct.

To save a lot of time and head-scratching only we need the cheapest multimeter to check connections and voltage.

We will need to connect a 10K potentiometer to provide the contrast voltage to LCD pin 3. Without the correct voltage on this pin, you may not see anything displayed. In the figure, one side of the pot connects to ground, the other side connects to Arduino +5V, and the center of the pot goes to LCD pin 3. The LCD is powered by connecting ground and +5V of Arduino to LCD pins 1 and 2.


Code for LCD Display 16×2 Arduino


Output

Output of LCD with Arduino

Turning the Cursor and Display On or Off

Now we want to blink the cursor and turn the display on or off. We may also draw attention to a specific area of the display.

This sketch shows how you can cause the cursor to blink. It also illustrates how to turn the display on and off; for example, to draw attention by blinking the entire display.

The sketch calls blink and noBlink function to toggle cursor blinking on and off.

To blink the entire display there is a function named displayBlink to flash the display for a specified number of times.

The function uses lcd.display() and lcd.noDisplay() to turn the display text on and off (without clearing it from the screen’s internal memory).


Scrolling Text on LCD 16×2 | Long Text

We want to scroll text, for example: to create a marquee that displays more characters that can fit on one line of the LCD display.

This sketch demonstrates both lcd.ScrollDisplayLeft.

This sketch has a marquee function that will scroll text up to 32 characters in length.

The sketch uses the lcd.scrollDisplayLeft function to scroll the display to left when the text is longer than the width of the screen. If we want to scroll the text in right we can use lcd.scrollDisplayRight.


Uses of LCD Display 16×2

  • To display customs characters and text.
  • To display Status, Messages.
  • For display readings of sensors.

Here some more tutorials for you:

Our Youtube Channel

LEAVE A REPLY

Please enter your comment!
Please enter your name here