Home » Arduino

Arduino, LCD displays and animated text

22 November 2009 No Comment

A lot of low-price LCD displays available on the market are compatible with the Hitachi HD44780 driver and you can easly display and control their text using the LiquidCrystal library.

imagethumb

In this article i have used a blue 16×4 LCD display but the connections and the script are valid for each kind of HD44780 compatible displays.

WIRES:

Following you will find some useful (I hope) images about the wire connections and a little schema to better understand them.
These LCD usually have 16 pins but you really need to connect only 10 of them (or 12 because the last two pins - 15 and 16 - are optionals and depend if you want turn on the led backlight)

lcd_44780_schema
Click to zoom the image!

One potentiometers is only used to set the right lcd contrast.

lcd-arduino_wires_001

lcd-arduino_wires_001

lcd-arduino_wires_001

lcd-arduino_wires_001

lcd-arduino_wires_001

CODE

#include <LiquidCrystal.h>
 
// Set LCD pins in according with your connections
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
 
void setup()
{
  lcd.begin(16, 4);
  lcd.clear();                     // Clear screen
  lcd.setCursor(0,0);           // Row1: set cursor to column 0, row 0 (the first row)
  lcd.print("ActionScript.it");    
 
  lcd.setCursor(0,1);           // Row2: set cursor to column 0, row 1
  lcd.print("Adobe UserGroup");
 
  lcd.setCursor(-4,2);	      // Row 3
  lcd.print("---------------");
 
}
 
void loop()
{
  // Update row 4 every second
 
  lcd.setCursor(-4,3);
  lcd.print("Tutorials,Books,");
  delay(1000);
 
  lcd.setCursor(-4,3);
  lcd.print("News, Support,  ");
  delay(1000);
 
  lcd.setCursor(-4,3);
  lcd.print("Reviews ....    ");
  delay(1000);
 
}

NOTE: there is a little bug in the LiquidLibrary to manage 16×4 displays. If you try to set the third and fourth row to start from column 0, the text will start from position 5.
The reason is that this library is written to work with 20×4 displays and you should modify the core class to fix it. So, to avoid it, my little trick was just start the third and fourth line from position -4.
If you have other displays (16×1, 16×2, 20×4 and so on you shouldn’t have this issue.

As i sayd you can use this way to manage every kind of LCD Display Hitachi HD44780 compatible.
finalsample1

finalsample

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.