Loading...
Pages: [1]   Go Down
Author Topic: HD44780 16x2 LCD not working with Arduino Uno  (Read 1518 times)
0 Members and 1 Guest are viewing this topic.
Phoenix, AZ
Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm trying to connect a character display I just bought from http://www.gadgettown.com/LCD-Module-White-Characters-Blue-Backlight-HD44780.html to an Arduino Uno, using the instructions from my Beginning Arduino book. Unfortunately, the screen's backlight comes on, but the LCD remains blank. Any idea what's wrong?

Code:
Quote
// PROJECT 23
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); // create an lcd object and assign the pins

void setup() {
     lcd.begin(16, 2); // Set the display to 16 columns and 2 rows
}

void loop() {
     // run the 7 demo routines
     basicPrintDemo();
     displayOnOffDemo();
     setCursorDemo();
     scrollLeftDemo();
     scrollRightDemo();
     cursorDemo();
     createGlyphDemo();
}

void basicPrintDemo() {
       lcd.clear(); // Clear the display
       lcd.print("Basic Print"); // print some text
       delay(2000);
}

void displayOnOffDemo() {
     lcd.clear(); // Clear the display 
     lcd.print("Display On/Off"); // print some text
     for(int x=0; x < 3; x++) { // loop 3 times
          lcd.noDisplay(); // turn display off
          delay(1000);
          lcd.display(); // turn it back on again
          delay(1000);
    }
}

void setCursorDemo() {
     lcd.clear(); // Clear the display
     lcd.print("SetCursor Demo"); // print some text
     delay(1000);
     lcd.clear(); // Clear the display
     lcd.setCursor(5,0); // cursor at column 5 row 0
     lcd.print("5,0");
     delay(2000);
     lcd.setCursor(10,1); // cursor at column 10 row 1
     lcd.print("10,1");
     delay(2000);
     lcd.setCursor(3,1); // cursor at column 3 row 1
     lcd.print("3,1");
     delay(2000);
}

void scrollLeftDemo() {
     lcd.clear(); // Clear the display
     lcd.print("Scroll Left Demo");
     delay(1000);
     lcd.clear(); // Clear the display
     lcd.setCursor(7,0);
     lcd.print("Beginning"); 
     lcd.setCursor(9,1);
     lcd.print("Arduino");
     delay(1000);
     for(int x=0; x<16; x++) {
          lcd.scrollDisplayLeft(); // scroll display left 16 times
          delay(250);
     }
}

void scrollRightDemo() {
     lcd.clear(); // Clear the display
     lcd.print("Scroll Right");
     lcd.setCursor(0,1);
     lcd.print("Demo");
     delay(1000);
     lcd.clear(); // Clear the display
     lcd.print("Beginning"); 
     lcd.setCursor(0,1);
     lcd.print("Arduino");
     delay(1000);
     for(int x=0; x<16; x++) {
       lcd.scrollDisplayRight(); // scroll display right 16 times
          delay(250);
     }
}

void cursorDemo() {
     lcd.clear(); // Clear the display
     lcd.cursor(); // Enable cursor visible
     lcd.print("Cursor On");
     delay(3000);
     lcd.clear(); // Clear the display
     lcd.noCursor(); // cursor invisible
     lcd.print("Cursor Off");
     delay(3000);
     lcd.clear(); // Clear the display
   lcd.cursor(); // cursor visible
     lcd.blink(); // cursor blinking
     lcd.print("Cursor Blink On");
   delay(3000);
     lcd.noCursor(); // cursor invisible
     lcd.noBlink(); // blink off
}


void createGlyphDemo() {
     lcd.clear();

     byte happy[8] = { // create byte array with happy face
     B00000,
     B00000,
     B10001,
     B00000,
     B10001,
     B01110,
     B00000,
     B00000};
  
     byte sad[8] = { // create byte array with sad face
     B00000,
     B00000,
     B10001,
     B00000,
     B01110,
     B10001,
     B00000,
     B00000};
     lcd.createChar(0, happy); // create custom character 0
     lcd.createChar(1, sad); // create custom character 1
 
    for(int x=0; x<5; x++) { // loop animation 5 times
         lcd.setCursor(8,0);
          lcd.write(0); // write custom char 0
          delay(1000);
          lcd.setCursor(8,0);
          lcd.write(1); // write custom char 1
          delay(1000);
     }
}


Here's what it should look like when set up:
https://picasaweb.google.com/lh/photo/WzOfEcDjvq2yOXSSItNe9Q?feat=directlink

And this is what I have:
https://picasaweb.google.com/lh/photo/OFMoxPPRcWy1m8TrkahhTQ?feat=directlink

Is the LCD broken or am I doing something wrong?
Logged

0
Offline Offline
God Member
*****
Karma: 0
Posts: 592
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

R/W pin is not grounded, just a wild guess at what's wrong
Logged

I'm an electrical engineering student. I designed the USnooBie (V-USB dev kit) which is sold at Seeed Studio

Lancaster, England
Offline Offline
Jr. Member
**
Karma: 0
Posts: 85
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What's the resistor you're using on pin 3?

I just had a go at setting up an HD44780 4x20 LCD for the first time a couple of days ago and used a 10K pot on pin 3 so I could tweak it to look just right.  If it's too strong or not strong enough, it could explain seeing nothing on the LCD.
Logged

John

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 17
Posts: 3460
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You really should start with something simple.  Try following the tutorial at http://www.ladyada.net/learn/lcd/charlcd.html and pay particular attention to the part about midway through where the contrast is adjusted.  If you can't get that to work then there's no sense going any further.  Make sure pin 5 is grounded (reply #1) and use a potentiometer for the contrast (reply #2).  If you get stumped then post a photo that clearly shows your connections.

Don
Logged

London, England
Offline Offline
Edison Member
*
Karma: 3
Posts: 1026
Go! Go! Arduinoooo !!!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Do you have a potentiometer on the contrast pin?
Logged

Lancaster, England
Offline Offline
Jr. Member
**
Karma: 0
Posts: 85
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That was the one I followed, got up and running with it in no time.

Then once I knew it all worked, I got a little more daring with the second schematic in this one so I could get 3 of those pins back.

http://code.google.com/p/arduinoshiftreglcd/
Logged

John

Central MN, USA
Offline Offline
Faraday Member
**
Karma: 35
Posts: 5915
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

That was the one I followed, got up and running with it in no time.

Then once I knew it all worked, I got a little more daring with the second schematic in this one so I could get 3 of those pins back.

http://code.google.com/p/arduinoshiftreglcd/

You will have to change your program while daring at the shift reg lcd like this:

Code:
#include <ShiftRegLCD.h>

ShiftRegLCD objectName(Datapin, Clockpin, Enablepin or TWO_WIRE [, Lines [, Font]])

    where Lines and Font are optional.

    * Enablepin: can be replaced by constant TWO_WIRE, if using only 2 wires.
    * Lines: 1 or 2 lines (also 4-line LCD's must be set as 2).
    * Font : 0 or 1, small or big font (8 or 10 pixel tall font, if available).


You can't use LiquidCrystal lcd(blah) any more.

Are you really in need of three pins? Have you used the analog pins as digital pins?
Logged


Western New York, USA
Offline Offline
Faraday Member
**
Karma: 17
Posts: 3460
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

We are getting way off topic.  This thread is about getting a standard parallel interface LCD operating with the LiquidCrystal library.

Don
Logged

Phoenix, AZ
Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks so much for the replies. I'll try the suggesstions as soon as I get some free time.
Logged

Lancaster, England
Offline Offline
Jr. Member
**
Karma: 0
Posts: 85
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You will have to change...
Already done smiley

Are you really in need of three pins? Have you used the analog pins as digital pins?
Yup, need the pins, I'm now down from using 11 to using 8, and I still have 2 servo motors and a stepper (and maybe another 4x20 LCD) that I'll need to hook up to this. smiley

But let's not hijack this fella's thread.  I was simply commenting that Ladyada's tutorial helped me, and informed me that the LCD was working before moving on to what I really wanted to do. smiley
« Last Edit: March 28, 2011, 08:46:21 pm by Kaouthia » Logged

John

Central MN, USA
Offline Offline
Faraday Member
**
Karma: 35
Posts: 5915
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You will have to change...
Already done smiley

Are you really in need of three pins? Have you used the analog pins as digital pins?
Yup, need the pins, I'm now down from using 11 to using 8, and I still have 2 servo motors and a stepper (and maybe another 4x20 LCD) that I'll need to hook up to this. smiley

But let's not hijack this fella's thread.  I was simply commenting that Ladyada's tutorial helped me, and informed me that the LCD was working before moving on to what I really wanted to do. smiley

I thought you were the OP. Your IDs both start with ka  smiley-red
Logged


Pages: [1]   Go Up
Print
 
Jump to: