Introducing Ponte: Arduino – Raspberry Pi Bridge

(This is a collaboration between myself and my friend and purveyor of fine electronic bits, S.K. Pang)

How would you connect an Arduino to a Raspberry Pi? Just plug it in via USB as you would normally do with an ordinary computer, right? That takes up one of the precious USB ports and while you can use a hub, that takes up more space than the beautifully minimal ‘Pi and just looks ugly. Not a deal breaker per se, but still, unpleasant.

Why would you connect an Arduino to a Raspberry Pi? You probably want to use a shield or two to add extra functionality to your ‘Pi, and really, in this scenario the Arduino is just acting as a proxy between the shield and the ‘Pi. I find this a bit superfluous as the ‘Pi itself has pins and peripherals that can act as their Arduino counterparts.

What makes Arduino great is the ecosystem around it — the countless number of people working on projects, answering questions, writing code and developing shields for it. These all take time and I am sure the ‘Pi community will be as vibrant as the Arduino one as more people receive their units but can we somehow link these two together for extra awesomeness?

Introducing Ponte, our (currently experimental) design that aims to be the “bridge” between the Arduino and Raspberry Pi hardware. It serves two purposes: You can either plug it into an Arduino to link it to your ‘Pi or you can use it to connect Arduino shields to your ‘Pi.

The first case is useful for times when you want to use Arduino to simulate certain things, say for instance creating a behavioural model of another part of the system you are developing and the second case is simply for when you want to extend the functionality of the ‘Pi with add-on Arduino shields. (If you haven’t seen it already, check out Shield List and prepare to be amazed as you browse through nearly 300 existing shields!)

The idea is simple, consequently the circuit itself is not very complicated. With some clever software hackery, we should even be able to use existing Arduino sketches on the Raspberry Pi.  There is promising start for that here. (I was actually going to implement this myself but there is no need to reinvent the wheel I suppose)

For those of you interested, here is the current version of the design:

Schematic:

Layout:

(click thumbnail, receive larger image )

The design files will be released as open source hardware once we are happy with our prototypes but in the meantime we are looking forward to your comments and suggestions. It is 2012, so this is pretty much an RFC in the form of a blog post ;)

Spot any embarrassingly fundamental errors? Should we have picked a better ADC? Do you think the clever power selection/prioritisation bit is actually not that clever? Let us know before we send the gerbers off to the fab next week!

(Probably unnecessary but sort of a ‘just-in-case’ legal bit: Arduino and Raspberry Pi are registered trademarks and this site is not associated with them, so yeah.)

This entry was posted in Posts and tagged , , , , , , . Bookmark the permalink.

58 Responses to Introducing Ponte: Arduino – Raspberry Pi Bridge

  1. Pingback: Using Arduino shields with the Raspberry Pi - Hack a Day

  2. Randy says:

    The ADC – I didn’t see a part number anywhere. All the schematic says is “RefDes”.

    • Omer says:

      Ah. That’s why there is an item in the TODO list about fixing reference designators, thanks for spotting this :)

      It’s an ADS1015 from TI. Not as fast as the Atmega328 ADC but has better resolution.

  3. Skater_j10 says:

    Hey nice work! Had the same idea but you guys beat me to it! Didn’t really think about adding an ADC to the design but that makes good sense. A couple questions for you: Which level translating chip will you be using and will it be a true 5V on the Arduino side? (important for servo signals) Will the Ponte be mounted perpendicular to the RaspPi, and if so does it overhang? (just thinking about enclosure fit)

    • Omer says:

      Thanks! For the GPIO pins I am using TXB0108 and for I2C the TXS0102. They are bi-directional active level translators so in theory we will have “true 5V” signals on the Arduino side.

      As for connecting this to the ‘Pi — I was thinking of using IDC/ribbon cables as stacking things on top of the ‘Pi is really not a very good option due to the physical layout of things.

  4. Konstantins says:

    Don’t really believe RPi is something to look for as Arduino replacement.
    In case of any project requiring processing horsepowers I’d prefer to have Arduino doing all the control and RPi telling it what to do (or analyzing data or being the server, etc), communicating with Arduino throught serial port or alike.

    There are many but mostly simple reasons. Microcontroller is not a CPU and vice-verso – it has to be real-time, without any sort of operating system that may change over time or introduce bugs, hang, think a bit longer or faster on occasions, be dependent on some software processes, etc.
    With a micro-controller, once the program is tested, one is certain that it will respond as the program is incomparably simpler than operating system and on most occasions has only two states (working or not) without maybe.

    Of course this is only my opinion, but I’d be happy to see a solution to stack Arduino onto RPi and shields thereafter.

    • Konstantins says:

      Khm, gess I need some sleep as it seems your “shield” is already does everything mentioned :)

    • Omer says:

      Agreed, for timing critical business fighting with the Linux kernel to gain control of the CPU is not a viable option and better handled with a dedicated processor. Having said that, I can’t see why you can’t just use the ‘Pi pins and get rid of the Arduino in the example I have described: Arduino acting as a proxy, relaying pin states from a shield to the ‘Pi.

      Bottom line is: They are different beasts that should happily co-exist, hence the effort in trying to bring them together.

  5. rad says:

    The arduino an use a DC voltage jack and supply boards that require high voltage (such as this motor shield http://www.adafruit.com/products/81) allowing for more powerful motors. e.g 12V

    Will there be a similar jack on the pronte for such boards?

  6. Pingback: Raspberry Pi and Arduino | Raspberry Pi

  7. SkUrRiEr says:

    One point – some slightly non-standard shields use the ISP port to get some signals (SPI mainly) that aren’t always in the same place on different versions of the Arduino. (Adafruit’s wave shield is an example)

    • Omer says:

      Argh, this makes me cringe a little bit but I’ll add the footprint for it. Thanks for the heads up!

    • Randy says:

      I wouldn’t call that non-standard – it’s the only reliable way to get the SPI port on both regular ATMEGAxx8-based Arduinos and Megas alike.

      • Randy says:

        Also: the latest revisions of the Arduino Ethernet shield do the same thing.

      • Omer says:

        Not ‘non-standard’ perhaps, but certainly not the best way to go about it. Having said that, stranger things exist on the Arduino boards (like the non-standard spacing) so I guess I will have to live with that :)

  8. davr says:

    Please give us the option of having the board stack on top of the r-pi, even if it means we need annoyingly long header pins and oddly shaped plastic standoffs for support (due to lack of mounting holes on the r-pi).

    Another thing to think about is an arduino-compatible board (aka an atmega328) that plugs directly into the r-pi. If nobody else gets around to it, I’ll probably have a go at designing one. You can leave out the atmega16u2 chip even (the one that handles usb/serial), since you’ll already be plugged directly into the serial port on the r-pi. Could make the voltage converters optional to save cost for people that didn’t need 5v (since the atmega can run at 3.3V just fine)

    • Omer says:

      You should be able to stack this on top of the ‘Pi if you solder a female header block on the bottom side of the board, but you will then have to omit the headers that connect the Ponte to the Arduino since they will probably interfere with the connectors on the ‘Pi (i.e: you can only use it to connect shields to your ‘Pi)

      As for the second idea, I believe there are a few people working on this already (IIRC Gertboard will have a mega328 on it).

  9. Martin Ellis says:

    Gratz on the hack-a-day mention, would have to be you who got on there first out of us lot!

  10. Michael J Tessmer says:

    Could you show a picture of the completed board?
    Thank You!

  11. Nick Johnson says:

    Hey, do you know what emulates all of an Arduino’s I/O capabilities really well, speaks I2C, SPI and USART, and costs less than two TXB0108 ICs?

    An ATMega 328P. :)

    • Omer says:

      Correct, but that is an added level of complexity in the design.

      If you were to use any microcontroller between the shield and the ‘Pi, you would have to initialise it somehow every time you wanted to use a new shield mainly for the fact that you can’t really have birectional I/O pins. The level translators are birectional and hence the operation is transparent to the user (unless they want to explicitly disconnect certain pins via removing some jumpers).

      If cost was the main constraint, I would have looked into other options — even employing a small CPLD perhaps :)

      • Nick Johnson says:

        Well, what I was intending to suggest was using the AVR as an IO expander. You can load a default sketch onto it that emulates readily-available IO expanders, or invent your own protocol. You can even add kernel support for it with the GPIO module.

  12. Pingback: Ponte: мост Arduino – Raspberry Pi | Библиотека IT статей

  13. Randy says:

    According to the schematic, the ground connection on U5 is broken. That’d make for some fun debugging :)

    Overall, I’m not totally sold on this approach – I think you’re going to run into issues with a lot of shields if you can’t do GPIO on Digital 0 and 1, as well as 10-13 and the Analog pins. Aren’t you also losing out on the 6 PWM channels an Arduino has?

    I’m wondering if using an ATMEGA48 in place of the ADC, running the I/O lines to it, and using CMOS switches to switch between the ATMEGA and the Raspberry Pi for SPI, UART and I2C would work. The ATMEGA could just be an I2C slave for I/O operations.

    The complexity in setting up different shields, I don’t really buy – since you’re going to have to set I/O direction on the Raspberry Pi anyways, and are probably going to use a library for that, why not just make the library set up I/O pin directions on the ATMEGA?

    • Omer says:

      I’ve the noticed the missing ground connection when I was adding the ISP connector and the DC jack, thanks for spotting it though :)

      Regarding the RX/TX (i.e: Digital 0 and 1): Apparently there is a way to use UART on the ‘Pi without the console interfering, haven’t looked into that yet though. As for the SPI pins, you can just use them as GPIO if you don’t need SPI functionality, it’s my understanding that all the pins can be utilised as just plain GPIO. There is only one PWM channel on the ‘Pi so yeah, you are losing 5 channels and Analog 4 and 5 are reserved for I2C.

      Adding another micro on the board was my initial idea but I’ve decided against it on the basis that I just wanted a ‘transparent’ interface — even though it clearly has limitations. Maybe revision 2 will see that microcontroller come back to the schematic.

      • Randy says:

        I didn’t realize that the SPI and UART lines could be re-mapped to GPIOs like that – that certainly alleviates those concerns. Based on the information at http://elinux.org/Rpi_Low-level_peripherals there are a lot more GPIOs to play with than I thought :)

        That really only leaves the PWM concern, which could be alleviated with some analog MUXes and some dirt-cheap micro acting as an I2C slave with a few PWM outputs. Definitely more of a Version 2 issue, though.

        I can’t wait to get my Pi to start playing with this stuff :)

        • Manu says:

          Hello,
          First, I ‘d like to thank you for this nice job and I love the idea of connecting the myriad of Arduino shields directly on Ponte. I see some discouraging messages, but, for the ones who are complaining: hey! do you own board before blaming engineering compromises.
          However, I don’t know much about Pi until I’ll get one, but I had problems with an old linux embedded board with multiple hardware uarts: pins had to be GPIO or UART but I couldn’t use alternative function of the considered pin without recompiling the kernel. It means that I had to fix the function of the pins. I could live with that for a specified application, but for a prototyping platform as the Pi is, it would be great to use pins as GPIO or UART (which is possible for SPI or gpio for pins D11, D12, D13) dynamically.
          On one hand Pi has 1 uart, on the other hand lots of shields are using software serial library (e.g. serial lcd module) for projects that need 2 or more uarts.
          There are hardware solutions for that : MAX3100 uses SPI bus to make an uart. Probably I2C could be used as uart for one direction (Rx or Tx).
          But I would be easier to emulate uart on gpio in order to use Ponte with shields without adding glue hardware. So, is it a way to emulate by software other uarts on the GPIO of the Pi?

          • Omer says:

            Thanks for the kind words, Manu. Pin multiplexing isn’t so much of an issue on the Pi, I haven’t had problems with it so far. You should be able to simulate a UART easily on the GPIO pins (you can even experiment with the new GPIO interrupt stuff!), not sure how fast the bitbanging can go, though.

  14. Pingback: Introducing Ponte: Arduino – Raspberry Pi Bridge | omer.me « IakovosNoteBook

  15. Brian Richmond says:

    The joining together of the r-pi and the Arduino is a marriage made in Heaven.

  16. David Anders says:

    just FYI there is already the core foundation for running arduino sketches from user space linux. all you would need is to map the i/o……

    https://github.com/prpplague/Arduino-for-Userspace-Linux

  17. Pingback: .NET i jiné ... : Odkazy z prohlížeče – 11.5.2012

  18. Pingback: Ponte: Arduino – Raspberry Pi Bridge | Pi Projects

  19. Ashley Basil says:

    You do not take the “do not conect pins” to the headers, eben says that in later mods these may be used, at the moment they are conected to ground, should you conect them, to future proof?

    • Omer says:

      I think we will stick to the published pinouts for the moment since we cannot really handle any more pins with the standard Arduino anyway. The design is simple enough that we can modify it when the next revision of the Pi comes out.

  20. Branedy says:

    It would seem like there needs to be a port of the DEC RT-11 OS to the Rasberry-Pi, if ‘Real Time’ is required, any takers?

  21. Forbin says:

    It might be a good idea to put jumpers in for the power to the Arduino side of the bus translators. You could then run the Shields with 3V logic or 5V logic. Even if you use 0 ohm resistors it does allow that change. I know it sounds a bit silly to have 3V 3V translators but they are then at least 5V tolerant on the Shield side. I have a couple of boards that run with a Maple and they rely on 3V logic. I also believe that the newer ARM SAM3S board that Arduino are going to eventually roll out also drives the bus at 3V logic and one that is out and about there will be a lot more 3V Vs 5V shield issues…

    Good work on the design. I can’t ever really see I will ever use the Pi till they release the internals to the Broadcomm chip though…

  22. Pingback: Arduino初探 - 康上明学的小白板

  23. Pingback: The Top 10 Raspberry Pi products for 2012 | Raspberry Pi-oneer

  24. Pingback: Raspberry Pi 到手 | 林健的BLOG

  25. Pingback: Measuring beer left in a keg - Page 4 - Home Brew Forums

  26. Pingback: Raspberry Pi 到手 | Arduino

  27. Adam Amott says:

    http://www.solarbotics.com/product/39290/ Would this work with the Ponte? Only because of it using analog signals and I don’t know if this converts analog signals, shields convert them, or if it just won’t work.

    • Omer says:

      The analog stuff shouldn’t cause an issue as long as you only use the first 4 pins (A0-A3, A4 and A5 are used for the I2C ADC on the board).

      The main issue is that the Pi only has one PWM channel (GPIO18, jumpered to D3) so it might restrict the usefulness of that shield. The basic functionality should work fine, though.

  28. jason newton says:

    Just wanted to check on the progress of this bridge. Any idea when we woudl be able to test one out :)

    I currently have an arduino controlling a semi-automated brewery (pumps, valves, elements etc…) but would love to have; A raspberry Pi to take care of the higher end processing controls / graphics and the arduino to interface with the brewery components.

    I just wanted to confirm that a bridge like this would allow me to use the analog, pwm and digital I/O’s on the arduino while controlling it on the raspberry Pi.

    • Omer says:

      There are a few limitations (like Analog pins 4 and 5 occupied by the I2C ADC since the Pi doesn’t have an ADC on it’s own) but overall it should be fine for most applications.

  29. Bruce Boyes says:

    What’s the current status of this adapter? We are working on some blinky/glowy demos for a coming trade show, using both RasPi and Arduino and could use this.

    • Omer says:

      The new revision of the PCBs and a bunch of parts are on my desk waiting to be hacked together, will post an update soon.

  30. Dejan says:

    Is it possible to stack two shields, like GSM/GPRS and Relay Module at the same time?

  31. Pingback: Ponte is our Fruit’s bridge

  32. Kai says:

    I’ve discovered something similar this week through Hack a Day. A bridge to connect the Arduino modules in Raspberry Pi: http://www.cooking-hacks.com/index.php/documentation/tutorials/raspberry-pi-to-arduino-shields-connection-bridge
    It’s from Cooking Hacks. Does anyone know it?

  33. Bonzadog says:

    I would like at least one Ponte,
    When will it be available and where can I order – preferably in Europe.

Comments are closed.