1602 LCD screen with I2C backpack problems

Ive tried many sketches available in the library but none work the screen other than lighting the screen...watched loads of youtube ! I'm a novice by the way !!

Presuming you have it connected correctly, have you installed the “HD44780” library using the Library Manager in the IDE and used the examples that installing that library provides? :astonished:

All we know at this point is that your display does not work. There is no information that will help us help you.

Post some clear photos showing how the display is connected to your Arduino and the solder on the backpack header and chips on backpack.

Which Arduino board?

Post code that you have tried.

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.

This sketch verifies but doesn’t run the program, Ilm using a Uno. I cannot find a diagnostic sketch using the online library manger search.

How to attach photo ?.. derrrrr sorry guys. Ilm not looking at learning C++ but I have a little project that needs a motor control, tacho, LCD screen and maybe temp/humidity. Thought I would start with some simple projects but Ilm dying on my feet !!

//YWROBOT
//Compatible with the Arduino IDE 1.0
//Library version:1.1
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

#if defined(ARDUINO) && ARDUINO >= 100
#define printByte(args) write(args);
#else
#define printByte(args) print(args,BYTE);
#endif

uint8_t bell[8] = {0x4,0xe,0xe,0xe,0x1f,0x0,0x4};
uint8_t note[8] = {0x2,0x3,0x2,0xe,0x1e,0xc,0x0};
uint8_t clock[8] = {0x0,0xe,0x15,0x17,0x11,0xe,0x0};
uint8_t heart[8] = {0x0,0xa,0x1f,0x1f,0xe,0x4,0x0};
uint8_t duck[8] = {0x0,0xc,0x1d,0xf,0xf,0x6,0x0};
uint8_t check[8] = {0x0,0x1,0x3,0x16,0x1c,0x8,0x0};
uint8_t cross[8] = {0x0,0x1b,0xe,0x4,0xe,0x1b,0x0};
uint8_t retarrow[8] = { 0x1,0x1,0x5,0x9,0x1f,0x8,0x4};

LiquidCrystal_I2C lcd(0x27,20,4); // set the LCD address to 0x27 for a 16 chars and 2 line display

void setup()
{
lcd.init(); // initialize the lcd
lcd.backlight();

lcd.createChar(0, bell);
lcd.createChar(1, note);
lcd.createChar(2, clock);
lcd.createChar(3, heart);
lcd.createChar(4, duck);
lcd.createChar(5, check);
lcd.createChar(6, cross);
lcd.createChar(7, retarrow);
lcd.home();

lcd.print(“Hello world…”);
lcd.setCursor(0, 1);
lcd.print(" i “);
lcd.printByte(3);
lcd.print(” arduinos!");
delay(5000);
displayKeyCodes();

}

// display all keycodes
void displayKeyCodes(void) {
uint8_t i = 0;
while (1) {
lcd.clear();
lcd.print(“Codes 0x”); lcd.print(i, HEX);
lcd.print("-0x"); lcd.print(i+16, HEX);
lcd.setCursor(0, 1);
for (int j=0; j<16; j++) {
lcd.printByte(i+j);
}
i+=16;

delay(4000);
}
}

void loop()
{

}

I really recommend installing and using the hd44780 library.

but doesn’t run the program

What does that mean?

Which Arduino board?
Have you tried the contrast adjustment?

It would help if you would answer questions.

Does the display show any “boxes” when the contrast is adjusted?

What is the address of the display reported by the I2C scanner?

// I2C scanner by Nick Gammon.  Thanks Nick.

#include <Wire.h>

void setup() {
  Serial.begin (115200); //*****  make sure serial monitor baud matches *****

  // Leonardo: wait for serial port to connect
  while (!Serial) 
    {
    }

  Serial.println ();
  Serial.println ("I2C scanner. Scanning ...");
  byte count = 0;
  
  Wire.begin();
  for (byte i = 1; i < 120; i++)
  {
    Wire.beginTransmission (i);
    if (Wire.endTransmission () == 0)
      {
      Serial.print ("Found address: ");
      Serial.print (i, DEC);
      Serial.print (" (0x");
      Serial.print (i, HEX);
      Serial.println (")");
      count++;
      delay (1);  // maybe unneeded?
      } // end of good response
  } // end of for loop
  Serial.println ("Done.");
  Serial.print ("Found ");
  Serial.print (count, DEC);
  Serial.println (" device(s).");
}  // end of setup

void loop() {}

PLEASE
Read the how to use this forum-please read sticky to see how to properly post code and some advice on how to ask an effective question. Remove useless white space and format the code with the IDE autoformat tool (crtl-t or Tools, Auto Format) before posting code.

Some of the answers were at the top of the last post

using a Uno

tried running the May 17 scanner, no result in the monitor, previous scanner results 0x27

Tried adjusting the contrast, no change in the screen, no boxes in the screen

Doesn't run the program.. as in no change to the LCD screen, the backlight seems to remain on.

Tried uploading photo but it didn’t go, I’ll try again

Tried to find the 44870 library ??? Not available on the Web editor file manager !

According to this posting, hd44780.h is available through the library manager in the web editor.

20200514_172410.jpg
Expand

OK, connections look OK ( though I am not familiar with using the extra SDA and SCL pins on the - genuine! - UNO R3), it is correctly powered and lights up.

And I haven't used the Web editor, but you do need the HD44780 library and its examples to make sense of an arbitrary display rather than the older libraries which defaulted to backpacks that are not current.

What is reasonably clear from your photo is that the contrast control is not set. Switch off, disconnect SDA and SCL temporarily and adjust the contrast potentiometer until you see a row of solid blocks on the first line. I presume the backlight will be on as you do this, do tell if it is not! :astonished:

notrots:
Tried to find the 44870 library ??? Not available on the Web editor file manager !

It is.
— bill