I have a 1602 LCD screen that works fine on its own. However I wanted to free some pins by using an I2C / IIC LCD controller I purchased separately.

While the controller seems to be communicating with my Arduino UNO on the right address, I cannot get text to display. By default (no code) it seems the LCD will have 1 line of 16 solid "squares". When using address 27 in my code, the LCD will change to 2 lines of 16 squares (see photo below). The code also calls for the backlight to flash 3 times, which works. However I cannot get anything but 2 lines of squares. (Full code is at the bottom of this question).

I'm using the LiquidCrystal_I2C library by F Malpartida, which seems to be commonly used.
Is there a better library I should be using?

I'm wondering whether it's just the wrong pins being used in the code. All sketches I see online use the following pins:

//                    addr,en,rw,rs,d4,d5,d6,d7,bl,blpol
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
// Set the LCD I2C address

But all of the 1602 LCDs I see online have the same pins as mine, as you can see in my photo below:

I2C LCD Controller

These pins seem to be standard:
1602 LCD Pinout

To further confuse me, the pins on the LCD board start with 1 on the left, yet the default code's pins seem to start with 0! So I tried changing the code's pins to the numbers on the LCD board. The LCD no longer changes to 2 lines of squares and no longer blinks the backlight. I then tried subtracting 1 from each pin (to start from 0), same result. I then tried used the default pins minus 1, same result. Thus the default pins are somehow more correct?! What am I doing wrong?

Has anyone else gotten one of these I2C controllers to work for them, and if so, how?

Full code:

/* YourDuino.com Example Software Sketch
 16 character 2 line I2C Display
 Backpack Interface labelled "YwRobot Arduino LCM1602 IIC V1"
 terry@yourduino.com */

/*-----( Import needed libraries )-----*/
#include <Wire.h>  // Comes with Arduino IDE
// Get the LCD I2C Library here: 
// https://bitbucket.org/fmalpartida/new-liquidcrystal/downloads
#include <LiquidCrystal_I2C.h>

/*-----( Declare objects )-----*/
// set the LCD address to 0x27 for a 20 chars 2 line display
// Set the pins on the I2C chip used for LCD connections:
//                    addr, en,rw,rs,d4,d5,d6,d7,bl,blpol
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);  // Set the LCD I2C address

void setup()   /*----( SETUP: RUNS ONCE )----*/
  Serial.begin(9600);  // Used to type in characters
  lcd.begin(16,2);   // initialize the lcd for 16 chars 2 lines, turn on backlight

// ------- Quick 3 blinks of backlight  -------------
  for(int i = 0; i< 3; i++) {
  lcd.backlight(); // finish with backlight on  

//-------- Write characters on the display ------------------
// NOTE: Cursor Position: (CHAR, LINE) start at 0  
  lcd.setCursor(0,0); //Start at character 4 on line 0
  lcd.print("Hello, world!");

// Wait and then tell user they can start the Serial Monitor and type in characters to
// Display. (Set Serial Monitor option to "No Line Ending")
  lcd.setCursor(0,0); //Start at character 0 on line 0
  lcd.print("Use Serial Mon");
  lcd.print("Type to display");  

}/*--(end setup )---*/

void loop()   /*----( LOOP: RUNS CONSTANTLY )----*/
    // when characters arrive over the serial port...
    if (Serial.available()) {
      // wait a bit for the entire message to arrive
      // clear the screen
      // read all the available characters
      while (Serial.available() > 0) {
        // display each character to the LCD

}/* --(end main loop )-- */
  • Did you remember to add the pullups? Dec 31, 2014 at 19:08
  • 1
  • 1
    Probably not the problem, but have you tried adjusting the contrast using the potentiometer? The numbers in the code refer to which pin on the PCF8574 chip is connected to which pin on the lcd board. P3 on the I2C board is evidently connected to the backlight pin on the LCD. But I think the other pins are wrong somehow. Try using a multimeter to see where the P0-P7 pins of the PCF8574 go to which pins on the lcd header.
    – Gerben
    Dec 31, 2014 at 20:54
  • 2
    Although it may not be the issue, you should pay attention to the soldered pin headers on the LCD, from the picture they appear to not completely cover the copper around the hole; I would try to improve these solder points first.
    – jfpoilpret
    Jan 1, 2015 at 0:13
  • 1
    @Gerben, derp. I tested the chip with a multimeter, however I am still completely confused. Pins 9-12 on the chip correspond to D4-D7 on the lCD. Pin 6=E, 5=RW, and 4=RS. I cannot figure out what pin 7 actually is. Using those values gives me no response from the LCD again. Also, am I supposed to subtract 1 from those pins? Because again, all the default codes out there have pin 0=RS. But that can't be, because the first pin on the chip is A0 (address). Basically, changing any single pin will either kill the backlight response or stop the 2nd row from showing the block characters.
    – Bort
    Jan 1, 2015 at 19:42

7 Answers 7


First of all, it looks like these wires aren't properly connected:

enter image description here

I haven't disassembled a female jumper before, so that might not be the issue. However, it seems likely that this could be a cause.

Also, you need to adjust the contrast by turning that trimmer (the blue thing that looks kinda like it has a screw in it). LCDs will either display nothing, a washed out version of the text, or blue boxes if the contrast is not set correctly. This is probably the cause.

  • The jumpers are like that only because I moved the board for the photo. Also I adjusted the trimmer already and it's either full blocks or nothing at all.
    – Bort
    Dec 31, 2014 at 22:10

I bought the SainSmart 20x04 and I also had to change the address to 0x3F. My backlight jumper was missing, that little header at the right of the I2C board provides the backlight power. Some code I found included this:


I have the very same problem and I fix it just by changing the address for the LCD 1602A, which is in the tutorials 0x27 but in my device is 0x3F.

Good Luck!

  • Same in my case, worked when changing this line: LiquidCrystal_I2C lcd(0x3F,16,2);. Thanks a lot!
    – Stefan
    Oct 30, 2018 at 19:46

As far as I know, the pull-up resistors should be integrated with the display.

Did you try different addresses? I have a similar one, which works on address 0x3F. Maybe this helps.

  • The board was sold as "address 27", and 27 is the only address that responds at all. It's actually customizable by soldering the A1 A2 and A3 pins just above the trimming pot seen in the photo.
    – Bort
    Dec 31, 2014 at 22:19

Change this code:

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

To this:

LiquidCrystal_I2C lcd(0x26, 2, 1, 0, 4, 5, 6, 7, 8, POSITIVE);

(The argument before "POSITIVE" is changed from a 3 to an 8)

  • 1
    Any explanation why? There is no P8 on the PCF8574.
    – tcurdt
    Oct 24, 2015 at 0:44

i'm sure this link will be helpful for you, i have the same lcd and i got it work with I2C following the steps in this link http://forum.arduino.cc/index.php?topic=128635.0

  • 1
    Like in your other answer, post a summary of the guide here in case your link goes 404. Apr 23, 2015 at 16:14
LiquidCrystal_I2C lcd(0x3f, 2, 1, 0, 4, 6, 5, 7, 3, POSITIVE);  // Set the LCD

The I2C module D6->P5 is D5->P6 (inverted).

  • 1
    Can you explain more?
    – Bort
    Mar 2, 2016 at 2:01
  • 2
    Please edit your post and format the code using the code formatting markdown (four leading spaces). For help see Markdown help. You should be able to do this by selecting the code and pressing Ctrl+K to have your browser do this for you. Your answer would be more helpful if you went into more detail.
    – Nick Gammon
    Mar 2, 2016 at 2:31
  • I have had several work for me. The first thing I do is use the I2C scanner to see what it is addressed at. If it does not show you just found your problem. If i find it then I use a very simple sketch to make it light and display Hello! When that works then I dive into my software and try to determine what went wrong!
    – Gil
    Apr 7, 2021 at 20:46

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