I2C LCD

I bought 20x4 LCD
http://www.ebay.com/itm/360730910251?_trksid=p2057872.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT
and a I2C Interface
http://www.ebay.com/itm/310708921284?_trksid=p2057872.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT

I tried using it today but all it does now is flicker on and off the backlight and display nothing.

I was watching a video and he said something about the I2C, and I looked on the eBay where I bought the interface and realized that it said it works for 1602, but nothing about 2004... something I never noticed before. Is this gonna cause issues? Could that be what's causing my issue?

I've tried three different sketches and they all flicker. They flicker on and off at the rate at which the loop repeats... one of them has a total of 9000ms delays and it flickers every... you guessed it... 9 seconds.

Any ideas? :confused:

The text on that ebay ad is pretty clear that this is for a 1602.

I've used shift registers to put LCDs on the SPI bus instead of I2C. If you have one of those around I'll gladly share the library with you.

Make sure the pin mapping of the I2C adapter matches the pins on the LCD

Would it even light up the backlight if it didnt?

Delta_G:
The text on that ebay ad is pretty clear that this is for a 1602.

I've used shift registers to put LCDs on the SPI bus instead of I2C. If you have one of those around I'll gladly share the library with you.

Are the shift registers as easy to use/program as the I2C interface?

Who knows?

That looks like the usual I2C module, I think the same module should work for both 1602 and 2004 - the pinouts are the same, and all that's on that board is just an I2C port expander and a trimpot to adjust contrast.

Have you double-checked your wiring? Try using an external pullup, too...

External pullups are not needed as you can clearly see them in the photo.

Typically it comes down to just a few things. Here are the most common:
A) poor soldering
B) incorrectly soldering the adapter to the LCD module
some people have soldered the module such that it sticks up above the lcd vs down next to it.
Others have soldered it up side down when the headers is not presoldered to the adapter

C) Using an incorrectly configured library.

C being the most common error.
i2c to hd44780 adapters like that are great but they are not "plug and play" and it is impossible to write a library that "just works" for all of them since there is no single way to wire the PCF8574 output pins to the hd44780 pins and different manufacturers wire them up differently.
Because of this the library must know or be told how the pins are wired up.
If it is incorrect, it won't work because the software is using the incorrect PCF8574 output pins when trying to control things and often all you will see is some random flickering.

It is no different than when using a LCD hooked directly to Arduino pins. In that case you must tell the LiquidCrytsal library which Arduino pins are hooked up to which hd44780 pins.
i.e. if you tell it that arduino pin 4 is hooked up to E and pin 5 is hooked up to DI but those pins are actually reversed, it wouldn't work.

Some of the i2c to lcd libraries allow the PCF8574 pin mappings to be configured and some don't.
Some expect the adapter to wired a specific way.
If the library either expects it to be wired a certain way or was incorrectly told how it was wired, that is when it doesn't work and you often see just some random flickering on the display.

The key is you must make sure that the library and its configuration match with the pin mapping/wiring on your specific adapter.
You must either use a library that is hard coded to work with your specific adapter or use a library that allows the mappings to be configured and then set up pin mappings in your sketch to tell the library how it is wired up.

--- bill

KpilotRCHelis:
Would it even light up the backlight if it didnt?Are the shift registers as easy to use/program as the I2C interface?

I have a library that makes it work just like the regular LiquidCrystal library. The only difference is the arguments to the begin method. Hooking it up is pretty easy. The 8 data lines on the LCD go to the 8 output pins on the shifter and there is a pin that needs to go to the enable pin on the LCD and the latch pin on the shifter and one pin goes to the RS pin on the LCD. Here is a schematic:

It has 3 backlight pins since the LCD in this picture has an RGB backlight. If you only need one (16 pin connector) then only use 1.

And here is a copy of the library:

KpilotRCHelis:
Would it even light up the backlight if it didnt?

Yes the backlight would come on as it isn’t being controlled by the I2C interface. It’s just getting power from somewhere through that pot. That power lights up the LED in the backlight even if you don’t have anything else connected to the LCD.

Delta_G:
Yes the backlight would come on as it isn't being controlled by the I2C interface. It's just getting power from somewhere through that pot. That power lights up the LED in the backlight even if you don't have anything else connected to the LCD.

Not necessarily. It depends on the actual circuitry.
I have seen more than 11 different designs for these PCF8574 backpacks.

Most allow the backlight to be controlled by a PCF8574 output pin.
(which means you can control it from the i2c bus)
Some use a HIGH signal to turn on the backlight and some use a LOW signal to turn on the backlight.
It depends on the transistor used, NPN, PNP, FET, etc...

And then there is the physical jumper that is on the board.
Depending on the board it can:

  • force the backlight off
  • force the backlight on
    And also depending on the board, that could be with the jumper in or with it out.
    Most disable the backlight when the jumper is pulled and let the PCF8574 control it when in.

So what the backlight does on power up and then how it behaves with a misconfigured library depends on the particular backpack used, the incorrect configured pin mappings being used, along with the data being sent to it.

--- bill