top of page

Displaying a text message on LCD Display using 16X2 Segment Display with Arduino.



What is a LCD Display ?


A liquid-crystal display (LCD) is a flat-panel display or other electronically modulated optical device that uses the light-modulating properties of liquid crystals. LCDs are available to display arbitrary images or fixed images with low information content, which can be displayed or hidden, such as preset words, digits.


Material Required:


Material Quantity

Arduino Uno 1

16X2 Segment Display 1

Jumper cables 20

10 k Potentiometer 1


Pinout Diagram:


It has 16 pins and the first one from left to right is the Ground pin. The second pin is the VCC which we connect the 5 volts pin on the Arduino Board. Next is the Vo pin on which we can attach a potentiometer for controlling the contrastof the display.


Next, The RS pin or register select pin is used for selecting whether we will send commands or data to the LCD. For example if the RS pin is set on low state or zero volts, then we are sending commands to the LCD like: set the cursor to a specific location, clear the display, turn off the display and so on. And when RS pin is set on High state or 5 volts we are sendingdata or characters to the LCD.






After all we don’t have to worry much about how the LCD works, as the Liquid Crystal Library takes care for almost everything. From the Arduino’s official website you can find and see the functions of the library which enable easy use of the LCD. We can use the Library in 4 or 8 bit mode. In this tutorial we will use it in 4 bit mode, or we will just use 4 of the 8 data pins.


Circuit Diagram:


We will use just 6 digital input pins from the Arduino Board. The LCD’s registers from D4 to D7 will be connected to Arduino’s digital pins from 4 to 7. The Enable pin will be connected to pin number 2 and the RS pin will be connected to pin number 1. The R/W pin will be connected to Ground and the Vo pin will be connected to the potentiometer.




Tested Programming Code:

First thing we need to do is it insert the Liquid Crystal Library. We can do that like this: Sketch > Include Library

> Liquid Crystal. Then we have to create an LC object. The parameters of this object should be the numbers of the Digital Input pins of the Arduino Board respectively to the LCD’s pins as follow: (RS, Enable, D4, D5, D6, D7). In the setup we have to initialize the interface to the LCD and specify the dimensions of the display using thebegin() function.


In the loop we write our main program. Using the print() function we print on the LCD. The setCursor()function is used for setting the location at which subsequent text written to the LCD will be displayed. The blink() function is used for displaying a blinking cursor and the noBlink() function for turning off. The cursor() function is used for displaying underscore cursor and the noCursor() function for turning off. Using the clear() function we can clear the LCD screen.


// include the library code:

#include <LiquidCrystal.h>


// initialize the library by associating any needed LCD interface pin

// with the arduino pin number it is connected to const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2; LiquidCrystal lcd(rs, en, d4, d5, d6, d7);


void setup() {

// set up the LCD's number of columns and rows: lcd.begin(16, 2);

// Print a message to the LCD. lcd.print("hello, world!");

}


void loop() {

// 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 the number of seconds since reset:

lcd.print(millis() / 1000);


Precautions:


1. Double check the connections before powering on the circuit.

2. Don’t use loose jumper cables.

3. Check whether proper board is selected from Arduino IDE.

4. Ensure proper placement of sensor for correct working.

5. Connect the Wiper pin of potentiometer correctly.

6. Don’t lose hope if LCD does not runs properly for the first time, try again.


Conclusion:


You can successfully measure display data on a LCD in simplest way using Arduino. Many forms of data can be displayed on this display, whether it can be a data from sensor or a anything else .

GET IN TOUCH

We'd love to hear from you

bottom of page