HD44780 with I2C - text not showing

Hi :slight_smile:
I learn arduino, and i have first problem. I have connect hd44780 for I2C to my arduino, my code on and off backlight, thats works fine. Next action in my code is show Hello World text, but this not working. Instead text on lcd i see squares. I set up potentiometer to different position but still not working.

I have connect I2C

  • VCC to Arduino VCC
  • GND to Arduino GND
  • SDA/SCL to Arduino SDA/SCL

My code:

#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.backlight(); // enable backlight
lcd.setCursor(0,0);
lcd.print(“LCD & I2C”);
}

void loop()
{
lcd.backlight(); // enable backlight
delay(5000);
lcd.noBacklight(); // disable backlight
delay(5000);
}

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.

You also need to confirm that there are pullup resistors on the SDA and SCL lines. Some I2C backpacks have them and some do not. The diagnostic sketch will check for the pullups.

Hi,
Thanks for answer :slight_smile: My LCD address is 0x27. I don't have pullup resistors on the SDA and SCL lines, i have direct connect from LCD to Arduino SDA/SCL. I remember all worked fine without pull up resistors, but forgot which library i used.

I will check hd44780 library which you mentioned and return with response.

I checked the library you wrote about and many more, unfortunately the effect is the same all the time. Nothing but the squares appears, regardless of the contrast setting. I suspect that I lost my LCD.

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.

If you run the diagnostic and post the results copied from the serial monitor we may be able to see what is wrong.

Path to diagnostic program.

It's a result:


Serial Initialized

I2CexpDiag - i2c LCD i/o expander backpack diagnostic tool

hd44780 lib version: 1.0.2

Reported Arduino Revision: 1.8.9
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
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
Compare error: addr: 0 read 22 != wrote 2
Compare error: addr: 0 read 22 != wrote 4
Compare error: addr: 0 read 22 != wrote 8
Compare error: addr: 0 read 22 != wrote 10
Compare error: addr: 0 read 22 != wrote 20
Compare error: addr: 0 read 21 != wrote 40
Compare error: addr: 0 read 22 != wrote 80

Compare error: addr: 40 read 3C != wrote 1
Compare error: addr: 40 read 82 != wrote 4
Compare error: addr: 40 read 82 != wrote 8
Compare error: addr: 40 read 82 != wrote 10
Compare error: addr: 40 read 82 != wrote 20
Compare error: addr: 40 read 82 != wrote 40
Compare error: addr: 40 read 82 != wrote 80

Compare error: addr: 10 read 81 != wrote 1
Compare error: addr: 10 read 82 != wrote 2
Compare error: addr: 10 read CC != wrote 4
Compare error: addr: 10 read C2 != wrote 8
Compare error: addr: 10 read C2 != wrote 10
Compare error: addr: 10 read C2 != wrote 20
Compare error: addr: 10 read C2 != wrote 40
Compare error: addr: 10 read C2 != wrote 80

Compare error: addr: 50 read C2 != wrote 1
Compare error: addr: 50 read C2 != wrote 2
Compare error: addr: 50 read 91 != wrote 4
Compare error: addr: 50 read 92 != wrote 8
Compare error: addr: 50 read 9C != wrote 10
Compare error: addr: 50 read 92 != wrote 20
Compare error: addr: 50 read 92 != wrote 40
Compare error: addr: 50 read 92 != wrote 80
FAILED
Address line test:
Compare error: addr: 0 read 94 != wrote 0
Compare error: addr: 1 read 95 != wrote 1
Compare error: addr: 2 read 96 != wrote 2
Compare error: addr: 3 read 97 != wrote 3
Compare error: addr: 4 read 98 != wrote 4
Compare error: addr: 5 read 99 != wrote 5
Compare error: addr: 6 read 9A != wrote 6
Compare error: addr: 7 read 9B != wrote 7
Compare error: addr: 8 read 9C != wrote 8
Compare error: addr: 9 read 9D != wrote 9
Compare error: addr: B read 9E != wrote B
Compare error: addr: C read 9F != wrote C
Compare error: addr: E read A0 != wrote E
Compare error: addr: F read A1 != wrote F
Compare error: addr: 10 read A2 != wrote 10
Compare error: addr: 11 read A3 != wrote 11
Compare error: addr: 12 read A4 != wrote 12
Compare error: addr: 13 read A5 != wrote 13
Compare error: addr: 14 read A6 != wrote 14
Compare error: addr: 15 read A7 != wrote 15
Compare error: addr: 16 read 84 != wrote 16
Compare error: addr: 17 read 85 != wrote 17
Compare error: addr: 18 read 86 != wrote 18
Compare error: addr: 19 read 87 != wrote 19
Compare error: addr: 1A read 88 != wrote 1A
Compare error: addr: 1B read 89 != wrote 1B
Compare error: addr: 1C read 8A != wrote 1C
Compare error: addr: 1D read 8B != wrote 1D
Compare error: addr: 1E read 8C != wrote 1E
Compare error: addr: 1F read 8D != wrote 1F
Compare error: addr: 20 read 8E != wrote 20
Compare error: addr: 21 read 8F != wrote 21
Compare error: addr: 22 read 80 != wrote 22
Compare error: addr: 23 read 81 != wrote 23
Compare error: addr: 24 read 92 != wrote 24
Compare error: addr: 25 read 93 != wrote 25
Compare error: addr: 26 read 94 != wrote 26
Compare error: addr: 27 read 95 != wrote 27

Compare error: addr: 40 read 94 != wrote 40
Compare error: addr: 41 read D5 != wrote 41
Compare error: addr: 42 read D6 != wrote 42
Compare error: addr: 43 read D7 != wrote 43
Compare error: addr: 44 read D8 != wrote 44
Compare error: addr: 45 read D9 != wrote 45
Compare error: addr: 46 read DA != wrote 46
Compare error: addr: 47 read DB != wrote 47
Compare error: addr: 48 read DC != wrote 48
Compare error: addr: 49 read DD != wrote 49
Compare error: addr: 4A read DE != wrote 4A
Compare error: addr: 4B read DF != wrote 4B
Compare error: addr: 4C read E0 != wrote 4C
Compare error: addr: 4D read E1 != wrote 4D
Compare error: addr: 4E read E2 != wrote 4E
Compare error: addr: 4F read E3 != wrote 4F
Compare error: addr: 50 read E4 != wrote 50
Compare error: addr: 51 read E5 != wrote 51
Compare error: addr: 52 read E6 != wrote 52
Compare error: addr: 53 read E7 != wrote 53
Compare error: addr: 54 read C4 != wrote 54
Compare error: addr: 55 read C5 != wrote 55
Compare error: addr: 56 read C6 != wrote 56
Compare error: addr: 57 read C7 != wrote 57
Compare error: addr: 58 read C8 != wrote 58
Compare error: addr: 59 read C9 != wrote 59
Compare error: addr: 5A read CA != wrote 5A
Compare error: addr: 5B read CB != wrote 5B
Compare error: addr: 5C read CC != wrote 5C
Compare error: addr: 5D read CD != wrote 5D
Compare error: addr: 5E read CE != wrote 5E
Compare error: addr: 5F read CF != wrote 5F
Compare error: addr: 60 read C0 != wrote 60
Compare error: addr: 61 read C1 != wrote 61
Compare error: addr: 62 read C2 != wrote 62
Compare error: addr: 63 read C3 != wrote 63
Compare error: addr: 64 read D4 != wrote 64
Compare error: addr: 65 read D5 != wrote 65
Compare error: addr: 66 read D6 != wrote 66
Compare error: addr: 67 read D7 != wrote 67
FAILED
Memory test failures are usually due to poor solder connections
Most common cause is poor solder joints on pins soldered to the LCD


No working LCD devices

The next thing is to post photos of the LCD and backpack that show the solder joints. There have been instances of poor soldering of the I2C expander chip and the of the headers between the LCD and backpack. The photos need to be as close up as possible so that we can see the solder joints clearly.

Hi :slight_smile: I solder I2C, soldered a good deal and now works with the library you provided :slight_smile: Thank you very much for your help.

Glad to hear that you got it working and you are welcome.

Reverse32:
Hi :slight_smile: I solder I2C, soldered a good deal and now works with the library you provided :slight_smile: Thank you very much for your help.

Just for clarity can be be more specific as to what you actually re-soldered?
Was it the 16 pins on the backpack to the LCD or was it something else like the actual PCF8574 chip.

I like to keep track of all the issues that people have had and to potentially update the diagnostic tool to be more helpful.

Did you happen to take any before or after photos?

--- bill