LCD and RTC clock module

Hello,

I want to use an LCD and an RTC clock module on Arduino Nano, but the Nano has just one SDA and one SCL, will it work if I connect both I2c devices to the same SDA and SCL pins of the Arduino?

Yes but make sure all parts use the same logic level voltage.
I2C is a bus defined ages ago and used to handle just multiple things. Else the old RS232 would be good enough.
Google on I2C!

Yes, I2C is a bus and as long as the devices have different addresses they will work*

*sometimes the pull-up resistors can cause issues, but we can help if this happens.

Thank you. As I was searching on the web, someone said that you need to connect some resistors from SDA and SCL to 5v if you use two devices on I2c in the same time. Is that true?

But here I don't see saying anything about resistors: https://arduinogetstarted.com/faq/how-to-connect-multiple-i2c-sensors-devices-with-arduino

Pullup resistors on the SDA and SCL lines are required. Many modules with the I2C interface come with pullup resistors on the module board. There needs to be only 1 pullup for the SDA line and one pullup for the SCL line (usually 4.7KΩ). If 2 or more modules are put onto the bus that can mean that there are multiple pullup resistors in parallel. Parallel resistors reduce the total pullup resistance. If the pullup resistance gets too low the line can't be driven LOW so I2C won't work. 2 or maybe 3 modules are probably OK, but the pullup resistance total should be calculated and resistors removed if the total is too low (less than about 2KΩ).

There's a lot of crap out there. Use datasheets, technical institutions etc.
Some I2C devices have built in pullups. Check that up! Too much pullup makes trouble as well as too litle.

Now I'm confused, so for example to connect an LCD 16x2 on I2c with an RTC module like this:


Do I need resistors?

Why confused? You were told what to do. Look up the specs on the devices you're using, such as the RTC above, and see whether it has resistors, and what the values are.

e.g. this came right from a forum post...
image

Ok, thank you. Do the usual 16x2 LCD screens have resistors? I just began to learn Arduino so schematics and technical information are not familiar to me.

Look at the schematic.

That isn't what I meant. I meant, you need to learn to find information without assistance. If you then need explanations of that information, it's what we're here for.

I know how to connect an LCD and an RTC module independently, but I don't know fi they would work together on the same I2C or not.

No. the pullup resistors are installed on the RTC module.
The LCD I2C backpack should have pullup resistors as well.

Just 2 devices that have pullup will very likely not be a problem. The RTC module has 4.7K pullups. Assume the same for the LCD backpack so the total is 2350Ω on each line, probably acceptable. If you were to add a third module that has 4.7KΩ pullups installed the parallel resistance would be 1567Ω and you would need to think about removing resistors from one or more boards.

In reference to that RTC module. Is that the one that you have? If you are going to use a non-rechargeable backup battery, read this page.

2 Likes

If you also have pull up resistors on the MCU board, then you are pushing it because the resistance could be about 4.7k/3.

With such interfaces, it's your responsibility to find the technical information and evaluate the outcome. These devices are not plug and play.

Thank you so much groundFungus, now I finally get the answer! :hugs:
That is not the module I have, I haven't bought one yet, I'm looking for a better quality one, but unfortunately, there isn't a website that is rating the electronic components, but I heard that components from Adafruit, SparkFun, and DF Robot are little better than the Chinese ones. Any recommendation for a certain brand?

Not entirely, because it is generic advice. It's not an answer until you do the research and determine the actual characteristics of each module.

There do exist modules with no pull up resistors, they would not work with the Nano unless the LCD does. If that happened to you, would you know what was going on, or tear your hair out?

Note that so far, you have not identified specific modules other than the Nano...

They are all the same Chinese-made modules. The named dealers however, may implement actual quality control.

Referring to the backpack used


you will note two 4k7 resistors to the lower left of the chip. These are the I²C pull-ups. If you connect multiple such modules to the I²C bus, you remove these resistors from all but one or two modules.

That is the entire purpose of the I²C bus, the only limitation is that they each need to have a different I²C address.

Most Arduinos do not. I think the Mega 2560 and a couple of others do, but not any board using the ATmega328 as the I²C pins have other alternate uses.

1 Like

Right, I'm running an RTC and 4 I2C displays together, I removed resistors from 3 of the display modules.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.