Arduino LCD display

Arduino

 
The Arduino is an open-source electronic prototyping platform. It is easy to understand. Using this Arduino board here we can see how to connect the LCD to the Arduino and how we can program it.
 
 
Figure 1: Arduino Board
 
Required Materials
  • Arduino UNO board
  • Breadboard
  • LCD display
  • Potentiometer
  • Hook up wires
  • USB cable.
STEP 1: LCD DISPLAY CONNECTION
 
The LCD display should be fixed or set as (16,2) i.e. the LCD consists of 16 rows and 2 columns
  1. VSS pin to the gnd
  2. VDD pin to the 5v
  3. LCD RS pin to digital pin 12
  4. LCD Enable pin to digital pin 11
  5. LCD D4 pin to digital pin 05
  6. LCD D5 pin to digital pin 04
  7. LCD D6 pin to digital pin 03
  8. LCD D4 pin to digital pin 02
  9. A pin to the 5v
  10. K pin to the gnd
  11. Then the potentiometer can be connected to the digital pin 3 and the gnd and vcc +5V are connected.
STEP 2:
 
Connect the Arduino board to your computer with the USB cable and start with the following program,
 
STEP 3: PROGRAMMING
  1. #include <LiquidCrystal.h>               // Includes the library code  
  2. LiquidCrystal lcd(12, 11, 5, 4, 3, 2);   
  3. void setup()  
  4. {  
  5.       lcd.begin(16, 2);   
  6.       lcd.print("C# Corner");  
  7. }  
  8.    
  9. void loop()  
  10. {  
  11.       lcd.print(millis() / 1000);  
  12. }  
STEP 4: Attach the following code in the Arduino
 
After completion of the program, we want to upload our program in the Arduino to get the output.
 
1) Compile it
2) Upload it
3) Output in the LCD
 
Explanation 
 
 <LiquidCrystal.h>
 
It is the library code before sketch we want to include this,
 
<12, 11, 5, 4, 3, 2> are input pin to the Arduino. Initialize the library with the number of interface pins.
 
Here we are using the two functions void setup() and void loop().
  • setup()
    In the setup() function we have a code called lcd.begin(16, 2). It set the LCD number of columns and the rows.
  • loop()
    lcd.print("C# Corner") - It prints the message to the LCD. In the void loop( ) function, we have a code called lcd.print (millis() / 1000) that prints the number of seconds since we want to reset the LCD.