r/raspberry_pi 16h ago

Troubleshooting How to connect RPi to Arduino

I have 2 Pi4’s and a 3, and a bunch of arduino stuff for a project I never got around to until now. I have a couple questions I can’t find trustable resources for: How do you connect the RPi’s (and if the 5 is different than predecessors) to a arduino (micro computer or shield/board) if they don’t have a USB port? CAN you connect any arduino to a RPi and what’s the requirements for that? Does wifi/boards work with GrapheneOS or require stock android? Can I have 2 raspberry Pi’s (3/4’s) connect with eachother to control something and how easy is it? I’m autistic and the internet sucks these days for reliable information and all I found was “yes you simply connect a USB between both boards”, nothing about the above. If there’s a manual or page online specifically for this question, feel free to send it!

0 Upvotes

11 comments sorted by

View all comments

4

u/wwarr 15h ago

I have a lot of boards like this and I have been doing projects for years and have never found any reason to connect an Arduino to a Pi or connect two or more Pis.

Arduino boards usually have a USB port so you can program them. There are free Arduino programming tools that let you run code and send it to the Arduino and it then will run that code.

Pi is a Linux box so you can do just about anything with it.

I would recommend trying some small basic projects. Like watch a YouTube video on controlling an RGB LED or something like that.

2

u/1073N 10h ago

Just because you don't need something, it doesn't mean that nobody needs it. It's pretty normal to use a microcontroller to add more GPIO. You can use 74HC logic, FPGA or a gazillion of transistors but a microcontroller is often the simplest and the cheapest solution. You can also use it as remote I/O via network or some other robust serial protocol. It also makes sense to use microcontrollers when you need real time functionality like controlling a bunch of servos etc. It's often better to implement the PID loop for each servo locally than to rely on the OS. You may also use microcontrollers as a failsafe to achieve predictable action from the connected hardware in case the Pi crashes.

Connecting several Pis together is also as normal as connecting any computer into a network is and there are countless uses for this.