2

I am hoping there is a simple fix to this problem.

I am playing around with a 16x2 lcd with a I2C connector attached. I wired it up to an elegoo uno R3.

I started with some code I've used before and ended up with one row of the LCD fully lit and the other dark.

After a ton of trouble shooting, I can not get the LCD to show anything but one lit and one dark row.

arduino with lcd attached

In this image:

Power: 5V, 1.5A

Pin LCD Uno
SCL SCL SCL
SCA SDA SDA
+ VCC 5V
gnd gnd gnd

I've also tried:

  • putting the SDA to A4 and the SCL to A5
  • Using different power supplies
  • Powering from the USB connector

And I've tried several of the libraries available

They are all variations of the following from the Adafruit_LiquidCrystal library:

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

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

void setup()
{
    // initialize the LCD
    lcd.begin();

    // Turn on the blacklight and print a message.
    lcd.backlight();
    lcd.print("Hello, world!");
}

void loop()
{
    // Do nothing here...
}

No matter what I do the display does not change.

5
  • There should be a potentiometer for the contrast. Turning it ccw will make the text visible
    – SBF
    Commented Jul 8, 2023 at 18:51
  • I've played with that. There is no position where text is visible. The top row is fully lit and the bottom row off. When I turn the pot, the lit crystals dim evenly to nothing. Commented Jul 8, 2023 at 19:09
  • 1
    Maybe try an I2C scanner to verify the I2C address which your code assumes is 0x27
    – 6v6gt
    Commented Jul 8, 2023 at 21:10
  • That fixed it. The scanner found the i2c at 0x3f. Everything is working. Thank you! Commented Jul 8, 2023 at 21:52
  • @6v6gt, if you could create an Answer and Andrew if you could accept it, that would make this Q & A perfect for anyone else in the same predicament.
    – st2000
    Commented Jul 9, 2023 at 0:16

1 Answer 1

4

Some common problems with LCD displays which incorporate an I2C backpack include:

  1. Not using the correct I2C address for the I2C backpack. Use an I2C scanner to discover the correct address.
  2. Mixing voltages without proper level shifting, say using a 5v display with a 3.3v MCU
  3. Failing to adjust the contrast potentiometer
  4. Some I2C backpacks may use a non-standard pin allocation which may be corrected by specifying a pin mapping in the constructor to the display library. Fortunately, this is rare.
  5. Using code samples intended for a different variant of the library supporting the display. Always use a basic test sketch which is packaged with the chosen library to verify the performance of the display.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.