Nothing showing up on I2C LCD

Hi folks, I’m pretty new to Arduino and I’m trying to figure out how to get this display to work. I have the latest LiquidCrystal_I2C library installed and I’m trying to run the included Hello World program, but no characters are showing up on my display (this guy). I’m just getting two rows of white blocks and two blank rows. The backlight is on and I’ve tried adjusting the contrast.

Code is as follows:

#include <Wire.h> 
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x20,16,2);  // set the LCD address to 0x20 for a 16 chars and 2 line display

void setup()
{
  lcd.init();                      // initialize the lcd 
 
  // Print a message to the LCD.
  lcd.backlight();
  lcd.print("Hello, world!");
}

void loop()
{
}

No errors upon compiling or uploading. I’m pretty sure I’ve got the display wired up correctly, with 10k pull up resistors for both SDA and SCL to 5V. SDA is going to Analog 4, SCL is going to Analog 5. This is on an Arduino Uno SMD, OSX 10.6.

Any ideas? Thanks!

Well, the code sample you posted initializes a 16x2 LCD on an address of 0x20. You're trying to initialize a 20x4 LCD on an address of 0x27. This might call for a change to the sketch, wouldn't you think?

It's also possible that you have the wrong LiquidCrystal_I2C library installed--there are at least two different libraries with that name. I have an LCD that uses one, and the library I downloaded here under that name didn't work. Make sure you're using the right one.

I made that change and now the display is just much dimmer, and the backlight has turned off. I can still see though that lines 1 and 3 have all the blocks turned on and lines 2 and 4 are completely off.

I have the library from here: http://hmario.home.xs4all.nl/arduino/LiquidCrystal_I2C/

Perhaps you should try downloading the library provided by the vendor (the link is on the product page you linked to in your first post, marked “Download Link for Code”). I’d suspect that would have a better chance of working.

And no, I’m not just being a PITA with this–I had a very similar response the first time I tried to use my I2C LCD module (though mine is a 16x2, not a 20x4). If the vendor provides a library, why not try that one first?

Finally managed to figure it out, after digging through the examples from the manufacturer’s website (most of their code didn’t work, or was for a different model display):

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

#define I2C_ADDR    0x27  // Define I2C Address where the PCF8574A is
#define BACKLIGHT_PIN     3
#define En_pin  2
#define Rw_pin  1
#define Rs_pin  0
#define D4_pin  4
#define D5_pin  5
#define D6_pin  6
#define D7_pin  7


LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);

void setup()
{
  lcd.begin(20,4);
  lcd.setBacklightPin(BACKLIGHT_PIN, POSITIVE);
  lcd.setBacklight(HIGH);
  lcd.home();
  
  lcd.print("Hello, world!");
  lcd.setCursor(0,1);
  lcd.print("This is a test");
  lcd.setCursor(0,2);  
  lcd.print("Of this PITA");
  lcd.setCursor(0,3);
  lcd.print("Sainsmarrt LCD");
}

void loop()
{
 lcd.setBacklight(HIGH);  
 delay(4000);
 lcd.setBacklight(LOW);
 delay(4000) ;
}

I don’t get that initialization though, the first line after all the #'s and before the setup function. What’s going on there? That looks like a parallel LCD, not serial. Every other I2C LCD example I’ve seen only put the LCD’s address as the argument of that function.