How to use LCD with Arduino Uno Skip to main content

How to control RGB LED using Arduino Uno

RGB LED is the abbreviation of ‘’Red Green Blue Light Emitting Diode’’. RGB LED is the most amazing type of The LED which has the ability to create millions of different shades of light-colors using red, green and blue colors.

How to use LCD with Arduino Uno



Liquid crystal Display 16x2 (LCD) is the widely used electronic device to establish communication between the real world and electronics based machine world.
There are multiple devices available in the market such as seven segment display, graphics display, multi-segment LEDs and so on but LCD is the most preferred display device because of its amazing features. Liquid crystal display’s unique features are as follows:
  • Consists of two rows, with the capability to display 16 characters in each row.
  • Cable to display alphanumeric characters (means it can display number and alphabets).
  •  Low power consumption.
  • Works on the principle of blocking light instead of emitting light.
  • Require less operating voltage.
  •  Each character is built by a 5x8 pixel matrix.
In this tutorial, we will deal with 16x2 Liquid crystal display which is compatible with Hitachi Hd44780 driver. Liquid crystal Display 16x2 means, LCD can display total 32 characters through both rows and in other words 16 characters in the first row along with other 16 characters in the second row. Liquid crystal display has a parallel interface which allows the microcontroller to handle multiple interface pins to control the display at a time. There are 16 pins available on LCD each pin’s working is described as follows:


Pin number

Pin Name
Description
Pin 1
GND or VSS
Ground pin (0 volt).
Pin 2
VDD or VCC
Power supply (4.7 volt to 5.3 volt).
Pin 3
VEE
VEE is used to adjust the brightness of the display with the help of potentiometer (preset).
Pin 4
RS
RS means register select which is used to select either data or instruction.
Pin 5
R/W
R/W means read/write that is preferred to select the reading or writing mode.
Pin 6
E
E means enable used to indicate that data is ready to write.
Pin 7  to pin 14
D0  to D7
Data pins.
Pin 15
LED+
Backlight pin is connected to +5 volt (VCC) to control the backlight
Pin 16
LED-
Backlight pin is connected to 0 volt (GND) to control the backlight



Hitachi driver allows LCD to operate in 4-bit mode and 8-bit mode. The 4-bit mode (requires only 4 data lines) needs seven I/O pins and 8-bit mode (requires all 8 data lines) needs eleven I/O pins from Arduino Uno. The 4-bit mode has all the capabilities to display text on the LCD screen with the help of Arduino Uno. 

This was all about the LCD and its configuration now I will explain to you two simple projects to understand all the basics about it. The first project will help you to understand how different commands used in Arduino and how their result shows on the LCD screen. In the second project, I will try to guide you about how rows and columns combination work to display anything on LCD with the help of Arduino.

Required component :

1. 1 x Arduino Uno board..............................BUY
2. 1 x 10 k preset............................................BUY
3. LCD screen................................................BUY
4. 1 x breadboard...........................................BUY
5. Few jumper wires......................................BUY

Circuit description:


For both examples, I used the same circuit configuration to make things easier for you to understand. RS pin of the LCD module is connected with pin 8 of the Arduino Uno board. RW, GND and LED- (backlight pin) pins of the LCD module is connected with ground pin of the Arduino Uno board. 

VEE pin of the LCD module is connected with 10 k preset which help to adjust the brightness of the LCD screen. VDD, LED+ (backlight pin) pins connected with +5 volt pin of the Arduino Uno board.  E pin is connected with pin 2. Preset is a three-terminal 10k register whose one terminal is connected with the 5-volt pin of the Arduino, second terminal is connected to the ground of Arduino Uno board and the middle terminal is connected with VEE of the LCD module. 


For both the projects, I will use 4-bit mode which is sufficient to perform all the LCD functionality with very fewer connection requirements. 4-bit mode requires only 4 data pins to operate LCD. I have chosen D4, D5, D6 and D7 pins of the LCD module and connected them with pin number 7, 6, 5 and 4 of the Arduino Uno board respectively. You can understand the entire connection configuration with the help of the fritzing diagram mentioned below.

Circuit diagram:






Important points about Arduino Uno:

Arduino IDE has multiple sets of standard libraries for frequently used functions such as communication operations and support for some of the most common types of hardware like LCD displays, servo motor, stepper motors and so on. In both the projects, we will use a built-in LiquidCrystal library that is specially designed for Hitachi Hd44780 driver to perform the interfacing between Arduino Uno and LCD.

In the first example, you will understand how different commands used to display text on LCD. Here I am providing a short description for each command which will help you to understand the code.


Begin ():

It is used to specify the dimension of the LCD screen. This command is always preferred to be called in very beginning [in void setup( )] to initialize the interface of the LCD.

Syntax:

ARDUINO_LCD.begin(col, row)


Parameter:

ARDUINO_LCD: a variable of type Liquidcrystal.

col: number of columns.

row: number of rows.



home():

This command is used to point the position of the cursor in the upper left corner of the LCD screen.


Syntax:
ARDUINO_LCD.home()

Parameter:
ARDUINO_LCD: a variable of type Liquidcrystal.

Print():
This command is used to print the text on the LCD screen.

Syntax:
ARDUINO_LCD. Print(data)
ARDUINO_LCD. Print(data, BASE)

Parameter:
ARDUINO_LCD: a variable of type Liquidcrystal.
Data: data to be print(it can be char, byte, int etc.)
BASE: it is optional and used to print the base of the numbers.

setCursor():
This command is used to set the position of the cursor to display the text.

Syntax:
ARDUINO_LCD.setCursor (col, row)

Parameter:
ARDUINO_LCD: a variable of type Liquidcrystal.
col: column number at which the cursor will display text.
row: row number at which the cursor will display text.

display():
This command used to turn on the display.

Syntax:
ARDUINO_LCD.display()

Parameter:
ARDUINO_LCD: a variable of type Liquidcrystal.

noDisplay():
This command is used to turn off the display. This is used to blank the screen without losing the text. It means when we use this command than previously displayed text is not cleared but it still preserved.

Syntax:
ARDUINO_LCD.noDisplay()

Parameter:
ARDUINO_LCD: a variable of type Liquidcrystal.

clear():
This command is used to clear the LCD screen and set the cursor to the upper left corner of the screen.

Syntax:
ARDUINO_LCD.clear()

Parameter:
ARDUINO_LCD: a variable of type Liquidcrystal.

blink():
This command is used to turn on the blink block style cursor.

Syntax:
ARDUINO_LCD. blink()

Parameter:
ARDUINO_LCD: a variable of type Liquidcrystal.

noBlink():
This command is used to turn off the blink block style cursor.

Syntax:
ARDUINO_LCD. noBlink()

Parameter:
ARDUINO_LCD: a variable of type Liquidcrystal.

cursor():
This command is used to display the underscore-style cursor at the position at which next text will be displayed.

Syntax:
ARDUINO_LCD.cursor()

Parameter:
ARDUINO_LCD: a variable of type Liquidcrystal.

noCursor():
This command is used to hide the underscore-style cursor.

Syntax:
ARDUINO_LCD.noCursor()

Parameter:
ARDUINO_LCD: a variable of type Liquidcrystal.

Code: Click here

Output:



In the second example, I have tried to explain to you how to set the cursor to a different location by arranging the perfect row and column combination. This is a very basic example which will help you a lot to understand how an LCD screen location arrangement can be done. In this example, I had tried to display 1 to 9 numbers one by one in two different manner starting from the upper left corner along with the lower right corner. You will understand the output by watching the video.

Code: Click here

Output:











Comments

  1. Your article contains lots of wonderful information about LCD screen. Thank you for sharing such a good article About LCD screen. This is really very good information.
    lcd screen repair

    ReplyDelete
  2. Thanks for sharing such an amazing article, really informative

    Visit here : LCD Display Screen

    ReplyDelete
  3. You have Shared great content here about phone repair. I am glad to discover this post as I found lots of valuable data in your article. Thanks for sharing an article like this.phone screen repair

    ReplyDelete
  4. Usually, I never comment on blogs but your article is so convincing that I never stop myself to say something about it. You’re doing a great job. Please Keep it up. Iphone Screen Repair Wichita

    ReplyDelete
  5. This comment has been removed by a blog administrator.

    ReplyDelete
  6. Zoom Visual is Singapore & premier LED display advertising company providing Flexible display screen, LED Video wall, programmable led display board and digital directory display.LCD Display Screen

    ReplyDelete
  7. Thanks for sharing such an amazing article, really informative

    Visit here : Digital signage Singapore

    ReplyDelete
  8. This comment has been removed by a blog administrator.

    ReplyDelete
  9. You've posted a fantastic and useful piece of information here Samsung phone repair Service in USA. I am grateful that you simply shared this helpful information with us. Please continue to be informed in this manner. Thank you so much for sharing it.

    ReplyDelete

Post a Comment

Popular posts from this blog

Smart Plant Watering System Using ARDUINO UNO

As we all know, plants play an important role in our life, there are countless benefits we get from plants but the most important is fresh air and the pleasant atmosphere on the earth. Hence,   It is not only our social duty as well as the responsibility that we should plant trees as much as we can and also take care of them. But  the biggest challenge we face, is, taking care of them,

How to operate soil moisture sensor with Arduino

The soil moisture sensor is the most amazing sensor used to measure the quantity of water present in the soil and defines the moisture level of the soil as the output. Because of its amazing operating principle this sensor used in application such as automatic irrigation system, agriculture research applications, landscape irrigation, indoor planting system, and lawns. I have also made an advance level project  "Smart Plant Watering System" using a soil moisture sensor.

ad

ad