Hooking up 2 I2C devices?

I have an SSD 1306 and an SHT40. I would love to be able to get both of them to work at the same time. I understand that I can just hook up both SCL and SDA pins to the Photon 2, but is there anything else that I need to make this work? The SSD 1306 library looks like its default address is 0x3C or 0x3D, and the SHT40 seems to be 0x44.

Any tips so that I don't end up melting my SSD 1306, SHT40 or Photon 2 would be most appreciated!

You may want to check the total pull-up resistance of the bus.
When your devices come with their own set of pull-ups each, the individual resistances get connected in parallel (reducing the total resistance) making it ever harder for the devices to actually pull down the bus voltage to signal a valid LOW level.

With only two devices this shouldn't be too much of a concern, but worth to keep in mind.

In case the pull-up gets too strong, you may need to remove some of the on-board resistors from the equation.

1 Like

Just adding to @ScruffR point about pull-up resistors. The Photon2/P2 is not 5V tolerant on the SDA and SCL pins so you need to ensure also that the connected devices are running at 3V3 to avoid damage to the Photon2. The best way is to power them off of 3V3. If they are 5V devices then you will need a bi-directional level shifter on each line. Adafruit do a 4 way bi-directional level shifter based upon BSS138 FETs.

The SSD1306 and SHT40 both have community libraries.


Thanks, @ScruffR, I'll see if I can figure out the resistances before plugging things in.

You won't damage anything by having too many parallel pull resistors, but it may not work reliably.

The recommended pull-up resistance for I2C is typically 2.2K to 10K. The P2/Photon 2 built-in resistance is 22K. Most breakout boards with pull-up resistors have 10K resistors.

You can use a calculator to calculate the resulting resistance. Hypothetically, 22K, 10K, and 10K in parallel results in 4074 ohms, which is just about perfect.


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