Hello, I am using an LCD display 16x2 with an I2C module (based on the PCF8574 IC, see 2nd pic) alongside a Arduino Uno WiFi Rev2.
I'm a beginner to Arduino and I want to use the LCD display as part of a project for a uni course and I'm stuck with trying to get the LCD to display something. I'm connecting the SCL and SDA pins of the I2C module to the A5 and A4 pins of the Arduino, respectively.
From what I've read on-line, in particular from other posts from this forum (e.g. HD44780 not working on my I2C LCD - #2 by outbackhut), the hd44780 library is ideal for my project, with this sort of LCD display. However, when running the I2CexpDiag Example in Arduino IDE (File -> Examples -> hd44780 -> ioClass -> hd44780_I2Cexp), when trying to initialize the LCD display (with lcd.begin()..), I'm getting "LCD 0 begin() failed: -4" (see 1st pic).
Note that, in the 1st pic, it says "i2c device found at address 0x60", which is odd given that this I2C module came configured with the 0x27 address. However, I have another LCD (not the one I'm currently using but used before for troubleshooting) which has a different I2C with the 0x60 address, if that helps in building an understanding of the issue.
Edit: I ended up switching to a Arduino Uno Rev3 + an ESP8266 module (instead of an Arduino Uno Wi-Fi Rev2) and a similar LCD display for which I used a different library (Grove - 16x2 LCD | Seeed Studio Wiki, if you're curious) and this is enough for my purposes so I abandoned my previous implementation!
Yes, I've tried connecting the LCD pins to the D21/SCL and D20/SDA pins of the Arduino but the issue remains the same (originally I was trying with A5 and A4).
Thank you for the code! I've tried it (adjusting for Serial.begin(9600) instead) but the issue remains "LCD initialization failed: -4"
Thank you. There seems to have been a change in the error code, it changed to "LCD initialization failed: -1". I will have to look up as to why in the documentation for the hd44780 lib
There should be no need to run any other code other than I2Cexpdiag.
In terms of pins, I2Cexpdiag tells you which Arduino pins can be used.
If A4 and A5 are i2c signals those should be reported in the output.
The first thing I2Cexpdiag does after checking the i2c signals and pins is to scan the bus
for ALL i2c slaves.
You see one slave device at address 0x60.
This is not a PCF8574.
This is why it reported no working LCD devices.
It scanned all addresses looking for the LCD backpacks (0x20-0x27 and 0x38-0x3f)
and didn't find any. Which agrees with the i2c slave device scan which only found
a single i2c slave at address 0x60.
It isn't clear to me which Arduino board was being used to create the I2CexpDiag.
Maybe you ran it on the Wifi board and and has an i2c device on board.
OR maybe you were using some other i2c LCD which has a PWM slave device that
is at address 0x60
Do you only have the 1 device (the LCD with the PCF8574 backpack) hooked up?
For diagnostic purposes, it is best to only hook up one LCD with a PCF8574 backpack.
Did you get the SDA and SCL signals connected backwards or to the incorrect pins on the Arduino board?