In this post we are going to learn how to connect multiple 16×2 LCD display to Arduino using regular method where we connect lots of wires and also using I2C adapter where we connect just 4 wires.
We will see:
- How to connect multiple LCDs to Arduino using regular method.
- Circuit diagram.
- Example code.
- How to connect multiple LCDs to Arduino using I2C adapter.
- How to change address of I2C adapter module.
- Example code for multiple I2C displays.
You are here because your project uses two or more 16×2 / 16×4 LCD displays to showcase different readings / information etc. and you are scratching your head how to accomplish this, if so you landed on the right place. First let’s see how connect multiple LCDs using regular method where we connect a tons of wires to LCD.
How to Connect Multiple LCDs WITHOUT I2C – Regular method:
As an example we are going to connect two 16×2 LCD displays and these two LCDs operate independently. Connecting multiple LCDs to Arduino are easier than you might think.
The pins: Vcc, GND, Vo, RS, R/W, D4, D5, D6 and D7 are connected in parallel with second LCD. The only pin that must connect independently is EN – enable pin, EN pin helps Arduino to pass data on the intended LCD.
A single 10K potentiometer is used for adjusting contrast of multiple LCDs simultaneously; this is achieved by connecting all the Vo (contrast adj.) pins of all LCDs in parallel with the potentiometer.
How many LCDs Can I connect to Arduino?
The limit for number of LCD depends on how many spare GPIO pins left for EN pins after connecting all other peripherals like sensors, buttons etc. If your Arduino have 5 spare GPIO pins left, you can connect 5 LCDs. If your Arduino Mega left with 20 spare GPIO pins for EN you can connect 20 LCDs which can operate independently.
Now let’s see how to code for multiple LCDs for Arduino.
The above code is just an example how to use two LCDs which can operate independently, you need to add your project’s main functions and if you wish you can also add more LCDs.
How to connect multiple LCD to Arduino using I2C display adapter:
At this point I no need to explain what is I2C LCD adapter module because you already know how to use one and you are here to explore how to use two or more independently and simultaneously.
The problem arises when there is need for a second display and if we wire-up a second display with SCL and SDA bus, we will end up duplicating the display and don’t operate independently.
This is because two of the I2C modules have identical addresses, if you want to operate them independently we need to change address of any one of the two I2C adapter’s address.
How to Change Address of I2C Adapter module?
Fortunately, we can easily change the address of I2C display modules; this is accomplished by bridging two contact points provided on the I2C module with solder.
Here A0, A1 and A2 has nothing to do with analog inputs or outputs, here A stands for address, you can find contact points on several other I2C modules and sensor which has the capability to change address.
By default the address of this module without any bridged contact is “0x27”. By bridging any one or any two or all three will result in change in address.
- By bridging the contacts A0, A1 and A2 individually you will get 3 sets of address.
- By bridging any two contacts at a time: A0 and A1 or A0 and A2 or A1 and A2 will generate another set of 3 addresses.
- By bridging all three contacts will generate one new address and without bridging any contact will generate one address which is default “0x27”.
Now that’s total of 8 different addresses.
Here I bridged A1 and A2; this gave me an address “0x21”. All I need to do is just insert the address in the program code.
How you should NOT bridge the contact:
The A0 or A1 or A2 should not touch each other.
- The LCD 1’s address is default “0x27”.
- The LCD 2’s I2C address is “0x21” by bridging A1 and A2.
The circuit is self-explanatory; just connect all the I2C wires in parallel.
Download I2C library here: github link
I am using the above mentioned library, but you can use any other library.
How to find the address of my I2C adapter?
Now we know that by bridging the given contacts we will get different addresses, but how to know the current address of your I2C adapter? Well, we have made a program which should to be uploaded to Arduino with an I2C module attached on Arduino’s I2C bus and powered ON.
The code will show you the address and the number of connected I2C devices on serial monitor.
Program code I2C scanner:
Address of I2C devices:
You can insert the address shown in your main project code.
How many I2C display can I connect?
You can connect 8 LCDs (max) using I2C adapter. I2C bus can support up to 127 devices but we can only change address from 0x27 to 0x20 – 8 addresses. Rest of the address are reserved for other I2C sensors and peripherals.
Now you know how to interface multiple LCDs on Arduino using conventional and I2C method.
If you have any questions regarding this tutorial, feel free to ask us in the comment. You will get a guaranteed reply from us.