[Arduino Uno]

Fun with Linux and Hardware -- notes

Arduino

Tiny board with an Atmega AVR CPU. Open-source hardware, $30 (less for generic copies or if you make your own). Doesn't run Linux, but can be programmed from Linux easily.

Arduino variants

Arduino development

Get the Arduino IDE: arduino.cc/en/Main/Software.

Do this even if you prefer command-line development: you'll need the libraries.

Unpack: tar xvf arduino-1.0-linux.tgz

The IDE is a Java app. To run:

cd arduino-1.0
./arduino

If the IDE doesn't see a serial port, there could be a permissions problem. Check to see whether /dev/ACM0 (Uno) or /dev/ttyUSB0 (earlier Arduinos) exists, and whether it's readable and writable by you. On Ubuntu, you may need to be in the "dialout" group.

If you prefer not to install Java or prefer command-line development, unpack the Arduino tarball (you'll need the libraries) then follow the instructions (and grab the sample Makefile) on my Arduino command-line development page. Most Linux distros have all the packages you'll need.

Graphics

Many Arduino projects use Processing for graphical output. It's a programming language built on top of Java, which can be used from its own IDE or from Java libraries.

I haven't used Processing much myself. But check out the cool example on the Processing Wikipedia entry.

There's a related project called Wiring intended to make it easier for artists and designers to drive microcontrollers like the Arduino. The Wiring website also has lots of beginner tutorials on basic electronics. Again, I don't have any personal experience with this (yet) but it might be worth checking out.

Arduinoscope

There are actually three Arduinoscope projects:

They all use Processing, which you'll have to download separately (it's a Java app) except for Arduinoscope, which comes with its own copy of the Processing libraries and is easier to run than the other two.

However, Arduinoscope has a bug: it doesn't work with the Arduino Uno (the current model) because it tries to open /dev/ttyUSB0 instead of /dev/ACM0. So to use it with an Uno, you have to make a symlink, as root. Or fix the line in SimpleSerialArduinoscope.java that does port = new Serial and then figure out how to recompile it. If you figure that out, please tell me.

Meanwhile, I'm working on a Python version: scopino. It's still pretty crappy, but it'll get better.

Arduino shields

See the Arduino shield list for a full scary-long list!

Some common shields: motor/servo, networking (XBee, ethernet or wi-fi), data logging, GPS, sound/music, voice recognition, simple LCD displays, LCD touchscreen, gaming, LED arrays, gaming.

Of special interest: proto-shields that offer space for a breadboard and make it easier to prototype simple circuits.

My first Arduino came with a proto shield and mini breadboard; I probably wouldn't have thought to buy one on my own, but since I have it, I use it for everything and would hate to be without it.

Tips on driving motors

I mentioned my motor troubles in my talk. I'm planning a long blog article on this soon, but let me summarize the options here:

Driving other high current devices (besides motors): for alternating current (like blinking a desk lamp, or turning on your computer at a particular time of day) I recommend the Powerswitch tail. Very easy to use and I haven't seen any other product like it -- it'll save you a lot of time. For high current DC, Freetronics just introduced something called the NDRIVE: N-MOSFET Driver / Output Module that looks pretty useful for $7 if you don't want to hassle with building your own transistor circuits.

Electronics parts you want

More info on my demos

Source code for the projects I presented: Akkana's Arduino code.

I've blogged about most of the projects: see the Arduino tag on my Shallow Thoughts blog.

I haven't blogged the details of the shark yet (too busy working on the talk!) but check back: I've uploaded the source code (as of Monday morning) and will try to write the blog entry in the next few weeks.

Places to buy parts

Books

Native Linux solutions (ARM based, running Linux natively)

I didn't have time to cover these in the talk, but sometimes you want something with a little more power.

Most of these devices (except plug compters) have some digital I/O pins; none of them have analog input like the Arduino.