Arduino, Gertboard, and the Raspberry Pi

One of the kids at the saturday pi club had this fantastic idea, which was to build a small computer inside an airfix model they are building. The purpose of the computer would be to control various lights on the model, and perhaps make some sounds. It has to be small, run from a battery, and allow sequences to be programmed.

At first glance, this doesn’t seem like a good fit for a Raspberry Pi. However, we have some GertBoard’s at the club and have been experimenting with them for other projects. Having met Gert Van Loo a few weeks ago myself at an event at Broadcom, I knew that he had put an Atmel processor on the board, so that started us thinking.

While the Raspberry Pi itself would be too big and too power hungry to fit inside the model, it would be possible and appropriate to squeeze something like an Arduino Mini in there. A quick look at the spec on the web, it has 14 GPIO’s, runs from 7-9V, and is pretty tiny.

Today, we pretty much followed the instructions in the GertBoard user guide, which pointed us at this link where Gordon has some excellent (and perfectly correct) instructions on how to set up the IDE, along with some pre-rolled scripts that set up all the necessary links.

There were a couple of things we tripped up on:

1) We kept getting an error on programming: “arduino avrdude content verification error content mismatch at 0×0000″. Not too much help on the forums, but a quick look at the schematics in the GertBoard manual, poked some probes on the power supply and read back 2.4 volts from the Atmel chip. That’s odd, thought it should be 3.3V? The Atmel chip data sheet says it runs down to 1.8V, but that’s still a bit odd. Fitting the 3V3 jumper on the GertBoard that brings the Pi 3V3 through to the Atmel solved the problem, and we were able to program it.

2) The LED flashed a lot slower than we expected, and we thought it wasn’t working, about to give up, then noticed it turn off. It was running 10 times slower (once every 10 seconds, not once every second). Looks like the onboard clock (RC) runs a lot slower than the default clock rate set in the Arduino IDE.

Soon, we had the Blinky sketch running on the Gertboard flashing an LED. This will be the basis for our next project: working out how many LEDs we want, and whether 14 pins is going to be enough for all the features needed – there was some excited talk of sound generation, motion sensing, and bluetooth control from an Android phone!


1. Because the gertboard 3V3 jumper was not fitted when we first ran avrsetup, the on chip fuses were not programmed, so the chip was using it’s onchip clock (10 times slower) rather than the one on the gertboard. Re-ran avrsetup and it now runs the correct speed using the onboard crystal.

2. The¬†ATmega328P costs ¬£1.71 in qty 10 from farnell. We’re thinking of totally bypassing the gertboard and using one of these adafruit boards to attach a chip directly to the RaspberryPi.

3. The arduino IDE is a dream to use on the Raspberry Pi, which means you can program the chip directly. The IDE has been hacked so it uses the Raspberry PI GPIO pins to do the programming directly. Thus, you don’t really need any arduino hardware (just the chip) which makes it a very low cost solution. You can then remove the board from the RaspberryPi and it runs code standalone, or leave it attached to use it as an I/O processor (see Amy Mather’s Game of Life on youtube for an example of why this is useful)



This entry was posted in Older Stuff. Bookmark the permalink.

Comments are closed.