Go Down

Topic: [SOLVED] Need help with i2c adaptor for 16x2 lcd (Read 585 times) previous topic - next topic


Aug 02, 2014, 01:37 pm Last Edit: Aug 04, 2014, 09:27 pm by PaulRB Reason: 1
Hi all,

I need some help getting an i2c adaptor to work with a 16x2 lcd display please.

I bought the adaptor cheap on eBay from China. There was almost no detail at all on the eBay page, not even the i2c address, but it looks identical to many others available. The lcd is a standard blue backlit HD44780. I purchased several of these, also very cheap from eBay some time ago and have used them in parallel mode with Arduino without problems.

Rob Tillart's i2cScanner sketch tells me the address of the adaptor is 0x27. It has aPCF8574T chip, which is an ordinary 8-bit i2c i/o expander, I believe.

When I power the adaptor/display up, the power light on the adaptor lights and the display backlight comes on. The display shows white blocks on the top row. This is normal appearance before initialisation codes are sent, as I remember from using these displays in parallel mode.

When I run the LiquidCrystal_i2c "Hello World" sketch, the backlight goes off but the display does not otherwise change. If I reset the arduino, the backlight flashes very briefly and that's all.

My suspicion is that the way the PCF8574 pins are wired to the display are different to what the sketch expects. Hence why the backlight goes off when the sketch is supposed to switch it on. If that is the case, the enable, control/data pins etc could also be different.

There seem to be multiple i2c libraries around for lcd. Can anyone recommend one they have used with this adaptor?

I may have to purchase another adaptor from the same supplier, and test it on breadboard before soldering up to the display...

Adaptor: http://www.ebay.co.uk/itm/191196050930?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649

PS. I know the i2c bus is working fine, I tested it with the ds3231 rtc you can see in the bottom picture.


Aug 02, 2014, 02:01 pm Last Edit: Aug 02, 2014, 02:02 pm by MAS3 Reason: 1
Did you try bperrybap's i2cLCDguesser sketch yet ?
Read that thread, the link leads you to the post that has the sketch in a zip file attached, but there is some good reading in the thread.
Have a look at "blink without delay".
Did you connect the grounds ?
Je kunt hier ook in het Nederlands terecht: http://arduino.cc/forum/index.php/board,77.0.html


Does your Library use: lcd.int() or lcd.begin()  ?
Please post your code.



Sound like same as mine, got from ebay too; try this link is over my post for liquidcrystal that I use:



Thanks all, I will read those threads and try the suggestions tomorrow.

Here's my sketch:

Code: [Select]
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

#define BACKLIGHT_PIN     13

LiquidCrystal_I2C lcd(0x27);  // Set the LCD I2C address

//LiquidCrystal_I2C lcd(0x38, BACKLIGHT_PIN, POSITIVE);  // Set the LCD I2C address

// Creat a set of new characters
const uint8_t charBitmap[][8] = {
   { 0xc, 0x12, 0x12, 0xc, 0, 0, 0, 0 },
   { 0x6, 0x9, 0x9, 0x6, 0, 0, 0, 0 },
   { 0x0, 0x6, 0x9, 0x9, 0x6, 0, 0, 0x0 },
   { 0x0, 0xc, 0x12, 0x12, 0xc, 0, 0, 0x0 },
   { 0x0, 0x0, 0xc, 0x12, 0x12, 0xc, 0, 0x0 },
   { 0x0, 0x0, 0x6, 0x9, 0x9, 0x6, 0, 0x0 },
   { 0x0, 0x0, 0x0, 0x6, 0x9, 0x9, 0x6, 0x0 },
   { 0x0, 0x0, 0x0, 0xc, 0x12, 0x12, 0xc, 0x0 }

void setup()
   int charBitmapSize = (sizeof(charBitmap ) / sizeof (charBitmap[0]));

  // Switch on the backlight
  digitalWrite ( BACKLIGHT_PIN, HIGH );
  lcd.begin(16,2);               // initialize the lcd

   for ( int i = 0; i < charBitmapSize; i++ )
      lcd.createChar ( i, (uint8_t *)charBitmap[i] );

  lcd.home ();                   // go home
  lcd.print("Hello, ARDUINO "); 
  lcd.setCursor ( 0, 1 );        // go to the next line
  lcd.print (" FORUM - fm   ");
  delay ( 1000 );

void loop()
   lcd.home ();
   // Do a little animation by writing to the same location
   for ( int i = 0; i < 2; i++ )
      for ( int j = 0; j < 16; j++ )
         lcd.print (char(random(7)));
      lcd.setCursor ( 0, 1 );
   delay (200);


1. I still seem to have two LiquidCrystal menus showing under "Examples". Need to make sure I completely removed the old one.
2. Can't remember the link where I got the library but the author is Francisco Malpartida



Check my sketch here for the my version of liquidcrystal lib:


My issue was not the display but serial reading.

Where you wrote :
Code: [Select]
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

#define BACKLIGHT_PIN     13

LiquidCrystal_I2C lcd(0x27);  // Set the LCD I2C address

I use:

Code: [Select]
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27,16,2);  // set the LCD address to 0x27 for a 16 chars and 2 line display
float raw;
const int inPin = 0;
int vx;

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

Another issues was; get new line from serial reading, check my other posts, i got the solution from another user of the forum.

The lib that you are using is: here


I tried myself that version, but with poor success.

Your I2c adapter is a v3, like mine, we can see A0 A1 A2, that for address setting, like it is: is 0x27 set.


Aug 03, 2014, 02:09 am Last Edit: Aug 03, 2014, 04:15 am by cattledog Reason: 1
You may not have the libraries worked out yet, but if indeed you have FMalpartida's library with his <LiquidCrystal_I2C.h> included as part of it, then the constructor is incorrect.

If you run and read the code for the i2cLCDguesser you will see that the constructor is in the format that defines the relevant the pins and backlight

// EN, RW, RS, D4, D5, D6, D7, BL, POL
 { 2,  1,  0,  4,  5,  6,  7,  3, POSITIVE }, // YwRobot/DFRobot/SainSmart
 { 2,  1,  0,  4,  5,  6,  7,  3, NEGATIVE }, // Robot Arduino LCM1602/2004
 { 4,  5,  6,  0,  1,  2,  3,  7, NEGATIVE }, // MJKDZ board
 { 6,  5,  4,  0,  1,  2,  3,  7, NEGATIVE }, // I2CIO board modded for backlight (pnp transistor)
 { 6,  5,  4,  0,  1,  2,  3,  7, POSITIVE }, // I2CIO board modded for backlight (npn transistor)
 { 4,  5,  6,  0,  1,  2,  3,  7, POSITIVE }, // (extra combination of MJKDZ just in case...)

Before this information, you need to supply the I2C address.

Depending on your board, the constructor should look like this.

Code: [Select]
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 4, 5, 6, 0 ,1 ,2 ,3 , 7,NEGATIVE);

and later in set up

Code: [Select]
lcd.begin(16, 2);


That library is also required for the i2cLCDguesser i mentioned earlier.
It helps you find the correct constructor.
Different modules might have different pin to pin connections between the chip and the display, there's no standard.
That even happens between different versions of the same module.
So you'd have to track the traces and draw a map to find out about that, or use the guesser (which one would be easier ?)
Have a look at "blink without delay".
Did you connect the grounds ?
Je kunt hier ook in het Nederlands terecht: http://arduino.cc/forum/index.php/board,77.0.html


Did you try bperrybap's i2cLCDguesser sketch yet ?

Thankyou MAS3 !

Bill's guesser sketch got it right on the very first guess. The correct constructor is:
Code: [Select]
lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE)

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131