Bleeding edge: Arduino on Raspberry Pi

Well, Arduino doesn’t “just work” even with the instructions I gave in my last post. If you don’t “prepare”  your distro carefully, you’ll run into the comm problems I did (and thanks to Mark Amos, for pointers and encouragement!).

First, make sure you have a good power supply both for your Pi, and for your USB hub.

My belkin hub (one would think it would be good) would drop the mouse as soon as the Arduino IDE started up.

I ended up using a Staples hub (I can’t find it on their website, must be older.) powered off a 2 port Belkin USB power supply. I’m using a separate high amp Griffin USB power supply for the Pi.

I was having a problem in which I could download programs via AVRdude, but the Arduino IDE would have communication problems, and then the ports would be locked after Arduino was exited.

I believe the problem was due to me not setting the timezone, and date on the Pi. I think it didn’t like living in 1969.  I don’t know if this was a problem for the software install, or the port handling by Arduino, but once I properly prepared, everything worked!

I’ve rebuilt the system several times and here are a few tips.

I’m using debian squeeze from the Raspberry pi site, and it defaults to a British keyboard layout. That’s fine if you’re there, but some of the following edits will be painful unless you change:

[code]sudo dpkg-reconfigure keyboard-configuration
sudo dpkg-reconfigure tzdata[/code]

reboot

Before getting any of the other packages:

[code]sudo apt-get update[/code]

and again:

[code]sudo apt-get update[/code]

FTDI Arduinos work fine with the driver loaded in the last post, but the UNO isn’t recognized right away. This is because the IDE only looks for certain names (/dev/ttyUSB1, /dev/ttyS0 etc.)

Once again the RaspberryPi@homelabs blog comes through:

GarretT says:

[code]

There’s a little hack you have to do to make the IDE work with UNO. I think it stems from the way the code checks for serial devices.

1) Before running the Arduino IDE, plug in your Arudino UNO.
2) Observe that there is now the device /dev/ttyACM0 writable by the dialout group of which pi is a member.
3) Make a hard link ttyS0 to that device. It’s a little easier if you cd to /dev.

cd /dev
sudo ln ttyACM0 ttyS0

4) Start the Arduino IDE and load a sketch.
5) Under Tools->Serial Port select /dev/ttyS0
6) Upload your sketch. Sweet!

[/code]

Likewise you can link the internal UART:

[code]
sudo ln /dev/ttyAMA0 /dev/ttyS1

[/code]

I hooked up an Arduino Pro 3.3v, and by holding down the reset until the IDE says “downloading” I was successfully able to download to it via the GPIO mino UART

Important Note: Those hard links go away with each boot, so you have to make them again each time you reboot before running the IDE.