The Raspberry Pi and the Arduino are both amazing, and each has its particular strengths. There are lots of projects that use one or the other, but there’s growing interest in solutions that combine the strengths of the two platforms.

We use both on C3Pi (our experimental robot). At present we use I2C to link the two, and today we found a way to simplify the way they are connected. Since there seems to be a lot of interest in this topic, I thought we’d share our approach and explain why the solution is a little simpler that we thought!


The I2C software is easy

We’ve been using our Python library on C3Pi to drive the I2C bus that we currently use to connect the Pi to the Arduino. We’ve also adapted the Arduino I2C slave code which is one of the Arduino  examples.

Both programs are very simple. You can find the current versions on github. (Warning: expect the code to change rapidly as we are experimenting with new ideas!)

Linking the Pi and Arduino hardware is easier than we thought

Until today, we were using a sparkfun level shifter to connect the 3v3 I2C bus used by the Pi to the 5v I2C bus on the Arduino.

It turns out that we don’t need to, because the pull-up resistors on the Pi keep the SDA and SCL lines close enough to 3v3 to be safe, even if they are directly connected.

Until today I thought that wasn’t the case. I dimly remembered that the Arduino has pull-up resistors that are enabled by default when you use the Wire library. However, it turns out that these are weak (high-resistance) pull-ups; the Pi has strong pull-ups which dominate those on the Arduino, making direct connection safe.

This only applies to I2C. If you want to connect the serial port on the Pi to the serial port on the Arduino, you will need some protective circuitry between them. That’s why we have a level shifter on our interface board.

But for I2C, just connect the Pi and Arduino as shown below and everything will be fine!

.————-.           .————.
|  Pi         |           | Arduino    |
|          SDA|———–|SDA         |
|          SCL|———–|SCL         |
|          Gnd|———–|Gnd         |
|             |           |            |
.————-.           .————.

Do you pine for the plug-in peripherals on other platforms like the Grove System from seeed studio or the Gadgeteer?

Are you finding it hard to choose between the great interface boards from companies like Ciseco and Quick2Wire?

Grove real time clock

Grove RTC

Sytech 3 Axis Accelerometer

Sytech 3 Axis Accelerometer

Help is at hand!

We’re about to start prototyping the babelboard – an inexpensive board that lets you connect I2C-based boards from all these families to the Raspberry Pi.

This will allow you to use dozens of I2C-based devices with the Pi without having to design or solder them. Just plug them in and write some code!

Over the next few days we will open up the project on GitHub and start posting details here. The board is fairly simple so we hope to have it available in kit form within weeks.

Find out more

If you want to know more, or have ideas, join our support forum, head over to the babelboard topic and get in touch.

A few people are currently using the beta 0.5+ plus version of our analogue board.

The board is almost unchanged since version 0.2, so you can assemble it using the old guide.

The position of the jumper pins has been tidied up a bit but that shouldn’t be a problem.

We’ll do an updated assembly guide when the production boards arrive later this month.

Here’s the pinout for our SPI connectors.

The CS line is connected to CS 0 for the connector on the left and CS 1 for the connector on the right of the Interface Board, as seen from above. Int can be connected to an interrupt for those chips that support it, such as the MCP23S17 SPI Port Extender.



We’ve been asked to document the pin allocations that we use for the I2C connectors on our boards.

Here they are:

i2c-pinoutThe Int line is used to signal an interrupt from those boards that can generate one, including the MCP23017 Port Expander Board.

The 3v3 line is powered by the Interface Boards’ voltage regulator, and can provide a much higher current than the Pi’s 3.3 volt supply.

A couple of people have asked how they can make BAR LED boards like the ones we used for the blinken-lights demo

We use them all the time – they’re really useful when you need to monitor the state of a byte-wide input or output.

We recently simplified the design by using a resistor array, and the boards are now really easy to make on strip-board.

Here is the new version, seen from the front and the back:



Here’s the stripboard diagram, courtesy of Fritzing. The bar led is transparent, so you can see the breaks in the tracks beneath it; you can also see a couple of breaks just to the left of the BAR LED, and there are breaks in each track under the ULN2803.