LCD I2C print() doesn't work

Dear community,

I looked up my problem in Google, but couldn't find anything the solved my problem.

I have an Arduino Nano controlling a 16x2 HD44780 LCD (from AZDelivery) with an I2C interface. If I start it up, the background light turns on and I get an empty display (I guess this is fine). But after calling print() no text is displayed.

I checked the address (0x27) with the example and currently using the following code:

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

//LiquidCrystal_I2C lcd(0x27, 16, 2); // 16x2
LiquidCrystal_I2C lcd(0x27, 20, 4); // 16x2

void setup() {
  Serial.begin(9600);


  lcd.init();
  //lcd.begin(16,2);
  lcd.backlight();
  lcd.setCursor(0, 0);
  lcd.print("test");
}

I think I have disfunctional soldiering. But I don't see where. I you could check my soldiering I would really appreciate it. I added pictures at the attachements.
The soldiering on the Arduino Board is fine, but I added a picture of it anyways.

All other connections are done with female-female cables.

Thank you very much for your time and maybe your advice.

If it is a 1602, why do you initialize it as a 2004?

//LiquidCrystal_I2C lcd(0x27, 16, 2); // 16x2
LiquidCrystal_I2C lcd(0x27, 20, 4); // 16x2

Remove the comments from the first line and comment/remove the second line.

step one:

I get an empty display (I guess this is fine).

no that's not good, with an empty sketch you should get blocks in the first row and an empty second row. Adjust the contrast potentiometer

step two:
search for an "Arduino i2c scanner" sketch
upload it to your Arduino
and check if you can find the address of your expander chip.

show the serial output.
If your Arduino doesn't find the right address, show clear pictures from the wiring of your module with the Nano where we can identify EACH wire. going from A to B

Your photos do not show where the wires go or the pin names in the backpack and LCD. Are you sure that the backpack is installed the right way?

Have you tried the contrast adjustment?

For an I2C LCD display to work, the I2C address and the I2C backpack to LCD pin mapping must be correct. If the library default settings for either or both are not correct the LCD will not work. You can try to figure out the right pin mapping and use an I2C scanner to find the address, but if you install and use the hd44780 library that is done automatically by the library.

Install the hd44780 library. The hd44780 library is the best available for I2C LCDs. The library is available in the Library Manager. Go to Library Manager (in the IDE menus, Sketch, Include Libraries, Manage Libraries) and in the Topics dropdown choose Display and in the Filter your search box enter hd44780. Select and install the hd44780 library by Bill Perry.

The class that you want to use is the hd44780_I2Cexp class. There are examples to show how to use the library. The nice thing about the hd44780 library is that it will autodetect the I2C address and the I2C backpack to LCD pin mapping.

In the examples, there is a diagnostic sketch that will help us to help you if you still have trouble with the display. Run the diagnostic sketch and post the results.

That is an uncommon way to solder the backpack to the LCD module as backpacks are typically soldered with the backpack flipped over such that components and i2c connector/header on the backpack is on the other side of the LCD module.
i.e. the backpack is on the back of the LCD module and not really visible when looking at the front of the LCD.

Two things:
First as noaisca said,

  • Adjust the pot as you should see blocks on one line of the display with just power applied when the pot is adjusted correctly.
    If you see blocks on both lines rotate the pot until you see your text or blocks on just one line.

second,
If you get the blocks on one line but no printed text, initialization is not working which could be a variety of reasons.
At that point, I’d install the hd44780 library package and run the hd44780_I2Cexp i/o class example I2CexpDiag
and look at diagnostic output on the serial port.

If all is working with I2CexpDiag, and you were using the correct i2c address,
then you have a backpack that does not work with the hard coded settings inside the LiquidCrystal_I2C library.
While you could modify the LiquidCrystal_I2C library to work with a different backpack,
I would recommend that you switch over to using the hd44780 library as it can auto detect the pin mapping/wiring and backlight circuit control used on backpack so it can work with 5+ different backpacks.

— bill

Thanks a lot for the helpful advices. I learned more than just how to solve my problem.
In the end the hd44780 library worked for me.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.