I've recently acquired an I2C LCD module (16x2) from DFRobot via ebay. After installing the DFRobot endorsed LiquidCrystal_I2C library and running the example sketches I get nothing on the display.
Pin Config
LCD:
VCC - To arduino 5V pin
GND - To arduino GND pin
SDA - To analog pin 4
SCL - To analog pin 5
And the following hello world program was run to no avail.
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x27 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()
{
}
Are you sure the address (0x27) is correct? I built my own I2C LCD backpack using a PCF8574 port expander. You can address it based on how you ground the address pins. Yours may have jumpers or something that sets the address.
Also, check your contrast setting. If it is set too light, you won't see anything. I've made this mistake several times myself.
One more thing. Make sure your wires aren't too long <4 inches. This can cause problems as well. I don't know what the length limit is. Maybe someone else will show up with that answer.
yes the address (0x27) was correct. Turns out that the problem all along was a faulty resistor, where the resistance was so low that it effectivley pulled the line to ground. This is the first time a resistor has ever failed! (to me)
it was simply the resistor required on the i2c line, the one that pulls the data line high, not low. that was a typo in my previous post.
i have found, however, that this module prefers 10k pullup resistors on the clock and data lines. differing values may still work with other i2c devices, but apparently not this one.
Don't worry though, other i2c devices tolerate the 10k pullup resistors fine. So if you're using a different value for your pullup resistors, try changing them to 10k
also, it is common for a whole row to be black squares when i start a script, but they are soon changed to real text once a sketch starts.
You should also try resetting the arduino a few times when you run a sketch. I have a recurring problem where a reset is required every time i power the arduino, otherwise i only get garbled text displayed on the screen. i suspect this is down to data and clock timing but the problem is sorted after a reset.