Multiple I2C buses notes

Viewed 13 times

I have tried to look in various foruns but couldn’t find the solution for my problem. I’m trying to build a project where I have to use three VEML6070 sensors… These sensors obviously use the same address.

Hardware: Raspeberry PI2 (I have one RPI3 and RPIZero that I could use) Linux 4.19.85-1-ARCH #1 SMP PREEMPT armv7l GNU/Linux

Any help will be very much appreciated.


dtoverlay=i2c-gpio,bus=5,i2c_gpio_delay_us=1,i2c_gpio_sda=20,i2c_gpio_scl=21 dtoverlay=i2c-gpio,bus=4,i2c_gpio_delay_us=1,i2c_gpio_sda=23,i2c_gpio_scl=24

The result from i2cdetect -l is this:

i2c-3 unknown 3.i2c

i2c-1 unknown bcm2835 I2C adapter

i2c-4 unknown 4.i2c

i2c-5 unknown 5.i2c

I have this Python example: I replace i2cX with 3, 4 and 5 and the result is the same

import time

import busio

import board

import adafruit_veml6070

i2c5 = busio.I2C(board.SCL, board.SDA)

uv = adafruit_veml6070.VEML6070(i2c5)


How can I do this with multiplexing in python? At this point I just don’t know if i2c5 = busio.I2C(board.SCL, board.SDA) or i2c3 = busio.I2C(board.SCL, board.SDA) or whatever makes sense.

 New contributor
  • Sorry, just tried to descriebe my problem the best and completely way that I can – Eddygrinder 1 hour ago
  • Hi @ddygrinder, Welcome and nice to meet you. To get around multiple I2C devices same address problem, there are two general methods (a) hardware multiplexer, (b) multiple I2C buses. I have tried (a) and found it OK. For (b) it is NOT stable for Rpi3B+, though many guys claim it works, but NO ONE gave any details, not even raspbian version and date. I wasted perhaps 20 hours and finally gave up. I suspect that it works only for some os releases, … – tlfong01 29 mins ago   
  • But for Rpi4B, Rpi official docs says it is OK, I tried it and found I can set up I2c buses 1, 3, 4, 5, 6, but I can only use 4 buses at most, and only 2 or at most 3 are stable. I am still playing with I2C ADXL345 accelerator these days and found at least two buses are stable. You might like to look at my test results and feel free to ask me any newbie questions! 🙂 This is my penzu diary on I2C: penzu.com/p/e072f2ae. – tlfong01 26 mins ago   
  • One more thing, you seem to be using Arch and not Raspbian, no wonder your dtoverlay syntax is different from my raspbian. I have not tried recent debian, ubuntu or arch, though I from time to time read their man pages. – tlfong01 14 mins ago   
  • And you seem to be using AdaFruit’s REPL Circuit Python/MciroPython which is NOT compatible to Rpi buster. As far as I know you cannot install Ciruit Python in buster but only a REPL app. I once tried MicroPython in my PyBoard and also BBC microBit using REPL and Mu editor. There is a Mu editor in Rpi4B buster, but seems not mature. Rpi4B buster Thonny Python 3.7.3 is much faster.So I don’t recommend to go deeper into CircuitPython. – tlfong01 52 secs ago    Edit   

Categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: