Simplified Setup for Arduino on Raspberry Pi

I just got back from the Open Hardware Summit and World Maker Faire. It was fantastic and I spent a day and a half doing demos of Alamode and the Raspberry Pi in the Makershed. I’ll have more on that later, but I got a lot of questions about setting up Arduino, and I realized that things have been simplified since my last blog post on the subject.

I recommend you download the latest raspbian (these instructions are for that version.)

2012-09-18-wheezy-raspbian

After running through the setup (raspi-config) which runs automatically the first time do a:

$ sudo apt-get update
$ sudo apt-get install arduino

You used to have to get the avrdude and gcc packages separately and install them in an unzipped version of arduino, but there’s now an up-to-date package. This works out of the box with FTDI Arduinos, but Uno’s /dev/ttyACM0 and the Raspberry Pi /dev/tty/AMA0 aren’t recognized by the Arduino IDE. To do that we create some “udev rules” that create symbolic links to those devices that are named /dev/ttyS1 (uo) and /dev/ttyS0 (alamode) respectively.

I created a setup script to do the hard work for you (note the $ represents the command prompt, don’t type that!):

$ wget https://github.com/wyolum/alamode/blob/master/bundles/alamode-setup.tar.gz?raw=true -O alamode-setup.tar.gz
$ tar -xvzf alamode-setup.tar.gz
$ cd alamode-setup

If you want to be ready to run Alamode, and the Uno run:

$ sudo ./setup

which disables logging and getty on the internal serial port (so you can use it to program alamode), sets up the /dev/tty links, and installs a modified avrdude that has a new programmer type, -c alamode. This should be completely safe, as I only and (I think properly) added a new programmer type, but I haven’t tested it thoroughly on other programmer types. It also sets up the board type for alamode in the Arduino IDE.

reboot to get rid of the logging and getty.

If you just want Uno support, type:

$ sudo arduino-setup

Here you probably don’t have to reboot, just

$ sudo udevadm trigger

If you want Bonjour, which will allow you to refer to your raspberry Pi on the local network as raspberrypi.local

$ sudo apt-get update
$ sudo apt-get install libnss-mdns