Adding I/O To The Rasberry Pi Models A & B

PiMagic RaspPi to Arduino Shield Interface

The Raspberry Pi has been the basis for many cool projects. Even so, Models A and B have been criticized for having only a handful of GPIO pins available. Sure, the new Model B+ has a 40-pin GPIO header but what if you want to use your old RaspPi with a bunch of in and outputs? [Steve] is one of those guys and has done something about it by creating a pretty neat solution he calls the PiMagic. It’s a Pi Plate that has an on board ATMEGA328 running an Arduino bootloader. The RaspPi and the Arduino communicate via UART as [Steve] felt it was a bit simpler than going the SPI or I2C route.

The RaspPi GPIO’s run on 3.3v and the ATMEGA328’s like 5v. To solve this, the PiMagic has a Level Shifter that keeps the I/O of the two boards happy. Older Pi’s had a problem burning out PCB traces when supplying too much current on the 5v supply line. [Steve] threw in a fuse that will burn out before the Pi does to ensure that no Pi’s were harmed in the making of this project.

Now that a bunch of I/O are available, how do you physically access them? Well, the PiMagic has female headers in the typical Arduino layout. This way any Arduino Shield will plug right in. [Steve] made all his source files available for those who want to make one themselves. Find an assembly video after the break.

19 thoughts on “Adding I/O To The Rasberry Pi Models A & B

  1. As far as I am aware the ATmega328P-PU (in the Arduino Uno) will run at 3.3V or 5V. The max clock speed spec is different and that’s about it.

    The real reason he wanted the 328 to run at five volts is that he wanted to to be compatible with Arduino shields and it is easier to level shit the small number of pins on the serial side to the Pi.

    1. They will run happily down to a couple of volts (I think about 2.5?), and the L variants are happy down to 1.8. Higher voltages are needed to obtain the higher clockspeeds though (most AVRs will reliably do 20MHz at 5V)

    1. Because I don’t think adding I/O was his real goal, honestly, because an I2C or SPI solution has huge benefits over some Arduino clone as far as I/O speed and flexibility. What was obviously wanted was an Arduino clone that could be programmed by the Pi without hooking up a cable. It’s a pretty cute solution, but I agree — it can be done far simpler if I/O is your main goal.

      1. “The RaspPi and the Arduino communicate via UART”

        Why not just use an ordinary normal arduino with a serial cable? For $3 you can get a perfectly fine USB serial cable on ebay that will supply power too. This contraption will not fit in any standard Raspberry Pi or Arduino case. If you use a normal arduino then you have lots and lots of enclosure options for both. You can physically separate them if you want. Heck you might as well upgrade to one of those arduino mega clones, they probably cost less than a handmade uno clone.

  2. What the raspberry pi needs is a shield with a half decent ARM SoC on it.. like any of the tens of boards out there that cost marginally more that the pi but are faster, have better IO.. sure it will cost more than just buying one of those boards but it’ll connect to the pi via a convoluted chain of serialisation and deserialisation involving at least 4 arduinos and shit so that gives it +10 shiny points.

  3. Thanks for the writeup Rich. Just to add that this also works with the new B+ just fine

    To answer a few questions:
    – In terms of compatibility with cases I’d suggest the PiBow Coupe for the B+ which it sits nicely on top of or the Farnell two-piece case just using the base part like in the photo above;
    – MCP23017 etc. … great if you just want an I/O expander but I wanted a reusable board also having analogue in and hardware timed PWM for some of my applications;
    – External arduino – would work fine, but I didn’t want to tie up a precious USB port (not an issue if you’re using a B+ or adding a hub, but this is more stuff to house);
    – Alamode – I did indeed look at this as a solution to my woes before embarking upon this design. The alamode has a RTC and micro SD slot, neither of which I actually needed. In this solution I wanted to keep things minimal, simple, through-hole and cheap.

  4. A couple of pages about “Rasspberry Pi to Arduino Shields” compatibility. It includes an open source library called “ArrduPi” to convert the Raspi GPIO in common Arduino I/O:

    Also for the new Raspby B+ model:

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.