Friday, July 23, 2010

Adowhatnow? (Arduino and Atmel AVR Twiddling) : What is it?

Adowhatnow?   Your Humble Narrator introduces the backbone of several projects.

"Arduino" is an open-source set of hardware and software designed around the ATMEGA series of microcontrollers.  These are entire computers contained within a single chip.. with one of these chips, and a small number of external components, you have the framework for complex electronic projects and intelligent devices.   It's intended to be used by people not normally interested in getting their hands dirty in the inner workings- artists (kinetic sculptures), robot builders, students, and prototyping hobbyists.  In short, it simplifies the process of creating a special-purpose "smart" device.

When referencing Arduino, many people refer to the entire package- the chip, the on-chip boot software, and the programming environment- as a single unit.  In reality, nearly all aspects can be changed- the chips and hardware come in several flavors, as do boot software and the programming environment.  To deviate from the "package" is fine, but with certain tradeoffs.  Different flavor of hardware offer varying feature sets like memory size and operating speeds, while different development software platforms provide varying levels of programming ease traded off against efficiency.  Development languages run the gamut- from simplified Firmata Scripting to Assembly Language coding (not for the faint of heart).  There are even compiled and interpreted forms of BASIC which can be used.  Because it provides a nice balance of simplicity and power, at least at the outset I will be using the Arduino development language, which is similar to "C" and based on a scripting language called Wiring.  If you have ever done Java, Pascal, C++, or similar coding, then Arduino code should be easy to adapt to.  Since this is mainly a command and control device, and we don't want to get too bogged down in syntax, the Arduino language and IDE will serve nicely while still keeping the code simple.. I'm a firm believer that keeping things simple makes for a better outcome.  One nice aspect of the wide support base is that you can choose what you use- you don't need to change hardware if you change programming language and vice versa.

To start off, I chose a variant of the Arduino called a Boarduino.  I chose this variant because it offered several benefits for me over the "Off the Rack" standard Arduino.  First, the Boarduino came as a self-assemble kit, not a finished product.  It's been some time since I had done much electronic assembly, and considered that a well-designed kit would give me some much-needed practice soldering and handling components, while still being a project needing only an hour or so of relatively simple work.  Secondly, the Boarduino design minimizes the component count, minimizing the complexity.  Lastly, the Boarduino is extremely inexpensive, with the module components totalling around $15 per module, making it reasonable to dedicate a module to a "permanent" project.  The absolute minimum hardware implementation of the chip circuit can be had for under $10 on eBay and other online vendors as of July 2010.  Though underpowered for some of the projects I intend, there are Atmel processors which scale down to an eight-pin chip selling for under $2 each which still maintains a substantial amount of the function contained in the Atmega328/Arduino platform.  Conversely, Atmel and others produce similar but far more powerful devices at substantially higher cost also.  For my purposes, the chosen platform offers a nice blend of power while still fitting into a Hobby budget.

Boarduino kit, Assembled.  The birth of a new machine.

Boarduino kit, purchased locally but designed and sold by Adafruit.  The local seller is actually a college student who is an avid fan of the Arduino/Atmega platform.  In addition to the components and board for the Boarduino itself, included was a kit-form interface card to allow a home computer to communicate with it via a PC serial port, a solderless prototyping breadboard, and a small assortment of components (LED's, resistors, etc) to start out with.

 Assembled Boarduino parked happily on the breadboard.  Online assembly instructions for the module were fairly good, and would be able to be read and followed by a high school student with relative ease.  Even before I first powered it, I've decided this module would make an EXCELLENT project for any tech-minded teen.  Not only is the kit manageable, the module, when done, opens worlds of experiments for an inquisitive and creative mind. 

Boarduino module, along with assembled "Wulfden P4b" Serial-to-TTL communications board.  This board allows for programming of and communication with the Boarduino via a home computer.   Though useful as a computer interface, the module's real strength is that once programmed, the module only requires a battery to operate.. making it a totally portable, extremely low-power computing and control platform, perfect for small projects at low cost.    Though small, this module is substantially more powerful a computer than several of the first home computers I owned.

Solder-pad/header side of the Adafruit Boarduino module and Wulfden P4b Serial-to-TTL interface.  The total assembly time for the two boards was about two hours, including needing to desolder and resolder one component I installed incorrectly the first time.  For the electronics folks, I can say I am very pleased with the pin header layout- the fact that the module is designed for breadboarding is really apparent, with all signals and connections readily available.

So.. we have an assembled kit.  What now?  Stick around and see!