I2C LCD doesn't display text [SOLVED]

Hi, can you please help me with my problem?
I have an I2C LCD display connected to a CH341 (UNO board) and i can't display any text on it.

This is the code i use:

// simple i2c lcd text

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

LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);

void setup()
{
  lcd.begin(16,2);
  lcd.clear();
  lcd.print("hello, world!");
}

void loop() {}

I adjusted the potentiometer and that is not helping my problem, but the contrast is changing.

Also i used this code to find my lcd address and it is 0x27:

#include <Wire.h>
 
 
void setup()
{
  Wire.begin();
 
  Serial.begin(9600);
  while (!Serial);             // Leonardo: wait for serial monitor
  Serial.println("\nI2C Scanner");
}
 
 
void loop()
{
  byte error, address;
  int nDevices;
 
  Serial.println("Scanning...");
 
  nDevices = 0;
  for(address = 1; address < 127; address++ )
  {
    // The i2c_scanner uses the return value of
    // the Write.endTransmisstion to see if
    // a device did acknowledge to the address.
    Wire.beginTransmission(address);
    error = Wire.endTransmission();
 
    if (error == 0)
    {
      Serial.print("I2C device found at address 0x");
      if (address<16)
        Serial.print("0");
      Serial.print(address,HEX);
      Serial.println("  !");
 
      nDevices++;
    }
    else if (error==4)
    {
      Serial.print("Unknown error at address 0x");
      if (address<16)
        Serial.print("0");
      Serial.println(address,HEX);
    }    
  }
  if (nDevices == 0)
    Serial.println("No I2C devices found\n");
  else
    Serial.println("done\n");
 
  delay(5000);           // wait 5 seconds for next scan
}

My SDA and SCL pins are connected to the SDA and SCL ports on the board but i also tried connecting them to the ports A4 and A5 and that didn't work.

I attached some photos to help, in one of the photos the potentiometer is turned all the way left.

Thank you in advance for the help!

1 Like

Solder the backpack to the LCD. And show a photo of "your soldering".

Then install "hd44780" library via the IDE Library Manager. (and read the instructions e.g. click on More Info in the Library Manager)

David.

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, 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.

1 Like

rsz_1rsz_120190704_115012.jpg

rsz_20190704_115020.jpg

rsz_20190704_115032.jpg

rsz_20190704_115047.jpg

Hmm, yes, please do reassure us that the backpack is actually connected to the LCD display before you do anything else. :astonished:

david_prentice:
Then install "hd44780" library via the IDE Library Manager. (and read the instructions e.g. click on More Info in the Library Manager)

All the information is available in or through the included documentation that is installed with the library.
Simply click on the Documentation "sketch" under the hd44780 library examples.
It is conveniently at the top of the list.
It will bring up a sketch that has lots information, including clickable links to additional information including instructions of where the find the I2CexpDiag sketch in the examples.

--- bill

david_prentice:
Solder the backpack to the LCD. And show a photo of "your soldering".

Then install "hd44780" library via the IDE Library Manager. (and read the instructions e.g. click on More Info in the Library Manager)

David.

i soldered the backpack and now it's working, thank you!

Jolly good.

Welcome to the Forum.

David.

@groundFungus Thanks!

Yes, as always, it only works if you actually connect the parts together! :cold_sweat:

I am encountering the same problem and tried way it was explained but in vain. Below is result of tool. Please help

// simple i2c lcd text

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

//LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup()
{
lcd.begin(16,2);
lcd.clear();
lcd.print("hello, world!");
}

void loop() {}


Serial Initialized

I2CexpDiag - i2c LCD i/o expander backpack diagnostic tool

hd44780 lib version: 1.3.1

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

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

Checking for required external I2C pull-up on SDA - YES
Checking for required external I2C pull-up on SCL - YES
Checking for I2C pins shorted together - Not Shorted

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

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

LCD Display Memory Test
Display: 0
Walking 1s data test: PASSED
Address line test: PASSED

Each working display should have its backlight on
and be displaying its #, address, and config information
If all pixels are on, or no pixels are showing, but backlight is on, try adjusting contrast pot
If backlight is off, wait for next test

Blinking backlight test: to verify BL level autodetection
If backlight is mostly off but
you briefly see "BL Off" on display with backlight on,
then the library autodetected incorrect BL level
and the library cannot autoconfigure the device

Go back and read all of the posts of this thread. Install and use the hd44780 library.

Solved