Using the Arduino IDE with the Gertboard

If you are familiar with the Arduno IDE on any other platform, then there should not be any surprises using it on the Raspberry Pi with the Gertboard.

There is one notable thing you need to do to make it work though, and that is to select the correct programmer and device before you upload a sketch to the ATmega.

To do this, launch the Arduino IDE and select:

Tools -> Board

and select either the Gertboard with ATmega328, or the Gertboard with ATmega168 options.

Next select:

Tools -> Programmer

and select the Raspberry Pi GPIO option. You should be ready to go after that.

Load up the

Examples -> Basics -> Blink

sketch and upload it to the ATmega. To actually see it doing something, you’ll need to connect a jumper wire from pin 13 on the ATmega (That’s PB5 on the Gertboard) to one of the buffered drivers set to output mode.

Note: to upload you must use the

File -> Upload using programmer

Method if the normal method doesn’t appear to work for you. (The standard method seems to assume it’s using a serial port and sometimes gets confused, so use this method, or type the Ctrl+Shift+U shortcut rather than the normal Ctrl+U)

Serial console access

To access the serial console on the ATmega it’s probably easier to use a separate program to the Arduino IDE, and minicom is recommended.

sudo apt-get install minicom
cd /etc/minicom
sudo wget http://project-downloads.drogon.net/gertboard/minirc.ama0

then you can simply type (in a terminal window)

minicom ama0

to open up the serial port. It’s defaulted to 9600 baud, but that should be fine for most of the demo sketches.

Note: You may need to add the ‘pi‘ user into the ‘tty‘ group to be able to access the on-board serial port. If you get a permissions denied type of error, then run this command:

sudo adduser pi tty

for other Linux distributions you may need to check the permissions and ownership of the /dev/ttyAMA0 device and adjust accordingly.