Connecting multiple I2C screens to Arduino

Connecting multiple I2C screens to Arduino

Daniil Zhuk
Imagine a task when one screen connected to the Arduino is not enough. For example, when creating an electronic lock, the information must be displayed on both sides of the door. In this case, the i2c bus is your best friend.
We will need:
  • Any Arduino board
  • 2x LCD I2C screens
  • Breadboard
  • Wires

We can connect all the screens to the same pins, thank you, i2c bus. Let's do it.

The whole point of managing different screens is to change the i2c address of one of them. To do this, you need to solder together the areas inside the square A0, A1, A2 on the i2c adapter (or you can combine, those A0 and A2 together). The picture shows the contacts under the blue potentiometer.

Install Liquid crystal i2c library. Load sketch of I2C scanner and open the com port monitor.

Here we got the i2c screen address. Can mark on the back side.

Now go to the sketch. Here you have to declare two screens with different addresses and names and refer to a specific screen. 

//connect libraries
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd (0x26, 16, 2); //declare the first screen
LiquidCrystal_I2C lcd2(0x27, 16, 2); //declare the second screen
void setup() {
 lcd.init();  // initialize first screen
 lcd2.init(); // initialize second screen
 lcd.backlight(); // backlight of first screen
 lcd2.backlight(); // backlight of second screen
 //set cursor and type on first screen
 lcd.setCursor(0, 0);
 lcd.print("Hello, world!");
 lcd.setCursor(0, 1);
 lcd.print("First screen");
 //set cursor and type on second screen
 lcd2.setCursor(0, 0);
 lcd2.print("Hello, world!");
 lcd2.setCursor(0, 1);
 lcd2.print("Second screen");
void loop() {

Here is our result.

Thanks for reading.


Add a comment

* Comments must be approved before being displayed.