2

Is it possible to set up 8 (eight) I2C buses on a Raspberry Pi?

I've been looking at software I2C using NodeJS but I am still unsure of if that's a good library.

Give me tips.

Backstory: I'm developing software that communicates with an early 90's system that uses I2C.

The system consists of an early 90's DOS PC and 8 groups of 9 devices connected to a single I2C bus per group.

Edit: Addresses of each fader in a group range from 0x41 to 0x49. That means that there are 8 devices with the same address on the whole system, none of them share the same i2c bus.

For you that are interested: The system is an old fader automation system for music studios. The company that made this system, Uptown Automation Systems, was acquired by API in 1995 or so.

The studio I'm working in the Uptown Automation Systems fader system installed and we plan on keeping it, but I've been given the task to upgrade it because I said "I can upgrade that for you".

  • have you considered as an alternative the i2c-mux option with one of these adafruit.com/product/2717 – Jaromanda X Apr 25 '19 at 2:22
  • by the way, the nodejs library has nothing to do with software i2c. The documenation refers to the stock standard raspbian overlay you can use to set up software i2c, which is totally independent of that node library – Jaromanda X Apr 25 '19 at 2:29
  • @JaromandaX the i2c-mux looks exactly like something I'd like to try. But the question is why add another component if si2c would do the job? I see, so si2c is "built in" to raspbian, sort of? I can assume that the NodeJS library will be the solution to my problem. Correct me if I'm wrong. – vaid Apr 25 '19 at 3:30
  • the nodejs library you linked to is simply a nodejs library for i2c, it's not platform specific anyway (it can be used in C.H.I.P., BeagleBone or Intel Edison, nt just the pi) - you could use c, python, or any other language you're familiar with – Jaromanda X Apr 25 '19 at 3:56
  • I just have one big problem with the NodeJS library though. It doesn't say which pins to use when opening a bus. – vaid Apr 25 '19 at 4:53
1

Question

Is it possible to set up 8 I2C buses on a Raspberry Pi?

Answer

But one I2C bus can already entertain many devices.

For example I am using a GPIO expander called MCP23017. You can place 8 such devices on a single I2C channel, on condition that your connecting wires are very short, much less than 15cm, and use low speed, 100kHz.

But I want more than 8 MCP23017, so I demultiplex the Rpi I2C channel to 3 or more channels, using a logical level converter module called TSX0104. I actually use this logical level converter to demux not only I2C, but also SPI, and UART.

You may like to look at my setup below, with 3 I2C channel and 4 SPI channels.

PS - I am using very long I2C and SPI cables, much longer than 1m. The I2C communication even at 100kHz, is intermittently unstable, even I am using I2C repeater, buffers etc.

Intermittent hardware bugs are very difficult to troubleshoot. So I am using a couple of channels with identical devices just to do SWPP/PAIR troubleshooting. In short, if you only need say 32 GPIOs, then one I2C channel with 2 GPIO expanders is a good start. More than that the complexity grows exponentially! (Look at the scary spaghetti mess at the top, which is only 4 demux SPI channels (but SPI are much more stable than I2C).

i2c demux

Update2019apr25hkt1141

And for devices with fixed I2C addresses, I use TCA9548A 1 to 8 demux module. I tried 4 channels and found it OK.

Ultra-cool TCA9548A 1-to-8 I2C multiplexer!

You just found the perfect I2C sensor, and you want to wire up two or three or more of them to your Arduino when you realize "Uh oh, this chip has a fixed I2C address, and from what I know about I2C, you cannot have two devices with the same address on the same SDA/SCL pins!" Are you out of luck? You would be, if you didn't have this ultra-cool TCA9548A 1-to-8 I2C multiplexer! - Lady Ada

TCA9548

| improve this answer | |
  • I forgot to mention that the system contains up to 8 devices with the same address on the system, however they do not exist in the same i2c bus, hence "grouping" using several i2c buses. – vaid Apr 25 '19 at 3:35
  • I see. Lady Ada has a good news for you! :) See my update. – tlfong01 Apr 25 '19 at 3:51
  • @tlfong01 - I'm not Lady Ada, and I posted a link to that an hour ago :D – Jaromanda X Apr 25 '19 at 3:58
  • @Jaromanda X I am sorry. I did not read your reply before I answer. Next time I will be more careful. My apologies. – tlfong01 Apr 25 '19 at 4:04
  • @tlfong01 - I was joking :p All good to put that in an answer – Jaromanda X Apr 25 '19 at 4:06
0

Here is a discussion about configuring I2C on Raspbian. More specifically how to configure 8 I2C buses.

At the bottom is a link to this instructable that will be very handy.

| improve this answer | |
  • Yes, your references are good. They are about using (1) the second I2C channel, and (2) software bit bang I2C, using dt overlays etc. The problem with the first method is that you cannot use Camera and second I2C at the same time. For the dt overlay method, problem is that it is not OS version invariant, and usually developed by one guy, who might not update as soon as the OS updates. I am playing with the 2nd I2C, you might like to see my update soon! :) Second I2c bus on RPi 3? raspberrypi.stackexchange.com/questions/96812/… – tlfong01 Apr 25 '19 at 14:55
  • Your question is very relevant to my question and has some important remarks! – vaid Apr 25 '19 at 16:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.