Pages: [1]   Go Down
Author Topic: One LCD and two Arduinos - how?  (Read 606 times)
0 Members and 1 Guest are viewing this topic.
Louisiana, USA
Offline Offline
Jr. Member
**
Karma: 0
Posts: 50
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged


Western New York, USA
Offline Offline
Faraday Member
**
Karma: 41
Posts: 4435
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.


Don
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 76
Posts: 7305
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged


Louisiana, USA
Offline Offline
Jr. Member
**
Karma: 0
Posts: 50
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged


UK
Offline Offline
Sr. Member
****
Karma: 7
Posts: 436
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 76
Posts: 7305
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged


Dallas, TX USA
Offline Offline
Faraday Member
**
Karma: 70
Posts: 2765
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
http://emartee.com/product/42059/Arduino%20Tiny%20RTC%20DS1307%20Shield%20V2.0

--- bill
Logged

Pages: [1]   Go Up
Jump to: