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.
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.
Exactly – thanks Bob
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)
Why not just a couple of MCP23017 or MCP23S17s?
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.
“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.
I think its a good solution. I can now have a 3d printer connected to the web via octoprint, in a relatively smaller package
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.
Or one can just go get an STM32 nucleo board for $10
Where does one attach the raspberry pi to that? you have to keep in mind that a pi must be involved even if it makes no sense.
Just like this project: The serial line.
How about the RPiSoC? Full disclosure, I’m the creator of it. But I think it really is the most capable expansion board that I’ve seen. And it can be used standalone besides, unlike simple expansion chips.
hey Robert, there is a mountain near Juneau Alaska named after you!
Really, who cares about 5V these days? Most chips I want to integrate support both 3.3 and 5V operations. 3.3V off batteries is so much easier to implement than 5V too.
How’s this any different from the Alamode (http://wyolum.com/projects/alamode/) thats been available for a really long time?
Not really an original idea/design… Credit due?
Reinventing the wheel does not mean he copied the wheel, or even was inspired by it. I think it’d be polite to assume that if credit were due he’d give it.
with some hot melt glue, you can attach anything to anything
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.
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:
http://www.cooking-hacks.com/blog/raspberry-pi-arduino-shields-connection-bridge-and-new-raspberry-model-b-board-full-compatible
Also for the new Raspby B+ model:
http://www.cooking-hacks.com/documentation/tutorials/raspberry-pi-to-arduino-shields-connection-bridge