GPIO extension - Arduino

Hi. How to connect Raspberry Pi3 with Arduino MEGA 2560 to get more GPIO?

Or you can add a ethernet module to the mega2560 and use MQTT protocol for data exchange


I have used two MEGA 2560’s connected to my PI through serial, after which I decided to use I2C with MCP23017, which I did not regret.

Code was simpler with I2C, everything worked well from the start.

you can provide a link to the I2C from MCP23017 that you use?

I2C is the protocol on which the MCP23017 communicates with RPi. I’m using a custom built PCB for the controller itself, but you can use for starters maybe a shield, for ex.: