I have two arduinos intercepting events. They have to deliver these events to a raspberry pi. According to my understanding of the I2C protocol, the RPi must be configured as slave, and the two arduinos as masters. Now, the problems are the following:

  1. it is my understanding that RPi cannot be used as a I2C slave. See here, and here but these posts are old. Is it still like this in the latest RPi kernel?
  2. Since I have to receive events from two masters, how would that work? specifically:
    • what happens if the two masters transmit on the same bus at the same time?
    • coding wise, how is the raspberry pi going to listen to these events? can it differentiate the two masters as two independent origins? Or should I have two independent I2C buses?
    • how can the RPi react to events. Can I register a handler, or should I read in blocking mode and have two threads (one per each bus) or one thread (if one bus) wait for something to come in?
    • Considering my use case, would SPI be better?


  • Rpi4B can do 2 to 4 I2C buses. So using 2 buses is a cleaner I2C solution. Rpi4B can also do more than two SPI buses, with two CS or more (DIY). Xnono can interrupt Rpi using Rpi GPIO pins. I usually recommend Xnono to interrupt Rpi's I2C/SPI MCP230/s08/17's GPIO pins. MCPxyz way is more flexible. PS -As I know Rpi4B buster I2C is still master mode only.
    – tlfong01
    Sep 3, 2019 at 3:52

1 Answer 1


There can only be one I2C bus master (except in circumstances which do not apply here).

There is no Pi kernel support for it to act as an I2C slave.

If using I2C the simplest solution (from the information provided to date) is for the Pi to be I2C master and for the Arduinos to be I2C slaves.

The Arduinos could signal the Pi when they have data available. The Pi could then use I2C to read the slaves.

A simple signal would be to use a Pi GPIO per Arduino set as an input at the Pi end and an output at the Arduino end. The Arduino could then toggle the GPIO to signal the availability of data.

  • So basically each arduino has an interrupt line and the Pi reacts to it. Would SPI or UART be better as a solution? Sep 3, 2019 at 19:52
  • 2
    SPI would be the same problem (with the same solution). The Pi can only act as the master. Standard serial (UART) only supports single point to single point.
    – joan
    Sep 3, 2019 at 20:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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