I became a late adopter of a number of technologies (among them - LTSP, Google Apps and XQuery) in a similar way. A technology looks interesting when I encounter it for the first time. It keeps popping up for years. I think it is not for me. Then, a problem arises, and that particular technology turns out to be the solution.

Finally, the same happened to Arduino. I knew about it. It used an unfamiliar word “microcontroller”. And usually robots were involved, and I am not into robots :) I ignored it; not any more. Here is my story so far.

The Problem

Recently, I decided to look into a way to trigger my photo camera when a drop of water breaks a (laser?) beam. Or - capture a mouse in flight. Or a bursting balloon. Or a growing flower. While researching this problem, I kept bookmarking (on delicious, of course) various sites. That is why I know when it brought me face-to-face with Arduino. It started on April 21st, 2010.

I found two commercial devices designed for automating photography I saw them mentioned in photography books (for instance, in an excellent Mastering Canon EOS Flash Photography by NK Guy). One is called Stop Shop, and it costs $300 (without sensors). The other one is called Universal Photo Timer, and it costs $165 (again, without sensors). (Later, I became aware of a $325 Time Machine and Kapture Group’s Toolbox that starts at $2,095!)

That seemed to me to be too much for the few times I might use it. So I decided to find out what would it take to interface some sensors and triggers to a computer somehow, and just do it myself.

For a time, I though of connecting a sensor instead of a mouse button. I’d need to convert an analog signal from the sensor to digital (“yes” or “no”) with a comparator, and read the mouse events in the computer… All this is doable, but not elegant nor flexible.

Then, I found Phidgets, who sell I/O boards and sensors that connect to them. They enjoy good reputation for quality-built products. Their basic I/O board costs $80, which is still a little too much, but I was almost ready to go for it.

And then I did a Google search for “I/O board”, and the first two links were to Arduino. At first, I did not understand why. But then (on April 27th, 2010) I realized that Arduino is an extendable I/O board with a micro-controller And on May 4th, a very trustworthy source (Dan’s Data) published the pro-micro-controller piece

Interfacing

Arduino provides analog-to-digital converters (on the micro-controller chip itself), so there is no need for comparators: comparison with the threshold is done in software! Of course, there are digital inputs also, so buttons can be read directly in software.

Digital-to-analog converters are also provided, as are digital outputs. LEDs can be made to blink (and their brightness controlled). Stepper motors can be made to turn and relays to close.

Arduino is an I/O board: it facilitates interfacing of sensors and effectors to a computer. But the devices are not connected directly (through memory-mapped ports and such). Instead, computer is interfaced (through a USB port) with the micro-controller on the Arduino board. This micro-controller in turn, is interfaced with the sensors etc. This roundabout way of interfacing means that for a computer to be able to talk to the sensors and effectors, a program (“a sketch”) has to be uploaded into the micro-controller.

One way to write this program would be to define commands using which the computer would read the sensors and trigger the effectors. With this approach, the computer is running a tight poll loop, wasting resources. Also, since communications channel between the computer and the Arduino board is relatively slow (serial over USB), the polling cycle may be too long.

An alternative way is to do polling on the micro-controller itself, and only send notifications of changes to the computer. This approach saves both resources of the computer and the bandwidth of the connection. It is the approach taken by the Firmata project and its protocol.

Surprisingly, there is no standard Java binding for Firmata (as far as I know). I did not like the sample floating around: it is, in my opinion, insufficiently object-oriented and unnecessarily tied to Processing. So, I did the usual: wrote my own Java binding for Firmata.

Note: Some say that if the comparator is used together with the micro-controller it is “only interrupted when the digital signal changes”, and does not need “to spend most of its time reading the phototransistor’s voltage in order to detect a passing line or mark”, but I do not yet understand how that works :( Maybe it is time to read some documentation on the micro-controller used by Arduino…

Embeddability

Since the board has a micro-controller it is possible to program it so that the project behaves as designed without the connection to the computer. Instead of the specialized schematics of the earlier days of electronics, a general-purpose device is given its purpose through firmware. This way, modifications are much cheaper and easier.

Of course, it would be nice to be able to program an embedded board in Java. Indeed, single-board computers that run Linux and Java are available - for instance, this one from Phidgets is very nice. It costs $265. Also, there is BeagleBoard for $150. Arduino board, on the other hand, has to be programmed in single-threaded simplified C++. But it costs $30.

And if embedding an $30 board in a project is not feasible, there are cheaper Arduino boards specifically designed to be embedded. Also, there are ways to build an Arduino-equivalent board (with some space for expansion) for $8!

Connectivity

Contemporary micro-controller-based devices are also very connectable.

It is possible to connect an Arduino board to an Ethernet network.

Bluetooth connectivity is available. Some robotics projects use an Android phone as part of the robot, and use Bluetooth as connection mechanism. (Others use the standard cable for data transfer and power :))

There is also a very appealing radio module: XBee, a ZigBee implementation. This relatively cheap device helps connect Arduinos to one another, and to the main computer. Or - to remotely program an embedded board. Since XBee itself has a micro-controller on chip, in some, even an Arduino is not required!

Photo Triggers

Of course, after I realized that Arduino can be used to trigger my camera, I found an article from the (excellent) Make magazine that describes such a device. I subscribe to Make, so I have that issue. And I even have bookmarked the article when I first read it!

Here is a selection of photo triggers, timers and intervalometers using Arduino:

An interesting text on remote triggers (pdf).

General Electronics Books and Resources

Although a lot of circuitry that was necessary previously is supplanted by the Arduino board, some interfacing issues remain, and basic knowledge of electronics is unavoidable. I mean questions like those:

I found some books that can help.

MAKE: Electronics: Learning Through Discovery by Charles Platt. Excellent introductory book.

Practical Electronics for Inventors by Paul Scherz. Big. Uses water analogies too much ;) Seems to have the information, though. Third edition is coming out in January 2013.

Getting Started in Electronics (and others) by Forrest M. Mims III. A little too short and elementary, I think. Some like it, some don’t.

There are also on-line sites worth looking into, for instance: http://www.electronics-tutorials.ws. Lady Ada (Limor Fried) of AdaFruit has a lot of information on her site, and so does another Open-Source Hardware enterprise - SparkFun.

Arduino Books

There are some Arduino-sppecific books. More are coming out. I found some good ones.

Getting Started with Arduino by Massimo Banzi. Very introductory, but nice and sweet. Written by the originator of the whole Arduino fenomenon.

Making Things Talk: Practical Methods for Connecting Physical Objects by Tom Igoe. Connectivity is the topic of this book, which is very good.

Practical Arduino: Cool Projects for Open Source Hardware by Jonathan Oxer and Hugh Blemings. Skim the book even if a particular project does not appeal to you: they introduce general ideas, libraries and techniques in-line!

Programming Interactivity: A Designer’s Guide to Processing, Arduino, and Openframeworks by Joshua J. Noble. Some people like it. I did not like it at all and returned it.

Arduino Cookbook by Michael Margolis.

Building Wireless Sensor Networks: with ZigBee, XBee, Arduino, and Processing by Robert Faludi. For about 10 years, I read about many O’Reilly books that they are sloppily edited, uncharacteristically for O’Reilly. I think it is time to admit that sloppy editing is characteristic for O’Reilly :) This one also suffers from sloppy editing, bad structuring and condescending jokes. Nevertheless, there is enough crucial information in the book to justify both the price and the unpleasantness. Just do not expect to enjoy the process of absorbing the information :)

Where to Buy

There many suppliers of electronics parts. The biggest and most popular are: DigiKey, Mouser, Jameco, Newark. So big and popular they are, in fact, that there are tools that help you find cheapest part when it is made by multiple manufacturers!

There are quite a few places that supply parts for Arduino (and similar) Open-Source Hardware designs. For instance: SparkFun Electronics, AdaFruit Industries, Liquidware.