I have looked all over for a solution to this. I'm a noob in the arduino space and am really just getting my feet wet. It's possible that I am interpreting what I am reading wrongly. If so I apologize. Here is my problem/question. I want to create an autonomous driving small land drone. It would connect to some drive sensors, dc motors and do some stuff all by itself. In addition to this I want a raspberry pi with a camera surveying the scenery. Because it is unknown if/when the raspberry PI will see something that is interesting i want this default behavior to occur. The reason I want to do it like this is that I read it is better performance to drive from the Arduino because a linux based computer has so much stuff running on it there could be more lag in the response. In addition the python program will be making HTTP requests, doing image processing, and potentially doing even more. If the image processing software on the PI picks up something interesting then I want this functionality to override the Arduino default program. I was thinking to create a program in Arduino for the basic drive functionality but then be listening to a python process that is running on the PI. If it hears a command to go do something, then of course it will drop the default program, go complete the python generated task and once it is done then it will continue with the arduino default program.

How do I in effect listen to a python process from the Arduino? Or would the proper solution be to not even use the Arduino but drive it all from python on the PI? Any suggestions for how to solve this would be great to hear. I feel like there is an obvious best practice way to do this that I am not aware of. Thanks in advance!

  • You can connect the Arduino via USB to the Pi The Arduino should show up as a serial device; and thus you'd be able to communicate from Pi to Arduino and vice versa. But you may want to try and get it working on your PC first. There should be plenty of comparable projects online, see if you can find one that looks a lot like what you're trying to achieve
    – aaa
    Mar 27, 2021 at 8:18

1 Answer 1


What you are asking for is not completely trivial, and may be ill-suited for a beginner's project. You will have to create a protocol for the communication between the Raspberry Pi and the Arduino (your own “command language” of sorts), and then implement on the Arduino a command interpreter that understands this protocol and acts accordingly. I highly recommend you use a text-based protocol, as this will be way easier to debug than a binary protocol.

For the Arduino side of the project, you first have to learn how to read the serial port from the Arduino. Then, you can take a look at this very basic command line interpreter for inspiration. Or you can search for Arduino libraries that provide similar interpreters.

On the Python side, you have to open the serial port (/dev/ttyACM0) and send your commands through it. The details on how to do that would be a Python question, which is are out of scope here.

  • Thank you Edgar you clearly don’t know me very well as “not suitable beginner project” is my middle name 🙂
    – Dan
    Mar 27, 2021 at 14:18

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.