I can't get a 1602 i2c display working. Help?

Yes, I'm fairly new to Arduino, with only a couple of useful projects (solar water heater controller and home security system) built.

I purchased some Yellow/green background i2c displays with black characters. PCF8574T = the i2c backpack chip. The backpack was pre-soldered to the display.

The LCDs were purchased from I2C LCD with Yellow-Green Backlight (1602) | Open ImpulseOpen Impulse

I'm using 4.7k ohm pullup resistors between the UNO's A4 (connected to SDA on the backpack) and A5 (connected to SCL on the backpack).

I've removed all other LiquidCrystal_I2C libraries I had from both "Arduino/Libraries" and "Arduino/Sketches/Libraries" (saving them in a new, NON-Arduino folder). Using the LiquidCrystal_I2C1602V1 library from openimpulse's link to "Arduino/Sketches/Libraries" (where the IDE's "Add .zip Library" function put it), I compiled and ran a small sketch, hoping that the display would work (I've actually tried 2 of the displays). I started with 0x20 for the address of the LCD (because not one of the A0, A1, A2 'jumper contacts' is soldered together). However, when I ran I2CexpDiag, I found the device's address was really 0x27. I don't understand how that can happen without the jumper connections, but then again, I can't see the underside of the backpack. Here's the whole test sketch:

#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() {
Serial.begin(9600);
Serial.println("Top of Setup");
lcd.init(); // initialize the lcd. This makes the lcd go dark (backlight off, but chars still there).
lcd.backlight(); // this DOES turn the backlight on
delay(1000);
lcd.clear(); // from here down, I don't see anything happen to the display
delay(1000);
lcd.cursor();
lcd.setCursor(0,0);
delay(1000);
lcd.blink();
delay(1000);
lcd.print("THIS IS A TEST.");
delay(1000);
lcd.setCursor(0,1);
delay(1000);
lcd.print("End Of The Test.");
delay(1000);
Serial.println("End.");
}

void loop() {
}

When the sketch is loaded to the UNO, the LCD is already lit up. Then, as the sketch ran, it turned the LCD backlight off, then on again. I have adjusted the contrast, and there is one row (the top row) of 16 black rectangles, each of which is 5 by 8 pixels. The bottom row appears completely blank.

Having problems, I ran I2CexpDiag and got this:


Serial Initialized

I2CexpDiag - i2c LCD i/o expander backpack diagnostic tool

hd44780 lib version: 0.9.3

Reported Arduino Revision: 1.8.5
CPU ARCH: AVR - F_CPU: 16000000

A4: digital pin: 18
A5: digital pin: 19
SDA: digital pin: 18
SCL: digital pin: 19

Checking for required external I2C pull-up on SDA - YES
Checking for required external I2C pull-up on SCL - YES

Scanning i2c bus for devices..
i2c device found at address 0x27
Total I2C devices found: 1

Scanning i2c bus for all lcd displays
LCD at address: 0x27 | config: P01245673H | R/W control: Yes
Total LCD devices found: 1

LCD Display Memory Test
Display: 0
Walking 1s data test:
Compare error: addr: 0 read 22 != wrote 1
... all the rest were the same "22" value.
FAILED

No working LCD devices

Here's what I have tried:

  1. reversed A4 and A5. No changes.
  2. added the Serial.println statements to make sure I was actually executing the code. They appeared in the monitor.
  3. used external 4.7k pullup resistors for A4 and A5. No changes.
  4. before using the diagnostic, I used every address in the sketch's code between 0x20 and 0x27, since my chip is a PCF8574T, and apparently the address range for that chip is 0x20 through 0x27. No changes.
  5. re-soldered top and bottom of all 16 connections between the backpack and the LCD display. No changes.
  6. read for several hours on this forum trying to find a solution. No changes.

Here is what I question:

  1. the i2c diagnostic report shows A4 as digital pin 18 and A5 as digital pin 19. Yet A4 and A5 are analog pins 4 and 5. My UNO R3's digital header has only 17 positions.
  2. the i2c diagnostic report apparently wrote various values to different memory locations, but only read back "22". What is the significance of "22"?
  3. why won't something that's supposed to be so simple actually work?

I appreciate anyone who can help me get these little guys to work.

UPDATE: I tried the other two LCDs I ordered. Guess what? They work just fine. I've been looking hard at stuff I can't quite see, beneath the backpacks. It seems like there might be zero clearance between the metal locking tab that holds the LCD to the PCB and the bottom of the backpack on the two that don't work. Who'd have thought something from the factory would be mis-made? Hmmm. Very inexpensive Chinese products. I'm going to put my solder wick to work and remove the backpacks on the two that don't work, then re-solder them with a bit of clearance over the tabs. Sorry to have posted apparently for nothing.
ugfrog

ugfrog:
I'm using 4.7k ohm pullup resistors between the UNO's A4 (connected to SDA on the backpack) and A5 (connected to SCL on the backpack).

That is wrong. A pullup resistor goes between the signal and VCC not between two signals.

Having problems, I ran I2CexpDiag and got this:
...

LCD Display Memory Test
Display: 0
Walking 1s data test:
Compare error: addr: 0 read 22 != wrote 1
... all the rest were the same "22" value.
FAILED

That error indicates an issue reading/writing to LCD ram.
This can be a bad LCD but that is very rare.
This sort of error is usually due to bad solder connections either between the PCF8574 chip and backpack,
or on the header pins on the LCD module.

Here's what I have tried:

  1. reversed A4 and A5. No changes.

You should see changes if you did this. If you swapped SCL and SDL it would no longer work at all.
The Arduino would no longer be able to talk to the PCF8574 chip.

  1. used external 4.7k pullup resistors for A4 and A5. No changes.

I2CexpDiag indicated that external pullups were already present, which means they are on the backpack.
If you add additional pullup resistors, (which are not needed), then they should not be wired between SDA and SCL as you mentioned earlier.

  1. re-soldered top and bottom of all 16 connections between the backpack and the LCD display. No changes.

It is possible that the PCF854 is not soldered properly to the backpack.
Can you post photos of your backpack showing the PCF8574 and of the 16 pins on the LCD module?

Here is what I question:

  1. the i2c diagnostic report shows A4 as digital pin 18 and A5 as digital pin 19. Yet A4 and A5 are analog pins 4 and 5. My UNO R3's digital header has only 17 positions.

Analog pins can also be digital pins. The numbering space for analog pins vs digital pins is different.
On an Uno, Analog pin 0 is digital pin 14, analog 1 is digital 15 etc.. up to Analog 4 is digital 18 and analog 5 is digital 19.

Your Uno does have 20 positions (pins). Count again.
You have 14 positions (digital pins 0 to 13 ) which is 14 along the top.
You have 6 positions (analog pins 0 to 5 or digital pins 14 to 19) along the bottom.
This is a total of 20 positions (pins).

  1. the i2c diagnostic report apparently wrote various values to different memory locations, but only read back "22". What is the significance of "22"?

It is what was read back. The tool tries to write a value to the LCD by wiggling pins on the PCF8574, then it attempts to read that value back by wiggling a few pins on the PCF8574 and reading a few of the pins to try to read the data from the LCD.
There is a h/w issue so it didn't get the expected information.

Each byte is written/read as a two nibbles. Given the way the h/w works, a pin on the PCF8574 that is not connected to the LCD pin will read as a one (high).
Lots of odd & strange stuff can happen when there are bad connections like connections that are open or connections that are shorted. Either of those can occur from poor soldering somewhere on the backpack or on the connections to the LCD.

  1. why won't something that's supposed to be so simple actually work?

Actually it isn't all that simple. There is quite a bit going on in h/w and s/w to make an LCD work over an i2c interface.

But the reason it isn't working is because there is a h/w issue.
This can happen with purchasing low cost devices on places like ebay or alibaba.
Sometimes they are rejects that sellers obtain and sell.
Most of the time on these types of devices, it can be fixed by looking carefully at the board to find the issue.
Recently I have been seeing some of these devices with poor solder connections on the PCF8574 chip.
A few have had no solder connections on pins 9 and 10 of the chip.

It is possible that there is a chip issue in the PCF8574 or the LCD, but that is pretty rare.
More than likely there is some kind of soldering issue.
Can you post some clear photos of the backpack and the solder connections to the LCD.

--- bill

I'm using 4.7k ohm pullup resistors between the UNO's A4 (connected to SDA on the backpack) and A5 (connected to SCL on the backpack).

That seems to be misleading. I meant that I am pulling up A4 (connected to SDA on the backpack) to +5vdc. Same for SCL. Sorry for confusing things.

I got 3 out of 4 of the LCDs to work. The worst one still doesn't work. I think I may have damaged it when I was trying to give it clearance between the LCD's metal tab and the backpack (scratching a trace on the PCB). Anyway, things with the other 3 are working well now, after making sure there wasn't any contact between the bottom of the backpack and the components to which it was attached. I thank you for your detailed comments in response to my problem.
ugfrog