How to work with multiple i2c devices?

I have various Pimoroni i2c breakouts. Individually they all work, however, I’m unable to get multiple devices to work at the same time.

For example, I’ve connected up a BME280 and a 1.12 OLED. They appear using i2cdetect, but whilst one or the other device is connected, they won’t work.

pi@zeropi:~ $ sudo i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                         -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- 3c -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- 76 --                         
pi@zeropi:~ $ cd luma.examples/examples/
pi@zeropi:~/luma.examples/examples $ python3 maze.py --display sh1106 --height 128 --rotate 2 --interface i2c
usage: maze.py ... snip ...
maze.py: error: I2C device not found on address: 0x3C
pi@zeropi:~/luma.examples/examples $ 

I’m using a Pi Zero with an Adafruit Protobonnet where I’ve added some headers and connected to the breakout via ribbon cables (jumper jerky). Both are powered via 5V. I wondered if the cable might have an influence so I crimped one to 1/3 of the size and connected the display directly but the problem still persists.

Any ideas what I might be doing wrong?

I’ve run multiple i2c devices / breakouts multiple times with no issues. And done it the same way your doing it.

My best guess is its a soldering issue. I’ve had no issues running the examples on a single device with the others hooked up at the same time. It’s how I test them one by one.
When I’m using multiple i2c devices at the same time, I do it all from the one python file. If you don’t you will get i2c errors, they have to take turns using the bus.

Thanks for the response. I would have assumed if that was the case, they wouldn’t be listed in i2cdetect or work when other devices are not connected. My multimeter says 0.2-0.4 Ohm for the resistance from pin to the header and 0.7-0.8 Ohm to the device over the ribbon cable (which I now realize probably isn’t very accurate as it’s reading the same just to touch the probes together).

I’d assumed that examples that work independently should work when the other devices are plugged in.

Yeah, it is very confusing? i2c detect is seeing them but your getting i2c errors when running code?
And yes, the examples should work even with another device on the bus. I do it all the time. As long as no two devices have the same i2c address it should be fine.
Just so you know, I haven’t ever used an i2c driven display. The ones I use are SPI. I do use a lot of BME280’s and BME680’s. And RV3028 RTC’s and LTR-599 etc.

Yeah, this is going to be my workaround for now. I have an SPI one. I wonder if it’s to do with it being a Raspberry Pi Zero. I feel like I’ve had this problem before with an ADC and other displays.

I have a couple of Pi Zero setups with multiple i2c breakouts connected, plus two or three SPI displays that work just fine. I don’t think its a Pi Zero issue.
I go with SPI displays because I want color, as apposed to just black and white.


Weird, this configuration works. It seems like the bottom two headers are the problem. Maybe cross talk.

I’m baffled as to what’s going wrong?


No idea either. I had a spare Proto Bonnet and decided to lay it out again. This new layout works!

I think I just spotted something that may have to do with it. It’s somethinmg to watch out for anyway.
On the Proto Bonnet the +5V rail changes to +3V about a third of the way across. You have some devices using 5V and some using 3V for power. The Pimoroni breakouts can use either, others might not be so tolerant.
On the Proto Hat the 5V and 3V are two separate rows of solder pads.

1 Like

This is why I decided to wire all the headers on the left-hand side in my first version - they all got 5V for no particular reason. The 3 pin headers do need 5V - the red wire is the last of the 5V rail.

After seeing your device, I decided to do the headers in more of a row.

The other devices can operate with either. The device off-screen is the OLED display with a supply voltage of 3V-6V on the right is an AltIMU-10 with a specified supply voltage of 2.5V - 5.5V

The Pimoroni Breakout Garden Hats use 3.3v so that’s what I try to use. My only exception, and I only just remembered it, was with my Color LCD SPI Breakouts. I have three wired up to SPI1 and weird things were happening. They worked just not every time. Sometimes they wouldn’t initialize correctly. Had me scratching my head for a while thinking it was my code. Switched them over to 5V and no more issues. Best guess was I was close to the Pi’s current limit for the 3.3V bus.