Wednesday, May 16, 2012

Simple Labs' Quick Start Kit for Arduino - LCD Interfacing - How To?

LCD - Liquid Crystal Display
LCDs are commonly used display devices that you would find in most appliances / electronic devices. Your music players, Pay phones, Etc.

Here's an interesting Write up to get you understanding the working of the LCD
http://joshuagalloway.com/lcd.html



Wiring up the LCD

The 16x2 LCD Display

LCD Pin Mappings
First Connect A Wire between the GND pin of the Arduino and the '-'ve terminal. Then Connect Another Wire from the 5V pin of the Arduino to the '+'ve terminal.

Place the LCD on the Breadboard as Shown (the 16th pin of the LCD is in the LEFT Corner of the Image)
This is what you should have now
Place the Trimpot Next to the LCD as shown (a bit away from the LCD pins)
Connect the Supply & Ground Lines for the Trimpot
The First and Last pins of the LCD are GND pins. First Connect a Wire from the 1st pin of the LCD to the '-'ve terminal
Connect a wire from the 16th pin of the LCD to the '-'ve terminal

The 2nd & 15th Pins of the LCD are Supply Pins, Connect Wires from these to the '+'ve Terminal as shown
The 5th of the LCD is the RW pin. This pin is used to toggle between Read / Write Mode of the LCD. Writing a HIGH signal to this pin corresponds to Read Mode and Writing a  LOW signal corresponds to Write Mode. Since we will be using only the Write mode, we can wire this pin to GND / '-'ve terminal [This is equivalent of writing a LOW signal to the pin]
Connect a Wire from the middle pin of the trimpot to the 3rd pin of the LCD. The 3rd pin of the LCD is the contrast pin and the contrast of the display can be varied by varying the trimpot
Connect a Wire between the RS pin of the LCD (4th pin) and digital pin 2 of the Arudino. The RS pin helps select between the 2 registers of an LCD - Data & Command  - for communication
Connect a wire between the Enable pin (the 6th pin) of the LCD and digital pin 4 of the Arduino
Connect a Wire between D4 of the LCD (11th pin) and digital pin 8 of the Arduino
Connect a Wire between D5 of the LCD (12th pin) and digital pin 9 of the Arduino
Connect a Wire between D6 of the LCD (13th pin) and digital pin 10 of the Arduino
Connect a Wire between D7of the LCD (14th pin) and digital pin 11 of the Arduino
The Finished Setup
Sample Hello World Program
So Lets program the LCD. We can take the sample hello world program found under File -> Examples -> LiquidCrystal  menu of Arduino IDE and change the pin numbers in the following statement
From
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
To
LiquidCrystal lcd(2,4,8,9,10,11);

####IMPORTANT - IN CASE NOTHING IS DISPLAYED ON THE LCD KEEP VARYING THE TRIMPOT TILL YOU CAN SEE THE CHARACTERS###

Try the following Simple LCD program [Simple_LCD.ino]
/*
  LiquidCrystal Library - Hello World
 
 Demonstrates the use a 16x2 LCD display.  The LiquidCrystal
 library works with all LCD displays that are compatible with the 
 Hitachi HD44780 driver. There are many of them out there, and you
 can usually tell them by the 16-pin interface.
 
*/

// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(2,4,8,9,10,11);

void setup() {
  // set up the LCD's number of columns and rows: 
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("hello, world!");
}

void loop() {
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  // print the number of seconds since reset:
  lcd.print(millis()/1000);
}


7 comments:

  1. Hi!,
    i got this kit and its awesome,
    i have wired up everything as instructed above
    and im still not able to see any text
    i have tried varying the trimpot too
    help!
    thanks in advance

    ReplyDelete
  2. Hi Rahul,
    I also faced the same issue. But just have patience and keep on rotating the trimpot, you will see the text on the LCD.

    Have fun,
    Ashish Mishra

    ReplyDelete
  3. Is it possible to constantly update the display on LCD from the computer.

    ReplyDelete
    Replies
    1. yes...you got to figure it out... ;) but its easy...

      Delete
    2. This comment has been removed by the author.

      Delete
    3. // include the library code:
      #include

      // initialize the library with the numbers of the interface pins
      LiquidCrystal lcd(2,4,8,9,10,11);

      void setup(){
      // set up the LCD's number of columns and rows:
      lcd.begin(16, 2);
      // initialize the serial communications:
      Serial.begin(9600);
      }

      void loop()
      {
      // when characters arrive over the serial port...
      if (Serial.available()) {
      // wait a bit for the entire message to arrive
      delay(100);
      // clear the screen
      lcd.clear();
      // read all the available characters
      while (Serial.available() > 0) {
      // display each character to the LCD
      lcd.write(Serial.read());

      }
      }
      }


      this above code will help you

      if any queries you are free to ask or email me

      April 21, 2013 at 9:50 AM

      Delete
  4. I am interested to join in your company

    ReplyDelete