Instructables
Picture of The Raspberry Pi - Arduino Connection
The Pi is a fine little computer board, though not nearly as good as
the Arduino when it comes to I/O capabilities. The beautifully-engineered
Gertboard is a plug-in add-on that neatly overcomes this deficiency
by giving the Pi access to an ATMega328, but it's a very complex and
expensive solution. An alternative would be to interface an Arduino
running at 3.3 volts to the Pi, though this is easier said than done.
But, we won't let that stop us, will we?

You can buy a prebuilt  commercial version
of something similar to this project.
It's called an AlaMode, and it goes for something like $50.
Our version will cost about a third of that to build.

As a first step, we will build an Arduino plug-in board for the Pi.
It is customary to call Pi boards "plates," but indulge me and permit
me to name this particular board a hoody. Thank you.

We will be using generic stripboard to build our project. Small (3-3/4"
x 2-1/16") boards can be obtained on eBay for a bit over a dollar apiece.
It is also possible to use something like a Radio Shack 276-168 protoboard
($3.49). The main component, though, is an 3.3-volt Arduino Pro Mini.
This will permit connecting directly to the Raspberry Pi ports and other
3.3-volt devices without having to do level shifting.


Quite a number of Pi projects involve connecting sensors and devices
directly to the GPIO pins. This is not a good idea. Use buffer chips,
such as the 74HC4050 hex buffer, between the devices and the GPIO.
This protects the Pi from overvoltages, current surges, and your mistakes.
Far better to blow out a fifty-cent buffer chip than a $35 Pi.

This particular project connects directly to the GPIO Rx and Tx pins.
However, we are connecting to a 3.3 volt device, which limits the risk.
Still, a buffer chip would not be a bad thing here.


This is a moderately complex project, and beginners need not apply.
It requires skill at soldering and in the use of hand tools. Experience
with a continuity tester and a steady hand with a knife blade are also
helpful.

Ready? Well, then, let's get on with it!


 
Remove these adsRemove these ads by Signing Up
macpe3 months ago

To get it working on Raspbian you need to stop /dev/ttyAMA0 from working as a serial console since that will screw things up. See the following link for how to do this:

http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/io-pins-raspbian/uart-pins

thegrendel (author)  macpe3 months ago

Yes, and thank you for the fix.

Most Pi users do install Raspian, so this info is very helpful.

thegrendel (author) 1 year ago
Rather than a stacking header that plugs the board directly
on top of the Pi, some of you might prefer to use a shrouded
box-type header and connect to the Pi with a 26-pin standard cable.
This takes up more workspace, but gives extra flexibility.

And hey, folks, how about some ideas and suggested improvements?
Or maybe someone would like to produce an etched PC board.
thegrendel (author)  thegrendel1 year ago
Another alternative:

Use a stacking header as described in the Instructable,
and get a female-to-male 26-pin cable to give the option
of using the interface board off the Pi.
Orngrimm1 year ago
Cool!
since i love Arduino's and also have a Pi which i kinda hate since i dont have the loved I/O-o-rama i know from Arduino, thats the perfect 'ible for me!

2x voted! :)
thegrendel (author)  Orngrimm1 year ago
Thank you for the praise, Orn.

As you've noted, the Pi lacks analog IO, which an attached
Arduino can provide. The other great shortcoming of the PI
is the fragile non-replaceable SOC/CPU, which requires much
care when directly connecting to the GPIO pins. A cheap Arduino
board, or even an ATMega 328 jig, running at 3.3 v makes a perfect
buss buffer.
Kamilon1 month ago

If you want to use a 5v Arduino to do the same thing (or any other microcontroller) take a look at my logic level converter solutions here:

http://blog.kamilon.com/?page_id=263

Jose Inacio2 months ago

one question please. My arduino pro mini is externally sourced by a 12v font in order to drive a rgb led strip. In this case,can i only connect the raspberry and arduino rx tx pins? So I can control led strip from a Java programa running on pi.

thegrendel (author)  Jose Inacio2 months ago
Make absolutely certain that the Arduino's rx and tx signals are at 3.3 volts. More than that will damage the Pi.
Robo-T7 months ago

At first I was very interested in the Raspberry Pi, but found what I was really looking for was the Arduino. I have both and like getting them to work together. Recently, Intel has come out with the Galileo. It seems that the Galileo is similar to what you did combining the Pi with Arduino. Would you see it that way? Or is there a big difference. With a Galileo, due, and every other board coming out which way will it all go?

Thx for the write up. We will be doing some integration with your article as a basis.

thegrendel (author)  Robo-T7 months ago
Yes, the Intel Galileo is interesting, but it is a bit more expensive than the Pi, has less community support, and lacks documentation at present. Note that I don't possess one, and base this judgment solely on what I've read about it.

Hooking an Arduino or Hackduino to the Pi has the one big advantage that the Pi itself is not exposed to overvoltages or excess current. If you blow up a '328 chip, you can replace it for $3 or so, not a big deal, whereas if you blow up the Pi it's a bit more serious.

Thank you for your perceptive comments.
xXYEIROXx9 months ago
I have a question. If I just get a usb board like an UNO or Mega, can I just plug the Arduino in the RPi's usb port?
thegrendel (author)  xXYEIROXx9 months ago
Yes, if . . .

1) You're using a USB hub with the Pi and have a spare port on it.

2) You've installed the Arduino IDE software package on the Pi.

With both of the above in place, you can program sketches for the Arduino and upload them to it. But, other communication between
the PI and Arduino over the USB buss is quite another matter.
Much easier is using the serial ports.
nerd747310 months ago
do you have the arduino IDE on the raspberry pi? If not enter the following

sudo apt-get install arduino

it will be typed into the terminal and then download after you hit enter. I may make an instructable on how to install it and some other stuff about it too!
thegrendel (author)  nerd747310 months ago
Yes, thank you, I have that installed.

I think your idea about an instructable is interesting,
but you may want to consider expanding the scope of it.
How about doing an instructable on installing software
packages on the Pi? And maybe also about installing
different Linux distros? You'll do an excellent job at
this, I'm sure, and many Pi users will benefit.

Thanks for your comment.
I may do a separate one for Linux distros or maybe even xbmc
hey thegrendel I published it you can feel free to take a look!
so I should make an instructable about how to install arduino IDE on wheezy
Ok I will make one over that it is a very good idea
diy_bloke1 year ago
as a socket you can also use 2 14-pin dil sockets
thegrendel (author)  diy_bloke1 year ago
"There are nine and sixty ways of constructing tribal lays,
And every single one of them is right!"

-- Ruddy Kipling