13

I am working on a robot using an Arduino Uno R3 and I wanted to have the ability of controlling the Arduino wirelessly, like stopping the Arduino without having to pull the power-plug every time.

I want to know the safest way to connect my Raspberry Pi to the Arduino, without huge risk of voltage going either way badly.

I looked at using i2c and Serial, as per these pages: http://blog.oscarliang.net/raspberry-pi-arduino-connected-i2c/ & http://blog.oscarliang.net/connect-raspberry-pi-and-arduino-usb-cable/. I have yet to look up USB. The reason that I'm asking this question is that on the i2c post it said that I should look out for the voltage difference:

How Does It Work? Is It Safe?

The Raspberry Pi is running at 3.3 Volts while the Arduino is running at 5 Volts. There are tutorials suggest using a level converter for the I2C communication. This is NOT needed if the Raspberry Pi is running as “master” and the Arduino is running as “slave”.

How can I safely connect the RPi as the master and the Arduino as the slave.

  • 1
    Just connect via USB. To shut the arduino down, you could just add a (NPN) transistor to one of the GPIO ports that will pull the reset pin of the arduino to ground, keeping the arduino in a 'shutdown' state till the reset line is restored. – Gerben Jan 2 '14 at 15:57
4

Absolute safest would be Bluetooth serial. With a supported USB dongle on the Raspberry Pi and something like a Bluefruit EZ-Link on the Arduino, you could program and control the Arduino from the Raspberry Pi with no physical connection.

Next best would likely be through USB. There is a “standard” protocol (Firmata) for interacting with Arduino and sensors, but it might not be ideal for robotics.

  • Hoo! $22, not exactly cheap, but okay! Will look into this! – RPiAwesomeness Jan 1 '14 at 5:42
  • 2
    Try ebay for cheaper alternatives if cost is a factor – Jervelund Jan 1 '14 at 12:01
  • When you say Bluetooth serial, would this work? foxytronics.com/products/… – RPiAwesomeness Jan 2 '14 at 2:03
  • Yes, the JY-MCU one would likely work after a lot of fiddling. The more expensive one I linked to handles all of the complex setup stages. That's worth the price difference to me. – scruss Jan 2 '14 at 3:11
  • Okay, great. I like fiddling and this one is cheaper, and the service is great, so I think I will go with this one. Thanks! – RPiAwesomeness Jan 2 '14 at 16:17
10

The short answer to your question, how to safely connect the RPi to an Arduino, is indeed given at the first link you posted: http://blog.oscarliang.net/raspberry-pi-arduino-connected-i2c/. I have used the method given there with great success, and without damaging any components.

But your question suggests that you don't trust that method, and I think the key to trusting it is in understanding why it is safe. This is explained in the paragraph after the one you cited, but perhaps with too much detail. The key is the lack of a "pull-up" resistor on the 5V Arduino. Without it, the only voltage supply is from the 3.3V RPi, which fortunately is high enough for the Arduino to recognize.

7

If you don't want to spare your USB port of your Rpi, you can use GPIO Serial to communicate with your Arduino. There is a great tutorial of Conor O'Neill for connecting Rpi with a Arduino Pro Mini. The procedure is the same with your Arduino Uno.

All you need is a LLC (Logic Level Converter) to be able to connect these two devices. As you've already mentioned, these devices run at different voltage levels.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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