Raspberry Pi to Arduino Shields Connection Bridge ReviewNovember 29, 2012

[Spanish Version] by Arduteka

Today we show you the Raspberry Pi to Arduino Shield Connection Bridge which has been developed by Cooking Hacks.

This shield will allow us to use the most of shields and Sketches that we have for our Arduino in our Raspberry Pi.

It is an awaited shield that will allow us to fuse the Arduino versatility and all the work done by the community with the power of the Raspberry Pi.

What is Raspberry Pi?

Raspberry Pi is a small low cost computer, (around 30€) developed by the Raspberry Pi foundation with the aim of stimulating the teaching of basic computer science in schools.

It has an affordable price considering that, using an audio and video kit, we can set as a cheap media center and play 1080p video using its HDMI. Features:

  • Processor Broadcom BCM2835 700MHz ARM1176JZFS with FPU and Videocore 4 GPU
  • GPU provides an Open GL ES 2.0 technology, accelerated hardware of OpenVG, and supports high-resolution images 1080p30 H.264
  • The GPU has a capacity of 1Gpixel/s, 1.5Gtexel/s or 24GFLOPs with filtering and DMA infrastructure
  • 512MB RAM
  • Start via SD card
  • Ethernet 10/100 BaseT network connector

As operating system, we can use different distributions, from Raspbmc as a media center, to Raspbian, which is based in Debian and you can download it from the page of Raspberry Pi.

What is the Raspberry Pi to Arduino Shields Connection Bridge?

It is a shield which uses the Raspberry Pi GPIOs as the pins of our Arduino. It gives us a similar size like the standard of the Arduino with the difference that it has a communication socket in which you can connect Xbee, Zigbee, WIFI, Bluetooth...

In the next video, you can watch in detail a couple of examples of how the same program that we have developed for our Arduino is smoothly introduced to our Raspberry Pi.

But... we have to control these GPIO! That's why the Cooking Hacks team has developed the arduPi library. This library allows us to program Sketches in Raspberry Pi with the same language than in our Arduino!! It preserves one of the main features of the flagship of the free hardware: its simplicity.

Because of the fact that the Raspberry Pi hasn't got any analog-digital converter, they have implemented in the shield a converter with a resolution of 12bit, bigger than the 10 bit of the Arduino Uno. With this, the shield has absolute compatibility with the different ways of communication that Arduino has: digital and analog I/O, I2C, SPI y UART, but in Raspberry Pi...

When we want to use the the Raspberry Pi to Arduino Shield, the first thing that we have to do is to identify our Raspberry Pi model. There are two different versions and they use different libraries.
The differences between the version 2,0 and 1,0 are:

  • 2 mounting holes added
  • 2 “reset” pin added that are called P6
  • GPIO21 has been replaced by GPIO27
  • The I2C interfaces have been changed
  • Resettable fuses have been removed
  • The P5 connector has been added. That's why we have the GPIO28, 29, 30 and 31 available, and a pin of +5V, +3V3 and two GND pins.

The easiest way to identify if we have the version 1,0 or the 2,0 is looking if it has a pair of mounting holes as shown in the following image:


You can download the library for your Raspberry Pi from the following links:

  • Library for Raspberry Pi Revision 2.0 board HERE.
  • Library for Raspberry Pi Revision 1.0 board HERE.


 How to program Raspberry Pi?

First of all, we have to set our Raspberry Pi to work properly and access to the GPIO. We start activating the UART port, in the video you can watch the steps to follow if you have any question.

  1. Open a terminal in Raspberry Pi.
  2. We must install a text editor in our Raspberry. Surely, your distribution includes vi, but if you look it very difficult, you can use joe, to install it you have to introduce sudo apt-get install joe.  You can also use the default text editor in graphical mode as you can see in the video.
  3. Backup the file cmdline.txt. If we do an error we will be able to solve it. You have to write: sudo cp /boot/cmdline.txt /boot/cmdline_backup.txt This command creates a copy of the file in the same folder.
  4. Edit cmdline.txt with a text editor. If we have installed joe, we introduce sudo joe /boot/cmdline.txt In this file we will find something like this: dwc_otg.lpm_enable=0 rpitestmode=1 console=ttyAMA0,115200 kgdboc=ttyAMA0, 11520 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait (this line appears in v1.0. You can see the one related to v2.0 in the video).
  5. Now we have to remove the parameters that refer to the serial port UART (ttyAMA0) keeping something similar to this: dwc_otg.lpm_enable=0 rpitestmode=1 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait
  6. We save the file and open inittab using sudo joe /etc/inittab and we comment (using # before the line) the next line 2:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100 (This line is for Raspberry V1.0, if we own a v2.0, the line will begin with '0:23')
  7. Now we have to restart our Raspberry Pi using sudo reboot to activate definitely the UART port.

Once we have configured it, we have to compile the library arduPi.cpp. The Cooking Hacks team has left it accessible for anyone to contribute with, one of the advantages of free software.

To do this, we will use GCC, if you have raspbian, it comes by default in the distribution. GCC is an integrated compiler of the GNU project for C, C++, Objective C and Fortran. It can receive a source program in any of these languages and generate a binary executable program in the language of the machine where it has to run.

To compile the library, we have to introduce  g++ -c arduPi.cpp -o arduPi.o once they are in the directory where you have downloaded the file with the library.

Now we can start with our sketch!

Inside the folder we have downloaded, we can find a file called arduPi_template.cpp, which we will use as a template to our Sketches.

The content of this template is:

//Include arduPi library
#include "arduPi.h"

//Needed for Serial communication
SerialPi Serial;

//Needed for accesing GPIO (pinMode, digitalWrite, digitalRead, i2C functions)
WirePi Wire;

//Needed for SPI

 *  setup() AND loop() YOU MUST DECLARE THEM HERE        *
 * *******************************************************/

 * ************************/

int main (){
	return (0);

As you can see, we have only to introduce the code of our Arduino program where it is indicated, like if we have other functions apart from setup and loop.

Once we have created our program, we have only to compile and execute it!

To do it, using a terminal, we go to the folder where we have the Sketch and we have to write g++ -lrt -lpthread my_program.cpp arduPi.o -o my_program replacing my_program by the name we have given to it.

Now, to execute it, we use sudo ./my_program and...voilá!

Things to consider...

As you have seen, there are infinite possibilities using the Raspberry Pi to Arduino Shields Connection Bridge, but we have to consider some security precautions because it is not an Arduino UNO. It is very similar to those that we use with the Arduino DUE. Here you have a reference link: http://arduino.cc/en/Main/ArduinoBoardDue

In brief, the problem is that the Arduino DUE and Raspberry Pi, work at 3,3v, something that we have to take into account every moment, especially if we recycle circuits.

Shields from Arduino and Cooking Hacks are prepared to work on this tension without risk of damaging your Arduino DUE or Raspberry Pi. But there are shields of others that they are not prepared, that's why you have always to be sure if it is compatible with Arduino Due, and if it is, it will be to Raspberry Pi too.

You can see the different Shields and tutorial that Cooking Hacks have to us, you can click on each to see more details.

Source: Arduteka

20 thoughts on “Raspberry Pi to Arduino Shields Connection Bridge Review”

  • mike

    i was wondering if there were any American distributors of the pi to duino bridge because i took a look through a few sites and i couldn't find anything. i'm taking a big stab at this for a tech idea and i was hoping to possibly have this shipped to me by christmas. my major issue however is cooking hacks sells it by euros and i was hoping to get some feedback so i can get this done and have a finished product by the new year. just a point in the right direction would be nice, thank you.


    • Cooking Hacks

      Hi Mike.

      You can contact with MicroController (http://microcontrollershop.com/). They use to resell our products but if you need a quick shipment of that board, I can suggest you to buy from us directly. If you have a PayPal account, you can easily pay without problems of currency.

      Merry Christmas!!

  • Steve

    This is truly awesome. I just wish it was a bit less expensive :(.

  • Jens

    The Connection Bridge is really great, I'm having a lot of fun with it. Now I have a question about the arduPi library that comes with it. Amongst other things it also features an implementation if the "Wire" functionality to allow for simple I2C programming. Now, if understand the code correctly you are simply using two of the IO pins for this. Now I was wondering if there is a simple way to tweak the library (e.g. change the base address somewhere) to enable a second pair of IO pins for a second, separate I2C bus. The reason I'm asking is that I want to connect two devices with the same (constant) I2C address to one bridge.

    Thanks for the help.

    • Cooking Hacks

      Hi Jens. It should be possible doing a new library to manage the digital pins as 2 I2C. We have not tested it right now.

  • Linux circle

    How do i use arduino core libraries in ardupi programs? Can i #include a package as in arduino ide? I want to use arduino library such as liquidcrystal

    • Cooking Hacks
      Cooking Hacks May 15, 2013 at 3:11 pm

      You can use the libraries ported to arduPi library. If the new library uses methods and functions supported by ArduPi, it will work.

  • Iri

    I wonder if it's possible to use waspmote 's shields (all kind of sensors or interfaces designed for waspmote) through this bridge...

  • AK


    Where can I buy this thing in Asia (possibly Indonesian distributor)? Thanks.

  • Ravi

    Hi.. I just want this type of board. I do have raspberry pi. Please do suggest where to buy. I am from India and I don't have PayPal account. Please suggest me any distributor.

  • mai amro

    how can i programmed aurdino due so it read ECG signal from the ehealth ?

  • enzo

    I'm not understand why my connection not work. I followed every steps.
    If I try lsusb I not found usb connection like pl2303 prolific technology.....
    where I'm wrong or what I'm missing???



  • reza

    Hi ,
    Good day :)
    I would like to know if we can use cooking hack board for a connection to analog telephony PCI boards. Like these: http://www.digium.com/en/products/telephony-cards/analog
    I made a IPPBX with my Raspberry PI m now I want to connect a analog telephony board to raspberry.
    Thank you so much for your guidance .

  • Sorin Claudiu Fratila
    Sorin Claudiu Fratila April 23, 2015 at 4:50 pm

    Hi guys,

    I just recently purchased an Arduino shield conneciton bridge + RPi + XBee ZB module S2 and I'm curious if I can connect it directly to the shield. What I mean, will it get burned because of the 5 V or does the shield have a reduction to 3.3V? (considering the ready made slot for the XBee module there)

    Moreover, Is there a ready made adapter to interface the XBee module with a PC (for programming purposes with X-CTU from Digi). I'm looking for something that doesn't require a breadboard.(if any)


Leave a Reply