I2C with two devices (pull-up resistors)

Hi everyone! Software engineer here, looking to get into electronics. I am using Stanley Huang's OBD2 Logger device. I would like to improve it by adding a RealTime Clock module. To do this, I am going to use a Data Logging Shield.

Here's my question: both the RTC and LCD are I2C devices. I want to hook them both up to A4 and A5. Do I need pull-up resistors for this?

Do I need pull-up resistors for this?

Yes, you need them if you only had one device.

Grumpy_Mike:

Do I need pull-up resistors for this?

Yes, you need them if you only had one device.

Thanks for the answer. I'm a little confused because the LCD works by itself on an Arduino Nano without any additional resistors.

LogicalUnit: ... Thanks for the answer. I'm a little confused because the LCD works by itself on an Arduino Nano without any additional resistors.

i think it's using the internal resistors. I2C always has to have ONE pair of resistors for the SCL & SDA lines, that is for ALL devices on the bus.

It will function with just the internal pull up resistors but it needs external ones to work correctly. Without it is just on the edge of failing. If any device on the bus has external resistors then that will do for the whole bus so check what you have.

Can you provide any more detail on how to solder the pull-ups? Maybe a diagram?

LogicalUnit: Can you provide any more detail on how to solder the pull-ups? Maybe a diagram?

Well one end of a 4K7 resistor is attached to A4 and the other end to +5V. Then take another 4K7 resistor and solder one end to A5 and the other to +5V.

Grumpy_Mike:

LogicalUnit: Can you provide any more detail on how to solder the pull-ups? Maybe a diagram?

Well one end of a 4K7 resistor is attached to A4 and the other end to +5V. Then take another 4K7 resistor and solder one end to A5 and the other to +5V.

Lovely, thank you! :)

I just had a thought: the RTC module is 5V, but the OLED is 3V3. Will this be a problem?

LogicalUnit: I just had a thought: the RTC module is 5V, but the OLED is 3V3. Will this be a problem?

Yes it will. You need to use bi-directional logic level converters on the lower voltage device.

Grumpy_Mike: ... ... You need to use bi-directional logic level converters on the lower voltage device.

i've seen another thread that mentions more than one set of resistors on the I2C bus because of different voltage levels. would that be bad practice, and converting everything to one voltage level be the proper way to go ?

am now just wondering if maybe use the 3.3 V as the logic level and then add resistors to the SCL & SDA pins of the 5V devices to "equate" them to 5V ? (or is that back to front ?) sorry if that sounds like EE nonsense - i've never seen a full circuit of which the I2C bus is a part, and can't envision how the pull-up resistor works in the whole scheme of things.

sorry if that sounds like EE nonsense

Apologies accepted, yes it is nonsense. The I2C bus works by a device pulling the lines down to zero volts. A device releases the line and the resistor pulls it up. The point being that if the resistor pulls it up too high, that is above the voltage supply of a device the the device can break down and be damaged. So the voltage you pull up to can cause damage if it is too high.

This page shows you the effect of not having good enough pull ups. http://www.dsscircuits.com/index.php/articles/47-effects-of-varying-i2c-pull-up-resistors

wow, thanks so much Mike - that’s a beautiful article !! (looking at the comments section, it has to be one of the Gems of the internet !)
i actually found myself starting to understand a lot more about EE and what Oscilloscopes do.

so; to confirm my understanding about the various devices on the I2C bus; it’s all about capacitance of the bus itself, and not matching resistance for each device to reach a particular voltage.
(i’ll try to make some sketch of what this blurry overall circuit in my n00b mind looks like which is leading me to this nonsense EE thinking)

in otherwords, an I2C bus will ever only need ONE pair of pull-up resistors, and any circuit with more than one is also nonsense.

in otherwords, an I2C bus will ever only need ONE pair of pull-up resistors, and any circuit with more than one is also nonsense.

Yes you got it :)