-2

I am trying to connect an Arduino and Raspberry Pi over USB. I would like to send serial commands, just like the serial monitor in the Arduino IDE. I know how to do this on the Arduino end but I'm not sure how to send/receive serial communication on the Pi end. Ideally the solution would utilize Python.

closed as off-topic by Anonymous Penguin Feb 19 '15 at 22:45

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question does not appear to be about Arduino, within the scope defined in the help center." – Anonymous Penguin
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Welcome to Arduino SE! Sorry, this is not on topic because it's about the Pi. If you Google your question with the word "python," you will get several articles to show you where to go. – Anonymous Penguin Feb 19 '15 at 22:46
2

You will need PySerial to accomplish this. A tutorial on interfacing Arduino and the RPi using a usb can be found here

  • linking to offsite resources as the meat of your answer is not useful in the longterm, please update your answer to include more information. – DrCord Feb 17 '15 at 4:26
1

You would be better to ask this on http://raspberrypi.stackexchange.com

You can use program minicom on the Pi; this is a terminal program like the serial monitor in the Arduino IDE, and of course you can use Arduino IDE on the Pi.

If you look at the Pi site you will see lots of Python serial communication programs.

  • There's nothing particularly "pi" about this - it's rather a generic linux/unix question. – Chris Stratton Feb 17 '15 at 4:55
1

Why do you want to use the USB port on the Pi? Isn't it easier to connect the Arduino directly to the UART pins (Pins 8 and 10) on the PI and then read out the UART in your python programme?

  • this would be more appropriate as a comment. You are not answering the question. There could be lots of reasons to use a direct usb connection or the OP might not know that they can do what you propose, either way though the question they asked is about connecting via usb. – DrCord Feb 17 '15 at 4:27
  • Do realize that it's the same serial software API either way? While it's true that the USB serial imposes an additional latency, it's wise to design communication schemes that can tolerate that, because more often than not today one will be involved. Regardless, you haven't answered how to implement either the original question or your own proposal - which is ironic as an answer to either would be an answer to both. – Chris Stratton Feb 17 '15 at 4:57
  • Why are you guys getting so upset with my comment? All I tried was to help. What I have written may technically, according to your orthodoxy, not be an "answer", i.e. providing a complete and final solution for the USB connection. However, I suggest an alternative solution to the original problem, i.e. sending serial commands. – hobie Feb 17 '15 at 10:01
  • 1
    The reason I want to use USB rather than the GPIO on the Raspberry Pi is that 1) The Arduino will be powered over USB, so less wires to run (the Arduino and Pi will not be immediately next to each other) 2) It is a neater solution 3) Latency is not an issue, and 4) The Pi is a 3.3V device while Arduino is 5V. For now, signals only go Pi>Arduino, which should work, but I want the option to go Arduino>Pi without level shifting. – TikkaTikka Feb 17 '15 at 21:18

Not the answer you're looking for? Browse other questions tagged or ask your own question.