Introduction: More LCD S Working Together...

About: Started electronics as a hobby in the seventies, studied it in late seventies, begin 80's, bought my first arduino last november. Love Instructables!

Ever had that problem that you wanted to place so much info on a LCD, that it all looked crammed together?

You can try to scroll data, make different pages on it (by making the readout change by a click on a button), you can try to buy a bigger LCD... You can even change the text-LCD with a graphic LCD. On that one you can also display text, with a smaller font.

But then I have to use my glasses...

The LCDs I use are with an I2C backpack. These are easily found, cheap, and more versatile.

And, like all the I2C devices, they do have an address.

In stead of using the LiquidCrystal.h library in Arduino, for these to work, you need the LiquidCrystal_I2C.h library.

You can find that library here :https://github.com/fdebrabander/Arduino-LiquidCrys...

The huge advantage : only 4 wires to connect...

Step 1: A Little Hardware...

So, this is the "backpack" you can find on the LCD, or can be sold separately. You can find them everywhere at low prices.

The heart of it is an IC from TI, the PCF 8574. This is a port expander: easily put: you connect the IC to an I2C line, address it, and BAM, you have 8 extra IN/Outputs. Since it is versatile in its use, three of the address-lines are put "out". This means you can give it your own address, and you can use up to 8 of these devices.

The backpack then.

This has a fixed (preprogrammed) address of 0X27(hex), or 39 in decimal.

On the table you can see here, you see that all the addresses are set HIGH. When you look at the second picture of the "backpack", you clearly see the A0, A1 and A2 brought out.

When you bridge these, you put the corresponding address line to LOW.

Just follow the table, and you find the address you need in your sketch.

Step 2: Programming

First, lets look at the programming for the original one, without altered address.

In ARDUINO you use these lines to "talk to it":

#include <LiquidCrystal_I2C.h> (call the library)

Then st the I2C device:

LiquidCrystal_I2C lcd(0x27,20,4);

This says to the hardware that there is an I2C device, on address 0x27. The library says it has 20 characters at four lines.

The library uses the commands lcd.print, lcd.clear, and so on.

As soon as we want to get more displays, we must alter the addresses. you can see how, in the above pictures. Just short the appropriate address points, and you're done.

And then you have to change the program as well.

LiquidCrystal_I2C lcd(0x23,20,4); // set the LCD address to 0x23 for a 20 chars and 4 line display
LiquidCrystal_I2C lcd1(0x27,16,2);// set the second LCD address to 0x27 for a 16 chars, 2line display.

So you make two different "instances" for two different displays.

When working further in the program (or the sketch), you have to stay aware that your commands go to the right display.

In this case: lcd.print writes on the first display, the altered one, and lcd1.print sends data to the second one.


Step 3: A Little Test...

#include<wire.h>

#include <LiquidCrystal_I2C.h >

LiquidCrystal_I2C lcd(0x23,20,4); // set the LCD address to 0x23 for a 20 chars and 4 line display

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

void setup() {

lcd.init(); // initialize the lcd

lcd1.init(); // Print a message to the LCD.

lcd.backlight();

lcd1.backlight();

lcd.setCursor(3,0);

lcd.print("When you run");

lcd.setCursor(2,1);

lcd.print("out of LCD space");

lcd.setCursor(5,2);

lcd.print("on an I2C");

lcd.setCursor(2,3);

lcd.print("you can just...");

lcd1.setCursor(0,0);

lcd1.print("Add a second one");

lcd1.setCursor(4,1);

lcd1.print("on I2C :-)"); }

void loop() { }

So... That's about it...

I thought of it when I was making a weather station. I do like to see the time and date too. As you could see on the "original "LCD, all data was a bit crammed, so I tried to use more displays.

And imagine the possibilities! With a maximum of 8 LCD's, you can almost put an entire novel on it :-)

I hope you enjoyed this little instructable, hope you can do something with it!

See/read you later!

Marc.