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.Gerard H. Pille– Gerard H. Pille2018年06月11日 09:08:35 +00:00Commented Jun 11, 2018 at 9:08
-
What exactly is an ev3Steve Robillard– Steve Robillard2018年06月11日 17:10:54 +00:00Commented Jun 11, 2018 at 17:10
-
What exactly did you "successfully replicate"?Dmitry Grigoryev– Dmitry Grigoryev2018年06月21日 07:00:14 +00:00Commented Jun 21, 2018 at 7:00
-
Lego Mindstorms EV3.NomadMaker– NomadMaker2020年02月19日 05:04:18 +00:00Commented Feb 19, 2020 at 5:04
1 Answer 1
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.arg3t– arg3t2018年06月11日 07:35:01 +00:00Commented Jun 11, 2018 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– joan2018年06月11日 10:02:06 +00:00Commented Jun 11, 2018 at 10:02