Multiple I²C (I2C) LCD Displays

Hello.
I have 4 16x2 LCD Displays all connected to the same I²C bus.
Their addresses are 0x20, 0x21, 0x22, & 0x23.
I am trying to get them to all show different information at the same time but the only one I can get to do anything is the one at 0x21.
I currently don’t have any example sketched as I am trying to modify existing incomplete sketches.

I use the #include <LiquidCrystal.h> & #include <Wire.h> libraries.
I tried to use Wire.beginTransmission (0x21); & Wire.endTransmission (0x21); along with lcd.clear(); & lcd.write(“Hello”); to no avail.
My LCD remains unresponsive.

I know it’s a software issue. I just can’t figure out the code, nor can I find an example code for using multiple LCD Displays.

Any help would be appreciated.

You have to make an instance of each of you devices. Post what you have or a small but compleate example that shows the problem.

This is a straight forward sketch that doesn’t work.
I think it gets the point across of what I’m trying to do.
I have never tried to do multiple addresses on I²C before.
this is all just experimentation for possible future projects.

#include <LiquidCrystal.h>
#include <Wire.h>
LiquidCrystal lcd(0);
LiquidCrystal lcd1(0x21);
LiquidCrystal lcd2(0x22);
LiquidCrystal lcd3(0x23);

void setup() {
  lcd.begin(16,2);
  lcd1.begin(16,2);
  lcd2.begin(16,2);
  lcd3.begin(16x2);
  lcd.setBacklight(HIGH);
  lcd1.setBacklight(HIGH);
  lcd2.setBacklight(HIGH);
  lcd3.setBacklight(HIGH);
  lcd.clear();
  lcd1.clear();
  lcd2.clear();
  lcd3.clear();
  lcd.setCursor(0,0);
  lcd.print("Test");
  Wire.beginTransmission (0x21);
  lcd1.setCursor(0,0);
  lcd1.print("Test1");
  Wire.endTransmission (0x21);
  Wire.beginTransmission (0x22);
  lcd1.setCursor(0,0);
  lcd1.print("Test2");
  Wire.endTransmission (0x22);
  Wire.beginTransmission (0x23);
  lcd1.setCursor(0,0);
  lcd1.print("Test3");
  Wire.endTransmission (0x23);
}

Er.. Don't you need to use an I2C LCD libary? Not just the normal one.

That's the thing. I don't know. I want to learn but there aren't too many places I can find.

That was a gentle hint. Yes you have to use a I2C LCD libary.

Thanks to some great members from The Geek Group, it was brought to my attention that 3 of my I²C LCD Controllers required a different library than the I²C LCD Board I’ve had for the last couple months.

Now with a modified test sketch, I managed all 4 LCD’s to display test messages simultaneously.

/*
 * Displays text sent over the serial port (e.g. from the Serial Monitor) on
 * an attached LCD.
 */
#include <Wire.h> 
#include <LiquidCrystal.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal lcd0(0);
LiquidCrystal_I2C lcd1(0x21,16,2);  // set the LCD address to 0x20 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd2(0x22,16,2);
LiquidCrystal_I2C lcd3(0x23,16,2);

void setup()
{
  lcd0.begin(16,2);
  lcd1.init();                      // initialize the lcd 
  lcd1.backlight();
  lcd2.init();                      // initialize the lcd 
  lcd2.backlight();
  lcd3.init();                      // initialize the lcd 
  lcd3.backlight();
  Serial.begin(9600);
  lcd0.print("Test 1");
  lcd1.print("Test 2");
  lcd2.print("Test 3");
  lcd3.print("Test 4");
}

void loop()
{
  // when characters arrive over the serial port...
  if (Serial.available()) {
    // wait a bit for the entire message to arrive
    delay(100);
    // clear the screen
    lcd1.clear();
    // read all the available characters
    while (Serial.available() > 0) {
      // display each character to the LCD
      lcd1.write(Serial.read());
    }
  }
}

https://docs.google.com/file/d/0BzJvWIL7mrfcWktXak1kbXNER0E/edit

How Did you change the addresses of the I2C ? I bought 3 and they all have the same address and I cant change it. Take a look on my issue at http://forum.arduino.cc/index.php?topic=158312.0 Did you use the "LCM1602 A0 A1 A2" I2C adapter shown in that post pictures? thx

Hi, if this works:

LiquidCrystal_I2C lcd1(0x21,16,2);  // set the LCD address to 0x20 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd2(0x22,16,2);
LiquidCrystal_I2C lcd3(0x23,16,2)

Then you are using the default constructor which I believe uses the pinout of the "YwRobot" type backpack.

If you were using the "LCM1602 A0 A1 A2" or other type adapters then you would have to specify the correct pin assignments on the constructor statement, as in the example on this page: http://arduino-info.wikispaces.com/LCD-Blue-I2C

...I think...

How Did you change the addresses of the I2C ? I bought 3 and they all have the same address and I cant change it.

I use three of these I got them off eBay. http://www.ebay.com/itm/190844921332?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649 http://i1270.photobucket.com/albums/jj620/dykb1982/new/fsdjkkl-2_zps0031289b.jpg

I am using three 16x2 LCDs that were hacked out of old Networking equipment. The 4th 16x2 LCD and I²C control board, I got together months ago, but I can't remember from where. The chips used on the one I've been using for months and the three I got from the link above are completely different so to run both in the same sketch, it requires both libraries and two different initialization codes. If I initialize the older one with LiquidCrystal_I2C(0x20,16,2), the it doesn't respond but the others will. It will only respond to LiquidCrystal (0) and in void setup() it will initialize with lcd.begin(16,2);

hope this clears it up a little.