Recently, I have been trying to build a project where I need to connect an ev3 to a raspberry pi. I have decided doing it by i2c after reading (and successfully replicating) an article about connecting an ev3 to arduino by i2c https://www.dexterindustries.com/howto/connecting-ev3-arduino/.  However, after setting it up with raspberry pi, I realized a huge problem that I am facing, both of these devices acted as masters and I could not get them to connect to each other.

So, I decided to use an Arduino between those two which transports the data that it receives to the other device, which I couldn't get working. I have no idea how to get it working anyways, it was just a hopeless try.

Is such a project possible or should I just give up? If I should, what type of communication do you suggest that I use?

If you know any way of putting the Raspberry Pi into the slave mode, I would really appreciate if you share it.

  • I'm using TCP over USB to connect to my EV3. It allows me to ssh into EV3, it's a level I feel more comfortable with than i2c. Jun 11 '18 at 9:08
  • What exactly is an ev3 Jun 11 '18 at 17:10
  • What exactly did you "successfully replicate"? Jun 21 '18 at 7:00
  • Lego Mindstorms EV3.
    – NomadMaker
    Feb 19 '20 at 5:04

pigpio has limited support for the Pi to act as an I2C slave.

See http://abyz.me.uk/rpi/pigpio/python.html#bsc_i2c

That example is Python.

Note that when acting as a slave device you need to use GPIO 18 (SDA) and GPIO 19 (SCL). You also need to fit external pull-ups to 3V3. For reference the ones on GPIO 2/3 are 1k8 pull-ups to 3V3.

If you look through the documentation you will see several examples in C, Python, and the command line (pigs).

It is what it is - that means you will have to work around its limitations or find another solution.

See my post for background information and a usage example.

  • Wow, thanks man, you literally saved my life, though I need to ask, can I connect 43 K to 4.7 V since that worked with arduino. Sorry for the noob question, I am quite new to electronics.
    – Fr1nge
    Jun 11 '18 at 7:35
  • I do not know what you mean by 43 K to 4.7 V. Remember ALL the Pi GPIO are only tolerant to a voltage between 0 and 3.3V. Anything outside those limits risks damaging the GPIO and the Pi.
    – joan
    Jun 11 '18 at 10:02

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.