How do I address 2 LCD screens at same time?

Hi guys, I need some help figuring out how to address a second LCD screen, and how it should be addressed properly using the I2C structure.

I have a project that is currently working perfectly with one LCD screen, ok as good as I can code it and still compile and do what I expected of it. However, as I mentally look at the project, I would like to add a second LCD to the build.

My idea is to have LCD1 print out project name, contact number and give the digital time, updated every cycle while LCD2 would have the digital outputs of my sensor package. Specifically, DH11, Digital PH, and Digital Soil Moisture sensor package.

I currently have 1 LCD that shows the first info at boot up, and then changes to show the steady output of the sensors. This works fine for testing, but if I would like to add a second display to split this.

Is there an easy way to address 2 LCDs of the 24x4 flavor to do this? I know how to clear, add new info, pause for a few seconds, clear and then show the first info. Ie scrolling, but I dont want to build in a bunch of delays. I want two screens with two sets of fixed outputs.

I can daisy chain the 20x4 I2C units, but I don't know how to bifurcate and designate LCD1 from LCD2.

Any advice would be greatly appreciated.

Is there an I2C address jumper on the LCD's? What's the datasheet say? Or at least tell us what you're using so somebody could look it up.

Sorry about the lack of details:

I am using the following connections.

Mega256 with V2 Sensor shield. I have attached the LCD screen to it via 4 wires (2 data +2 power)

Currently, 1 x (20x4 LCD screen) with "J204A" stamped into the back. These appear to be standard models. I have multi of these units. They all have a I2C 4 pin with 2 pin LED connector shorted in the back. There is the following lettering. YwRobot Arduino LCM1602 V1 mini board added to the back of the primary LCD unit. This is where I attach it to the sensor shield.

In my code I access it via...

// include the library code:
#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
#include <dht11.h>
#include <Time.h>
#include <DS1307RTC.h>
dht11 DHT11;
#include <SD.h>
#define I2C_ADDR    0x27  // Define I2C Address where the PCF8574A is
#define BACKLIGHT_PIN     3
#define En_pin  2
#define Rw_pin  1
#define Rs_pin  0
#define D4_pin  4
#define D5_pin  5
#define D6_pin  6
#define D7_pin  7
const int chipSelect = 53;
int n = 1;

LiquidCrystal_I2C	lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);
#define PHADDRESS 0x4D

The more I think about this, the less I think it is possible. How do you change the address on the LCD screen to a different address? So LCD1 can ignore LCD2 traffic. I might be able to use the Mega and connect to a 16x2 and address it separately. That seems doable.

Use an I2C mux and control which one gets commands.
Example:

The pcf 8574 has three pins A0/A1/A2 which can set up to 8 i2c addresses.

Address Reference
INPUTS
I2C BUS SLAVE ADDRESS
A2 A1 A0
L L L 32 (decimal), 20 (hexadecimal)
L L H 33 (decimal), 21 (hexadecimal)
L H L 34 (decimal), 22 (hexadecimal)
L H H 35 (decimal), 23 (hexadecimal)
H L L 36 (decimal), 24 (hexadecimal)
H L H 37 (decimal), 25 (hexadecimal)
H H L 38 (decimal), 26 (hexadecimal)
H H H 39 (decimal), 27 (hexadecimal)

Unfortunately, the YRobot i2c board does not break these out for easy configuration. With you present address of 0x27 they are all connected high to Vdd. You may be able to clip or unsolder a pin from the chip and tie it to ground to get a second address.

Otherwise, you are looking for a second display with a different address, or use the mux suggested by Crossroads.

1 Like

So far you have,

  • change iC2 address of one LCD
    Or-buy another LCD in which you can change address,
    Or- use a mux
    Or another option, use some transistors as switches on the data line to each LCD.
    Using another GPIO you can have it select one LCD or the other by masking or passing through the data.

Thank you Cross Roads, cattle dog and Rcorr...

I needed this kind of feed back to make a decision on this. Based on this design of tech, I need to add delays to flip data, or add cost to parse LCDs. While the cost is insignificant in a single build design. It adds complexity and cost to a multi hundred production run beta test.

cattle dog, thanks for the info on the LCD and the reality of connection...

Rcorr, thanks for adding to the convo.

Best,

Jack

I need to add delays to flip data

This is not correct. Using the millis() based timer techniques of "blink without delay" and setting flags to trigger actions you can create routines to cycle through multi screen displays without using delays. What do you want to display on the screens, and for how long?

If you really are considering production, and definitely want multiple lcd's, there are plenty of pcf 8574 i2c interface boards available with A0/A1/A2 readily accessible so that the address can be modified. That particular YRobot board is unusual in not giving access to the address lines.