Recently found out that using the pigpio library one can set the raspberry pi to be a slave in a bus setup with an arduino. Someone has even written some test code on the RPi forums which shows that a setup of RPi and arduino can be set as a slave-master. My biggest question now is how to wire them together. I'm using an Arduino Uno which is 5v and the raspberry pi is only 3.3v tolerant. I read that I2C setups usually has a power cable and pull-up resistors connected to the SCL and SDA lines but many pictures do not show these lines. After some brief discussion, I was told to setup something similar to the explanations.

I'm wondering if the schematic and my understanding are correct for setting up the I2C connection between the RPI and Arduino. Attached below is the picture of the schematic.

edit: Updated my schematic to use the correct pin layout

enter image description here

  • Hojo. This is so unusual! I usually think of the Pi mastering the Arduino, not the other way around. What problem does this design solve?
    – OyaMist
    May 31, 2018 at 17:31
  • 1
    It does seem unconventional but their is some reason to the madness. I have a computer connected to the serial port of the Arduino to have it control various step motors and sensors. As the RPi will be recording data or monitoring stuff in parallel, I needed something external to control activation/stopping of the RPi. This put the RPi in a slave. As the Arduino is doing somethign else, I thought it would be good to use as the external controller for the RPi. May 31, 2018 at 17:47
  • Thanks for the clarification. I used to write Arduino stepper drivers but have been much happier on the Pi with more elbow room. All my Pi's are wifi and communicate via REST. Each of my Pi's can handle up to 3 I2C and 3 W1 devices. I take it the standard Pi hats were insufficient for your use? Arduino's are normally only required for fierce fast dedicated motion control.
    – OyaMist
    May 31, 2018 at 17:55

1 Answer 1


To use the Pi as an I2C slave you have to use GPIO 18 and GPIO 19.

From the pigpio documentation.

The BSC peripheral uses GPIO 18 (SDA) and 19 (SCL) in I2C mode

See bsc_i2c and bsc_xfer.

You do need external pull-ups to 3V3 as those GPIO do not have any external pulls. For reference GPIO 2/3 have 1k8 external pulls to 3V3.

  • So besides the incorrect pin setup for the Pis (should be connected to 18 & 19), does my schematic work? I worry I might make something explode May 31, 2018 at 17:44
  • Looks fine, but I am a software person. You need to ensure that the Arduino never writes high (1) to the SDA or SCL lines as 5V will damage the Pi (perhaps fatally).
    – joan
    May 31, 2018 at 18:12
  • The arduino uno has a 3.3v output among the pins. I was also going toalso use resistors as shown in the schematic. If this is good then I shall give my setup a try. As the output is 3.3v, It shouldn't cause to much trouble. Jun 1, 2018 at 3:46

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.