There are several different libraries called "LiquidCrystal_I2C" which one are you using
and where did you get it?
I recommend fm's LiquidCrystal library replacement as it has a few fixes
that most of the other i2c to hd44780 libraries don't have and it is also much faster.
The first question I have is i2c address.
Are you sure you have the correct address?
I don't see a schematic. I do see a fritzing type picture
however, it doesn't match your wiring. In your wiring I also see what looks like a transistor
which I assume is for the backlight - but it's definitely not hooked up correctly.
The sketch looks like one of fm's example sketches and you are using all the defaults
for the constructor. (I don't recommend this)
Also, if using fm's library, then that commented out constructor that is using pin 13 is wrong.
The parameters in the constructor are not arduino pin numbers but bit position on the pcf8574 output latch.
To get it to work with fms' library is not difficult.
You will need to either wire it up like his LCD i2c i/o expander or
fill in the proper constructor for your wiring.
fm's LCD i/o expander uses this pin mapping from pcf8574 output pins to LCD pins.
p7 (optional backlight)
It is hard to tell the exact wiring in your photo
for the wires going to the lower pins on the lcd
(it almost looks like the red wire is going to lcd pin 5 rather than pin 4
as the fritzing picture shows.)
For now, I'll assuming the fritzing diagram is correct as I can't tell your wiring from the
From the fritzing diagram your wiring appears to be:
If you are using fm's library, then I recommend using the full constructor as it defines
all pin mappings as well as backlight control.
(I'm assuming that you eventually want backlight control)
For your wiring it would be
LiquidCrystal_I2C lcd(4, 5, 6, 0, 1, 2, 3, 7, polarity);
(where 'polarity' is either POSITIVE or NEGATIVE depending on your backlight circuit)
This matches the constructor for the mjkdz i2c backpack which you see all over
ebay for about $2-$3 USD but notice that the control lines are different
than the default wiring.
There is a connection from P7 over to what looks like a transistor.
What is that? If it is transistor for backlight control it is not hooked up
to either A or K on the LCD. And the wiring looks pretty funky. (bad)
You have the LCD backlight A and K directly wired to power and ground
(with no current limiting resistor).
Here is my suggestion:
Use fm's library if you are not using that one.
For the time being remove the wire going to pcf8574 p7.
Use this constructor:
LiquidCrystal_I2C lcd(4, 5, 6, 0, 1, 2, 3, 7, POSITIVE);
Get rid of any use the stuff that messes with BACKLIGHT _PIN in the sketch.
That stuff is just plain wrong anyway. This includes any pinMode() and digitalWrite() stuff.
And there is no need for to use the obsolete lcd.setBacklightPin() call as well when you are ready
to use backlight control since you will be using the newer full constructor that also defines backlight control.
For backlight control use lcd.backlight() and lcd.noBacklight()
If you need help with a backlight control circuit either post your schematic or
just ask and I can recommend one if you say which transistor you have.
You will also need to know if you backlight needs any current limiting.
The polarity in the constructor for backlight control will vary depending on your backlight circuit.
The POSITIVE in the one I recommend above is simply a place holder until you finalize your backlight