i2c and lcd sharing pins?

Hi, I understand that the I2C pins on an Arduino Uno are A4 and A5. Now I already use the A-pins for an 16x2 LCD display, and the layout of my project does not make it easy to change that. Still I would want to attach a RTC clock to the project but only D0 and D1 are free.

Seeing that you can daisychain several I2C shields on those two pins, I wonder if I can share the LCD and the RTC on A4 and A5. Alternatively, is it possible to commandeer the D0 and D1 pins for the RTC?

Paai

hi. i2c has you may notice it's a BUS so your answer is yes, you can connect multiple devices in the same BUS.I2C was born to achieve this :) When you want to talk to a specific device all you need is to call his address on the bus and only that device will reply

i2c has you may notice it's a BUS so your answer is yes, you can connect multiple devices in the same BUS.I2C was born to achieve this :) When you want to talk to a specific device all you need is to call his address on the bus and only that device will reply

But, the LCD is NOT an I2C device using the I2C protocol, so don't expect it to understand using the bus that way.

Could it be that when I address the LCD, the other device, being an I2C device will not react, because it does not see its particular address coming by. But it will react correctly when called by address.

But the LCD will try to interpret any signals on those two pins and therefore will also react on signals meant for the I2C.

The I2C being a RTC, it will almost always be read, not written to. The LCD on the other hand, will have data written to it, not read.

Therefore I would expect the two devices being able to share two pins. But I am reluctant to try it, because I would not want to fry any or all three of those devices (arduino, LCD and RTC).

paai

My mistake somehow I was thinking your LCD was using i2c.(I don't read your post correctly). Maybe you can convert your LCD to I2C by using a pcf8574a to drive your LCD and release all those pins on the mcu. http://tronixstuff.com/2014/09/24/tutorial-serial-pcf8574-backpacks-hd44780-compatible-lcd-modules-arduino/

Nice trick, Hugo. I ordered some and will try. Still, I am curious if they will share the two I2C pins as I reasoned in my earlier post.

paai

Cool you did that.

Therefore I would expect the two devices being able to share two pins. But I am reluctant to try it, because I would not want to fry any or all three of those devices (arduino, LCD and RTC).

If you try this I think nothing bad will happen to your device since the voltage level is still the same.Although your LCD maybe still work but your i2c device will not work for sure.When you start to talk with your i2c device calling his address on the bus it will mess all the LCD.So don't even wast your time because at the end of story it will not work. Maybe you should see this it will help you see what is under the hood of i2c. https://www.youtube.com/watch?v=7yRoR7w82SA