Go Down

Topic: Using multiple identical I2C devices (Read 371 times) previous topic - next topic

Sv443

I wanted to make a project involving multiple independent I2C LCDs, but because I am fairly new to arduino I don't know if that's possible. And if it is, how do I call the different LCDs separately?

AWOL

Simplest way is to use one of the common eight bit I2C I/O extenders connected to a standard 4/8 bit LCDs.
The extender allows eight different addresses, IIRC.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.
I speak for myself, not Arduino.

Wawa

Most (not all) I2C backpacks have three address solder bridges.
That enables you to set eight different addresses, so eight LCDs can exist on the same I2C bus.
Leo..

Sv443

Most (not all) I2C backpacks have three address solder bridges.
That enables you to set eight different addresses, so eight LCDs can exist on the same I2C bus.
Leo..
So if I for example use this LCD (https://goo.gl/yGvj75) do I just short the J1 or J2 jumper on the second image accordingly?

Sv443

Simplest way is to use one of the common eight bit I2C I/O extenders connected to a standard 4/8 bit LCDs.
The extender allows eight different addresses, IIRC.
Thank you, but if this works, it will be much simpler for me:

Most (not all) I2C backpacks have three address solder bridges.
That enables you to set eight different addresses, so eight LCDs can exist on the same I2C bus.
Leo..
But if I do short the jumpers how do I then call the different LCDs in the coding?

Wawa

#5
Dec 06, 2017, 11:29 pm Last Edit: Dec 06, 2017, 11:57 pm by Wawa
But if I do short the jumpers how do I then call the different LCDs in the coding?
Never done this, but I suppose you could name your LCDs not "lcd", but e.g. "lcd_0"  "lcd_1" etc.

LiquidCrystal_PCF8574 lcd_0(0x20); // #1 LCD with address 0x20 (all bridges closed)
// six more here
LiquidCrystal_PCF8574 lcd_7(0x27); // #8 LCD with addess 0x27 (all bridges open)

lcd_0.begin(16, 2);
lcd_1.begin(16, 2);
etc.

lcd_0.print("Hello world"); // print to the first LCD

I suppose you know the limitations of standard I2C (3mA/400pF).
Don't know how far away you want these LCDs from the Arduino.
Leo..

Sv443

Never done this, but I suppose you could name your LCDs not "lcd", but e.g. "lcd_0"  "lcd_1" etc.

LiquidCrystal_PCF8574 lcd_0(0x20); // #1 LCD with address 0x20 (all bridges closed)
// six more here
LiquidCrystal_PCF8574 lcd_7(0x27); // #8 LCD with addess 0x27 (all bridges open)

lcd_0.begin(16, 2);
lcd_1.begin(16, 2);
etc.

lcd_0.print("Hello world"); // print to the first LCD

I suppose you know the limitations of standard I2C (3mA/400pF).
Don't know how far away you want these LCDs from the Arduino.
Leo..

Thanks, I'll try as soon as I get the LCDs. I only want to use them for a distance of around 1m, so I think that should be fine.

Wawa

Thanks, I'll try as soon as I get the LCDs. I only want to use them for a distance of around 1m, so I think that should be fine.
It depends.
On the type of wire, and on the total wire length.
Cat-6 (or 5), with one pair for clock/ground and one pair for data/ground, with the remaining wires for 5volt/ground works for me.
Make sure total pull up resistance is within specs.
Leo..
 

wvmarle

Check on the I2C pull-up resistors as well. 10k is not enough for that. The I2C backpacks may have pull-up resistors included, if so it's usually 10k each, in which case you end up at 1k25 effective resistance.
If no pull-ups in place yet, go for 1-2k resistors (1k is minimum, with that much wiring and eight screens I'd go for the low end).
Remember to power your screens directly from a 5V power supply, not from the Arduino. With backlight each will draw at the very least 20 mA so that's 160 mA between the eight of them - and could be quite a bit more. Too much for an Arduino to supply.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

Go Up