We are all already use the most common 16x2 LCD Display(16x2 Liquid Crystal) which is very easy to use for AVR microcontroller and you can find this display in every electronic gadgets but in this post We will working on 20x4 LCD Display which is bigger than the old 16x2 Liquid Crystal and can print more letter, number, character. 16x2 and 20x4 almost same but the size is different and both are use same HD44780 Hitachi LCD controller.
In this post we will take a look on this steps which as:
>>Know more about 20x4
LCD Display
>>Parts Needed
>>Using with SPI method
>>Using with I2C method
>>Create Custom
Character on LCD
Know More About 20x4 LCD Display
Parts Needed
20x4 LCD Display
I2C Modules
Arduino Board
10K Ohms Preset
Breadboard
Jumper Wires
Using SPI Method
In this method we connect all
the wire from Arduino to LCD Module without any other board or interface but
with few simple Circuit and Programming.
Here is the Circuit Diagram
for this display to connect to 20x4 LCD Display to Arduino.
First of the step is to connect
LCD VSS pin to Arduino GND Pin.
LCD’s Second of the pin 5V is
connect to Arduino 5V Pin.
The Third pin of LCD is VO
(Variable) connect to 10K Variable Preset 2nd pin that already
connect to 5V and GND. This is Important because you can adjust the Contrast
and you can also connect 1K resistor between 5V to VO pin.
Now the Forth wire of LCD is
connect to Arduino D12 Pin.
Fifth wire is normally connect
to GND pin and the Sixth pin connect to D11 Pin.
Here LCD’s 7, 8, 9, 10 (4
pins) are not used in this schematic leave it blank no need to connect any
wire.
Now The LCD Eleventh pin
connect to Arduino D5 Pin.
LCD Twelve pin connect to
Arduino D4 Pin.
LCD Thirteenth pin connect to
Arduino D3 Pin.
LCD Fourteenth pin connect to
Arduino D2 Pin.
Now all connection done this
is very simple because if you are already use 16x2 LCD Display or work with it
then you know this diagram or schematic properly. So let’s move on the
programming section.
The Programming of this
display is very easy because it use the same liquidCrystal.h library which is
already built in Arduino IDE and also use in 16x2 lcd display. So now open the Arduino IDE Software here go to the File Menu then Example section, here is LiquidCrystal
and then click on the “Hello World”
Program and Upload it to your
Arduino Boards (Check the Board and Port before uploading the code).
Using I2C Method
In this method we need an I2C
Module because I2C Feature not available in this display. Here I am using a
PCF8574T I2C Module which is easily available on any hobby store and you can
buy from online store. Here is the Schematic for connection between Arduino to
I2C LCD.
The First wire of I2C Module
is GND which is connect to Arduino GND Pin.
Second wire of I2C Module is VCC
which is connect to Arduino VCC Pin.
Third wire of I2C Module is
SDA which is connect to Arduino A4 Pin.
And the last wire of I2C
Module is SCL which is connect to Arduino A5 Pin.
Now the all wiring complete.
The I2C connection is very simple because its use only four wire two for power
and two for communication. After all the connection is complete now move it to
programming.
First you need to download two
libraries first one is liquidCrystal_I2C.h
from here LC_I2C Github and second is Wire.h
(which is optional because it’s already comes into Arduino IDE) import the
.zip file to Arduino Library section.
Now Open the Arduino IDE again
copy the code and paste into your software and check the Board and Port then Upload it to your Arduino.
Here is a sample code for testing just copy and paste into your Arduino IDE then upload it.
//Libraries #include <Wire.h> #include <LiquidCrystal_I2C.h> LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7); // 0x27 is the default I2C bus address byte Heart[] = { B00000, B01010, B11111, B11111, B01110, B00100, B00000, B00000 }; byte Speaker[] = { B00001, B00011, B01111, B01111, B01111, B00011, B00001, B00000 }; int i, j; void setup() { // put your setup code here, to run once: lcd.begin (20, 4); lcd.setBacklightPin(3, POSITIVE); // BL, BL_POL lcd.setBacklight(HIGH); lcd.createChar(1, Heart); lcd.createChar(2, Speaker); } void loop() { lcd.clear(); lcd.setCursor(0, 0); lcd.print("Working on 20x4 LCD"); lcd.setCursor(0, 1); lcd.print("Using Arduino Boards"); lcd.setCursor(0, 2); String Electechoz = "By Electechoz"; for (int i = 0; i <= 18; i++) { lcd.setCursor(0, 2); lcd.print(Electechoz.substring(0, i)); delay(100); } lcd.setCursor(15, 2); lcd.write(1); lcd.setCursor(0, 3); lcd.write(2); for (int i = 1; i <= 18; i++) { lcd.setCursor(i, 3); lcd.print(">"); delay(50); } delay(1000); }
Comments
Post a Comment