Go Down

Topic: One LCD and two Arduinos - how? (Read 770 times) previous topic - next topic


I have a DFRobot serial LCD.  I've got it working fine with one Arduino.

I'm assuming I can add another Arduino to the i2c bus, and can then write to the LCD from either Arduino.  Does anyone know how I need to configure the second Arduino to make this happen?  I scanned through the LiquidCrystal_i2c files, and didn't see this referenced.  In the one-Arduino setup, I am using lcd.print() to write to the LCD.  In a multiple Arduino setup, would you have to use the wire.write() function instead? 

I thought using more than one Arduino with the LCD would be easy, but now I'm getting pretty confused.  Anyone done this before?  The more I think about it, I'm starting to doubt it can be done.


I2C systems consist of devices called, in general terms, 'masters' and 'slaves'.  In our case the Arduino is the master and the LCD is the slave.  It is not uncommon to have systems with multiple slaves but systems with multiple masters, which is what you are proposing, are another story.

It is not impossible to do this, but the logic to do so is more complicated and is not (to my knowledge) incorporated in the libraries currently available. 

So the bottom line is --- It can be done, but not easily.



Let me answer your question with another question: what exactly are you trying to do with 2 arduinos and 1 LCD? Knowing the project is always helpful. It is like doctors always ask what you ate, drank did feel etc. besides what immediate ailment you have.


There's no particular project, it was just something I was trying to do to teach myself about i2c.

I guess the best way to accomplish something like that would be to setup a serial connection between the two Arduinos, then just pass the message to be printed to the LCD over that connection.


Can you not have a Master Arduino connected to the LCD and then your slave Arduino can send messages to the master Arduino to display on the screen?


Can you not have a Master Arduino connected to the LCD and then your slave Arduino can send messages to the master Arduino to display on the screen?

That would work. As long as you have only one entity taking control of who talks on a bus, you are fine. In the ethernet situation, everyone talks but they all have collision detection and random resume after collision. It's much harder to implement and needs hardware support.


If the goal is to learn about i2c
I would think that it would be much more useful to use 1 master and multiple slaves.
Which is a much more normal situation and is already supported by
the Arduino libraries.

So add another slave to the bus, like a realtime clock chip.
They are cheap.
You can also look at a i2c eeprom.

There are some pre-built RTC modules that have both a clock and
an eeprom on it.

This one has a i2c RTC an i2c eeprom and a 1 wire temperature chip:

--- bill

Go Up