Defective I2C LCD screen? Need troubleshooting help

Hi,

I recently bought an I2C LCD screen module (Ref 1602A), and I can't get it to display anything when I connect it to my Arduino Mega 2560. Here's what I did so far:

  1. Wiring:
    LCD - GND --> Arduino GND
    LCD - VCC --> Arduino 5V
    LCD - SDA --> Arduino SDA 20 (COMMUNICATION)
    LCD - SCL --> Arduino SCL 21 (COMMUNICATION)

  2. codes
    When I found out I couldn't display anything on the screen, I ran the I2C scanner sketch (https://lastminuteengineers.com/i2c-lcd-arduino-tutorial/) and the output was:
    "I2C device found at address 0x27 !"

Then I figured I would run a very simple sketch to check only the display:

#include <LiquidCrystal_I2C.h>

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

void setup() {
  lcd.init();
  lcd.clear();         
  lcd.backlight();      // Make sure backlight is on
  
  // Print a message on both lines of the LCD.
  lcd.setCursor(2,0);   //Set cursor to character 2 on line 0
  lcd.print("it works");
  
  lcd.setCursor(2,1);   //Move cursor to character 2 on line 1
  lcd.print("or not...");
}

void loop() {
}

When I load this sketch, the LCD backlight is ON, but nothing is displayed on the screen...

I read various topics on forums and online resources, but I can't find what I'm doing wrong here, so - the question is:

"Am I even dumber than I already know I am, or is my LCD defective?" :wink:

Thanks in advance for your input...

Your topic was MOVED to its current forum category which is more appropriate than the original as it has nothing to do with Installation and Troubleshooting of the IDE

Do you see a potentiometer anywhere in your setup? There should be one on the I2C backpack. When your program is running in the Arduino, adjust the potentiometer, see if your problem is just contrast.

two possible reasons

wrong I2C-adress: run the I2C-Scanner to determine the I2C-adress

wrong adjusted contrast: most LCDs have a small potentiometer for adjusting the contrast

Post datasheet and pictures of both sides of your lcd

you can check If it is just a contrast-problem with this code
which switches the backlight on/off every second
If the backlight does go on/off I2C-communication is working and it is very likely wrong adjusted contrast

#include <LiquidCrystal_I2C.h>

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

unsigned long MyTestTimer = 0;                   // Timer-variables MUST be of type unsigned long
boolean OnOff = true;

void setup() {
  lcd.init();
  lcd.clear();
  lcd.backlight();      // Make sure backlight is on

  // Print a message on both lines of the LCD.
  lcd.setCursor(2, 0);  //Set cursor to character 2 on line 0
  lcd.print("it works");

  lcd.setCursor(2, 1);  //Move cursor to character 2 on line 1
  lcd.print("or not...");// easy to use helper-function for non-blocking timing
}

void loop() {

  // check if 1005 milliseconds have passed by
  if ( TimePeriodIsOver(MyTestTimer, 1005) ) {
    // if REALLY 1005 milliseconds have passed by
    // automatically update variable MyTestTimer
    if ( OnOff ) {
      lcd.noBacklight();
      OnOff = false;
    }
    else {
      lcd.backlight();
      OnOff = true;
    }
  }
}


// easy to use helper-function for non-blocking timing
boolean TimePeriodIsOver (unsigned long &startOfPeriod, unsigned long TimePeriod) {
  unsigned long currentMillis  = millis();
  if ( currentMillis - startOfPeriod >= TimePeriod ) {
    // more time than TimePeriod has elapsed since last time if-condition was true
    startOfPeriod = currentMillis; // a new period starts right here so set new starttime
    return true;
  }
  else return false;            // actual TimePeriod is NOT yet over
}

best regards Stefan

Hi,

Thanks for the hint, as soon as I get back home, I'll give it a try (there's indeed a pot at the back of the I2C module, but I didn't think about it, considering it's brand new and it would be a bad idea to ship such displays with the contast set to zero...

But who knows...

Well, I received 2 answers here:

  • LCD's are sometimes shipped with the contrast pot set to 0
  • I'm even dumber than I already knew...
    Anyway... Thanks for helping me out, it works way better with a bit of contrast :smiley:
1 Like

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