Two arduino one LCD

Is it possible to connect two Arduino'shift to one I2c LCD so that they can both post information to the LCD?

Don't know what you mean by 'shift', but the answer is yes, IF, you can figure out how to arbitrate which one gets the LCD when........

Both arduinos can act as I2C masters. You may want to have a way of indicating whether the LCD is being used. This scenario: Both are hooked up to the I2C LCD. Arduino 1 has a pin say D2 set up as output and is held LOW. Arduino 2 has a pin say D3 set up as input and connected to Arduino 1's D2. Vice versa. When Arduino 1 wants to use the display, it first senses whether its D3 reads HIGH, meaning Arduino 2 is using the LCD. If not, it sets its own D2 to HIGH, indicating it is going to use the LCD. Then go ahead using the LCD. Afterward, set D2 to LOW. The other Arduino does the same.

Like the idea. Thanks liudr

That is not a reliable way. Arduino A checks and sees that the bus is free. Before it can indicate that the bus is in use, Arduino B checks and sees that the bus is free. As a result both will take the bus.

The 328 micro (e.g. Uno) supports multimaster in hardware. Only one will 'win' when both transmit and the other one will stop transmitting. I don't know if there is any indication in the library that indicates that the Arduino has 'lost' the battle for the bus.

If you use a couple of pins to handshake there is always the chance of a race condition as Sterretje says.

Using some external hardware like an SRFF (Set/reset flip flop) is more reliable.

LCD display is not time sensitive. There is no need to multiplex the display this way, just have one processor drive the display, and have the other one pass the information to it by some other means.

aarg: LCD display is not time sensitive. There is no need to multiplex the display this way, just have one processor drive the display, and have the other one pass the information to it by some other means.

And the point is that you do not want two Arduinos to control the LCD as that would imply that the data sent from the two would be mixed together on the display - clearly it would be garbled.

If you really wanted two alternative controllers to access the LCD, you would need a full two-way handshake (by some means - handshake lines or serial commands). This means that one sends a "request" to the other which then replies with a (new) "ACK" or "NAK" (which incidentally exist as defined ASCII control codes). Only when the other responds with an ACK, possibly clearing the display in the process, may the first one proceed to use the resource - in this case the display - and desirably when finished, send a clearing signal.

sterretje: That is not a reliable way. Arduino A checks and sees that the bus is free. Before it can indicate that the bus is in use, Arduino B checks and sees that the bus is free. As a result both will take the bus.

The 328 micro (e.g. Uno) supports multimaster in hardware. Only one will 'win' when both transmit and the other one will stop transmitting. I don't know if there is any indication in the library that indicates that the Arduino has 'lost' the battle for the bus.

Yes, at a very rare instance. And Arduino doesn't support multip I2C master in software. Look for a more robust way or settle with less robust, it's anyone's choice. If the information absolutely can't be lost, find an arduino MEGA with 4 serial ports and let the first two send to it via serial. Then the third arduino decides which port has complete information and displays it. No hand shake, completely async.

liudr: And Arduino doesn't support multip I2C master in software.

Are you talking about the Wire library? I just spend some (probably a bit more ;) ) time digging through it and it seems to handle the arbitration. I did not do this to prove you wrong but for myself so I know.

I found the use of a couple of xxx_ARB_LOST_yyy constants in the ISR in twi.c. One of them being TW_MT_ARB_LOST which is used when a master loses the arbitration during transmit or receive.

I've only looked at master transmission. When the master looses arbitration, the bus is 'released' and the master will not continue transmitting. Wire.endTransmission will return 4 (return value of twi_writeTo) to indicate a 'generic' error and the master Arduino can try again if needed.

If I'm wrong, somebody please correct me. I like to know those things.

123Splat:
Don’t know what you mean by ‘shift’, but the answer is yes, IF, you can figure out how to arbitrate which one gets the LCD when…

It should have read “two arduino’s” but auto correct on my phone changed it to Shift!