hi everyone, I'm pretty new to Arduino but I've been doing circuits and programming for a while.
I'm trying to use the LCD display + bus I2C for the first time and the problem is that once I load my program on the Arduino (I use Uno) the LCD's backlight turns on but no words appear.
Of course I checked the wiring, lcd contrast, codes, libraries etc. over and over but nothing. I even tried loading the "hello world" code but it still doesn't work.
What's the problem? Have I already broken something?
There are two main issues with i2c backpacks for hd44780 LCDs.
i2c address
pin mapping of the PCF8574 output port pins to the hd44780 pins.
If either of these two is incorrect, the LCD will not work.
Getting the address correct is not too difficult as you can run an i2c scanner to detect it.
However, the pin mapping is not as easy.
The issue with respect to pin mappings on i2c backpacks is that there is no standard way to connect the output port of the PCF8574 to the LCD pins. Because of this the library must "know" how the port pins are wired.
Most libraries hard code the mapping (the library you have) and a few allow the pins to be configured in the constructor.
If the i2c address is correct but the pin mapping is wrong, the LCD will not function.
You could use my hd44780 library instead.
You can read more about it on the github page:
This library will automatically figure out all low level i2c backpack configuration information.
It will automatically locate the device to figure out the i2c address then auto detect the type of device used on the backpack (PCF8574 or MCP2308) and then figure out the pin mappings.
It is available in the IDE library manager and can be installed from the GUI in just a few seconds.
It is called "hd44780" and the i/o class is hd44780_I2Cexp
The library also includes a diagnostic sketch called I2CexpDiag that you can run to check your i2c connections and the LCD display. It will also verify the internal RAM inside the LCD.
bperrybap:
There are two main issues with i2c backpacks for hd44780 LCDs.
i2c address
pin mapping of the PCF8574 output port pins to the hd44780 pins.
If either of these two is incorrect, the LCD will not work.
Getting the address correct is not too difficult as you can run an i2c scanner to detect it.
However, the pin mapping is not as easy.
The issue with respect to pin mappings on i2c backpacks is that there is no standard way to connect the output port of the PCF8574 to the LCD pins. Because of this the library must "know" how the port pins are wired.
Most libraries hard code the mapping (the library you have) and a few allow the pins to be configured in the constructor.
If the i2c address is correct but the pin mapping is wrong, the LCD will not function.
This library will automatically figure out all low level i2c backpack configuration information.
It will automatically locate the device to figure out the i2c address then auto detect the type of device used on the backpack (PCF8574 or MCP2308) and then figure out the pin mappings.
It is available in the IDE library manager and can be installed from the GUI in just a few seconds.
It is called "hd44780" and the i/o class is hd44780_I2Cexp
The library also includes a diagnostic sketch called I2CexpDiag that you can run to check your i2c connections and the LCD display. It will also verify the internal RAM inside the LCD.
--- bill
Thank you very much Bill, I really appreciate your response.