2

I am working on a project where I am using a Raspberry Pi and an Arduino together via USB. On the Arduino, I have my code setup to where I send it a letter over serial and it will do something (for example, if I send 'A' over serial, it will turn on a LED. B will turn it off, etc.). I have already tested all of the commands with the serial monitor, so I know my Arduino code works. On the Raspberry Pi, I want to be able to run a .sh file and have it send a letter over serial to the Arduino. In trying to do this, I have looked at many forums (including the one here: http://playground.arduino.cc/Interfacing/LinuxTTY) and every time I try to send something, the lights on the Arduino flash and it basically produces the same result as pressing the reset button. So, how do I write a .sh file to send commands to my Arduino? Thank you in advance! -Ethan

1
  • "send it a letter over serial" -- A USB connection should not be referred to as "serial" as if it were a simple communications link. USB is a bus, and has a bus protocol. If you use the RPi as the USB host, then the Arduino has to identify itself as some kind of USB slave device (e.g. CDC/ADM gadget which would be accessed as /dev/ttyACM0 on the RPi). Commented May 13, 2016 at 2:41

1 Answer 1

1

I believe there is a difference in the voltages used on the ardino (5V) vs the raspberry pi (3.3V), so you cant just directly connected them up.

Instead, you need to use a voltage divider/converter so that is has the correct voltages.

This is explained in detail at this website: https://oscarliang.com/raspberry-pi-and-arduino-connected-serial-gpio/

Sign up to request clarification or add additional context in comments.

2 Comments

Isn't that if you are using the GPIO pins? I am using a USB cable.
The arduino might use too much power from the usb port for the PI to handle.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.