Arduino Tutorial: Display Characters on LCD Module

Posted on

Arduino to control LCD display

This tutorial will show you how to use and connect your LCD character module with Arduino Uno , Arduino Mega or any other Arduino board. This is about how to display characters on LCD module from Arduino module.

Hardwares

  • LCD module (16×2 or 20×4) – http://store.fut-electronics.com/Products/PDF/1602A.pdf
  • Arduino uno or arduino Mega

Wire connections:

dule to LCD module wiring connection

* Use a breadboard rail to make multiple connections to the Arduino GND pin
** A current limiting resistor or potentiometer (40 Ohm minimum) should be used to avoid excessive current.

Software
This is the sample of driver code program:

/* ------------------------------------------------------------------------------- */

#include 

// Connections:
// rs (LCD pin 4) to Arduino pin 12
// rw (LCD pin 5) to Arduino pin 11
// enable (LCD pin 6) to Arduino pin 10
// LCD pin 15 to Arduino pin 13
// LCD pins d4, d5, d6, d7 to Arduino pins 5, 4, 3, 2

LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);
int backLight = 13; // pin 13 will control the backlight

void setup() {
   pinMode(backLight, OUTPUT);
   digitalWrite(backLight, HIGH); // turn backlight on. Replace 'HIGH' with 'LOW' to turn it off.
   lcd.begin(16,2); // columns, rows. use 16,2 for a 16x2 LCD, etc.
   lcd.clear(); // start with a blank screen
   lcd.setCursor(0,0); // set cursor to column 0, row 0 (the first row)
   lcd.print(EFGHIGKLMOPQRST); // change this text to whatever you like. keep it clean.
   lcd.setCursor(0,1); // set cursor to column 0, row 1
   lcd.print(efghijklmnopqrst);

// if you have a 4 row LCD, uncomment these lines to write to the bottom rows
// and change the lcd.begin() statement above.
//lcd.setCursor(0,2); // set cursor to column 0, row 2
//lcd.print("Row 3");
//lcd.setCursor(0,3); // set cursor to column 0, row 3
//lcd.print("Row 4");

}

void loop() {
}

/* ------------------------------------------------------------------------------- */

Transfer the program:

  1. Start the Arduino software from your computer and load the sample code program by clicking File -> Sketchbook -> Open
  2. Transfer the program to your Arduino by clicking the “Upload to I/O board” button. After uploading, these characters will be shown on the LCD module:
EFGHIGKLMOPQRST
efghijklmnopqrst

In case you do not see this message, your LCD module may be out of sync with your Arduino. Just press the reset button on your Arduino (it may take a couple of resets), and they should synchronize.

Source: Future Electronics

Gravatar Image
Robotics Technology , Tutorial and News

Leave a Reply

Your email address will not be published. Required fields are marked *