Arduino LCD Display
In this Project, we will learn how to use the 16x2 LCD Display with Arduino. The Liquide Crystal Display (LCD) is the electronic device that is used to displaying characters. This 16x2 LCD Display is the most commonly used module in a wide range of applications. These modules are recommended over the Seven Segment displays because it is easily programmable, and there are no limitations to print symbols or special characters, where seven segment does not do this, Animations are also performed in this LCD.
This LCD displays 16 characters in each line and there are 2 such lines present. That why it is known as the 16x2 LCD Display. And in this display, each character is displayed in a 5x7 pixel matrix.
It has two Resisters Command and Data, Command resister is used to storing the command instructions given to the LCD. Command instruction are perform following commands like clear screen, point the cursor position and so no. And Data resister is used to storing the data that is shown on the display.
Pin Description:-
There are 16 interface pins in the LCD module
VSS or Ground pin to provide ground to the module.
VDD/VCC pin is for positive power supply.
V0 pin is to control display contrast through a Potentiometer.
RS (Resister Select)pin is to select either Command resister or Data resister.
RW(Read/Write)pin is to Read the resister or to Write the resister.
E (Enable)pin is to enabled writing to the resister.
D0-D7 pins are the 8bits digital pins.
Backlight Anode pin (i.e +5V).
Backlight Cathode pin (i.e negative supply).
VDD/VCC pin is for positive power supply.
V0 pin is to control display contrast through a Potentiometer.
RS (Resister Select)pin is to select either Command resister or Data resister.
RW(Read/Write)pin is to Read the resister or to Write the resister.
E (Enable)pin is to enabled writing to the resister.
D0-D7 pins are the 8bits digital pins.
Backlight Anode pin (i.e +5V).
Backlight Cathode pin (i.e negative supply).
Hardware Component Used:-
Software Used:-
Befor doing the connections you should solder the 16 pin header strip to you LCD screen connector for better results.
- Arduino digital pin 12 to LCD pin RS
- Arduino digital pin 11 to LCD pin Enable
- Arduino digital pin 5 to LCD pin D4
- Arduino digital pin 4 to LCD pin D5
- Arduino digital pin 3 to LCD pin D6
- Arduino digital pin 2 to LCD pin D7
- Arduino +5v pin to LCDs Anode pin through 220 ohms resistor
- Arduino GND pin to LCDs Cathode pin.
- Arduino GND pin to 1st pin of 10k Pot
- LCD V0 pin to middle pin of 10k pot
- Last pin of 10k pot to +5v.
Schematics:-
Code:-
Code Description:-
First, we have to define the LCD pins that are connected with the Arduino here we write const int that constant integer.
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
Next is #include <LiquidCrystal.h> this is the library for controlling the LCD you must have to include this in your code. Liquid Crystal Library.
LiquidCrystal lcd(rs, en, d4, d5, d6, d7); to define the LCD pins that are used in the code to print the Text.
In void setup lcd.begin(16, 2); is to setup the numbers of rows and columns of LCD.
lcd.print("YOUR TEXT HERE"); is to print the text on the LCD.
In void loop we write lcd.setCursor(0, 1); to set the cursor in the 2nd line of the LCD here note that line 1 is the 2nd row since counting begins with 0, so write 0. Now we shift into the 2nd line of LCD lcd.print("YOUR TEXT HERE"); is to print the text in the 2nd line.
lcd.print("YOUR TEXT HERE"); is to print the text on the LCD.
In void loop we write lcd.setCursor(0, 1); to set the cursor in the 2nd line of the LCD here note that line 1 is the 2nd row since counting begins with 0, so write 0. Now we shift into the 2nd line of LCD lcd.print("YOUR TEXT HERE"); is to print the text in the 2nd line.
No comments:
Post a Comment