Getting Choose the right controller for your Started with project and your skill level. BY TOM IGOE

I/O board: PicoBoard Programmable module:

Bare processor: PICAXE Single-board computer: Chumby

icking your first can be bewildering, because there are so P many on the market. Here’s what you need to know to get started.

TYPES OF CONTROLLER SYSTEMS don’t have to be attached to your computer. More I/O boards (examples: PicoBoard, Phidgets) expensive than bare processors, they make up for You don’t program these devices directly, but you it in convenience. For most people, this is the best can control their input and output (I/O) from a level at which to start. desktop programming environment like Scratch, Processing, or Flash. They don’t work when Bare processors (examples: Propeller, PICAXE) detached from the computer. If you’re familiar with These are the guts of the other microcontroller desktop programming, this is a good place to start. categories. You have to build all the supporting circuitry and connectors yourself, but they offer the Programmable modules (examples: Arduino, lowest price. These generally require an additional BASIC Stamp) These devices can operate inde- piece of hardware to program them as well. They’re pendently of your computer once programmed. better for more experienced hobbyists. Like I/O boards, they have a lot of the electronics onboard: communications, power management, Single-board computers Experienced program- and connectors. They require more learning than mers get excited about boards like the Beagle

I/O boards, but let you build smart things that Board or the Chumby. I don’t recommend starting Troxell Ed by Photography

42 Make: Volume 25

M_042-45_SS-MicroconSel_F1.indd 42 12/15/10 3:10:58 PPMM here. They’re usually more difficult to interface hard- ware to than simpler controllers. For experienced GET A STARTER KIT programmers, it’s too tempting to stay in software Here are some components you’ll need regardless rather than experimenting with circuits attached to of the platform you choose:

their board. For software beginners, the challenge » Breadboard » Speaker of getting an operating system started from the » LEDs » Servomotor bootloader can be an insurmountable hurdle. » Switches » Pliers » 10kΩ resistors » Wire strippers 220 » 220 Ω resistors » Diagonal cutters PICKING YOUR FIRST CONTROLLER » Photocells » Jumper wire Focus on ease of use. You’re learning to program » Potentiometers and learning to build a computer. Starting simple will keep your enthusiasm high. discussion threads. Do a few web searches for the Don’t be seduced by features. Apollo spacecraft microcontroller you’re considering. Is there a lot made it to the moon and back with less processing of collected knowledge available in a form you power than most microcontrollers have. Don’t be understand? If nobody besides you is using your tempted by the fastest, or the one with the most controller, you’ll find it much harder to learn, no memory or I/O, at the expense of simplicity. matter how great its features are.

What’s the “Getting Started” guide like? How easy is it to add extra components? The time you’re most likely to give up on micro- If there’s a particular component you want to work controllers is in the first hour. The Getting Started with, check to see if someone’s written an example guide should take you from zero to blinking an LED for how to use it with the controller you’re consider- or reading a switch in a short time. Read it before ing. Most controllers offer 16 or so I/O connections, you buy. If you don’t understand any of it, or it which is plenty enough to get started. Tools for doesn’t exist, be wary. expanding your I/O, such as shift registers and multiplexers, are compatible with most controllers. How complicated is the programming environ- ment? The program in which you write your code, Is your operating system supported? Most called the integrated development environment microcontroller manufacturers focus on the (IDE), should be easy to understand. Download the Windows operating system. Some have third-party IDE and check it out before you buy hardware. If support for Mac OS X and . Learning from you don’t feel you can understand it quickly, keep friends is common, and being able to have the looking around. same user experience on different operating systems is helpful for that. How expandable is the programming environ- ment? I/O boards and very simple languages make WHAT SHOULD YOU CHOOSE? getting started easy, but you’ll reach their limits For beginners, I recommend starting at the middle quickly. If you’re experienced in programming or level, with programmable modules. You can get your electronics, you want to feel liberated by a plat- first few projects going for under $100 including form’s simplicity, not limited by it. the controller and components. You’ll save yourself time not having to learn some of the messy details Is the programming environment free? If not, of the support circuitry, hardware programmers, or don’t bother. There are too many good free envi- setting up a development environment. ronments for a beginner to bother paying for the The first microcontroller you learn will most likely software alone. not be the last. It’s addictive. So start simple, and grow into the advanced tools as you go. What’s the community knowledge base like? There are lots of microcontroller environments You’re not just getting hardware, you’re getting a out there! I looked at 25 for this article, and only community. Every controller has websites and email scratched the surface. The following table covers 8 lists dedicated to its use; check them out, look at that I think are most interesting, ranging from I/O the code samples and application notes, read a few boards to bare microcontrollers.

Make: 43

M_042-45_SS-MicroconSel_F1.indd 43 12/10/10 3:07:30 PPMM SIMPLE

I/O boards Programmable modules

PicoBoard Phidgets Lego Mindstorms BASIC Stamp 2 $50 picocricket.com/ $78 phidgets.com $280 mindstorms.lego.com $49 parallax.com picoboard.html Phidgets are specialized Lego Mindstorms kits are The granddaddy of the hob- The PicoBoard is a USB- hardware blocks that give Lego’s entry into the pro- byist microcontroller market based hardware accessory your personal computer gramming market, done as sets the bar for a simple to the Scratch programming added physical functionality. only they (and MIT) could do. programming language, language. If your kids know Besides general sensor I/O, The language is slick and fun, good starter kits, and excel- Scratch already, it’s a great there are RFID modules, the parts are way cool, and lent documentation. Several way to introduce them motor control modules, just putting things together models offer more speed, to taking input from the and display modules. If you gets the geek in you excited. memory, or both. Parallax physical world; you just read already know how to code, You’re somewhat locked into also sells sensor modules, the inputs via the Scratch there’s an API that’ll let you the (expensive) Lego world if actuator modules, project board watcher. It’s more talk to a Phidget as easily you choose this as your main kits, robot boards, and good limited than its cousin, the as talking to a mouse or platform, but it’s a fun world development boards for PicoCricket kit ($250), but keyboard. in which to be locked. beginners, along with lesson a whole lot cheaper. plans and teaching guides. Runs on: Windows, Runs on: Windows, Mac OS X Runs on: Windows, Mac OS X, Linux* Requires: Lego Mindstorms Runs on: Windows (third- Mac OS X, Linux* Requires: Sensor modules, NXT 2.0 kit 8547 party applications are avail- Requires: USB A-to-B cable $7–$100 each Inputs/outputs: 3 motor able for Mac OS X and Linux) Inputs/outputs: Built-in Inputs/outputs: 8 analog ports, 4 sensor ports, USB Requires: USB-to-serial button, slider, light sensor, in, 1 digital in, 8 digital out port, speaker, buttons, converter, $15 sound sensor, 4 stereo jacks (model 1018 interface board) display Inputs/outputs: 16 general with alligator clips Languages: Director, C++, Languages: Mindstorms I/O plus 2 for dedicated Languages: Scratch* C#, Cocoa, Flash, Flex, Java, visual language, based on serial. No analog input, but Getting Started guides: Max/MSP, Visual Basic, etc.* LabVIEW you can fake it with RCTime. Short, clear, and simple Getting Started guides: Getting Started guides: Languages: BASIC with good examples. Guides and code samples for Guides are clear and step- Getting Started guides: Knowledge base: each language are clear. Not by-step. Build instructions Manual is clear and thor- • Good examples on site many sample projects, but are excellent. ough, but dated: still uses • Small knowledge base, but plenty of user-contributed Knowledge base: 9-pin serial cable; doesn’t large collection of Scratch examples on the web. • Good tutorials on site and take advantage of what a examples on the web that Knowledge base: bundled with kit micro can do. could be expanded through • Lots of code samples in • Plentiful examples on the Knowledge base: the use of the PicoBoard many languages on site web from users • Many excellent examples Pros: • Plentiful examples on the Pros: on Parallax site • Very simple, fun way to web at large • Graphical programming • Countless examples on introduce kids to physical • Lots of sensor and special language is great for people the web interfaces function modules who’ve never programmed • Parallax has a ton of appli- • Alligator clips — explore • No electronics work and are intimidated by text- cation notes and curriculum the electrical properties of required based languages plans for classrooms anything! Pros: • Kit comes with Lego parts Pros: • Inexpensive for an I/O • Simple hardware interface so you have building • Very large knowledge base board for experienced software materials • Simple language Cons: developers • No electrical debugging: • Multiple models • Not programmable • Lots of modules that parts all work and are • Lots of project kits and • Limited I/O work with no electronics sealed accessories available • Must be attached to knowledge • Parts are well-designed Cons: a computer Cons: and machined; they stay • Language is limited: • Very expensive for what together no block IF statements, you get. Compared to • Looks way cool no passing of parameters * The I/O boards are programmable modules, Cons: to functions not programmable; the average project cost • The leap from here to • No analog inputs APIs to control them can be 2x–3x more a text-based language is • Best getting-started guide, are available in these • Not programmable difficult for some beginners What’s a Microcontroller? languages. • Must be attached to • Price is high if you just costs $25 a computer want to do micro- Note: Consider using the ** Full disclosure: I write controller projects similar but more powerful a lot of the Arduino • You don’t really learn elec- BasicX BX-24 ($50, basicx. tutorial material, so tronics; you learn construc- com), which is pin-compatible I am biased. tion and interaction logic with the BASIC Stamp 2.

44 Make: Volume 25

M_042-45_SS-MicroconSel_F1.indd 44 12/10/10 3:06:59 PPMM COMPLEX

Bare controllers

Arduino Netduino PICAXE Propeller $30 arduino.cc $35 netduino.com $3–$11 rev-ed.co.uk/picaxe $8 parallax.com An open source platform Newcomer Netduino is the The PICAXE is a BASIC The Propeller is Parallax’ designed originally for first ARM-based microcon- compiler for the PIC multi-processor controller. artists, designers, and troller module under $50. microcontroller. Revolution It’s very powerful computa- other technical beginners. It follows the Arduino form Education makes 3 IDEs: tionally, able to do multiple Descended from the factor, so it should be able the main Programming tasks at once by running Processing programming to take Arduino shields. The Editor (Windows only), 8 processors simultaneously. language, it’s got an easy- IDE and language are intimi- Logicator (Windows only), It’s available as modules or to-use IDE that runs on all dating for coding beginners, and AXEPad (Windows, Mac bare processors and it can 3 major platforms. There are but Secret Labs promises OS X, Linux). The first two do a lot: video, music play- several models for specific expanded support for other allow BASIC, or programming back, and more. It’s not great applications, and dozens languages and platforms in by laying out a flowchart; for beginners, but for the of third-party derivatives. the near future. the latter is text-based only, experienced programmer It’s expandable through and lacks the debugging it’s impressive. breadboard circuits as with Runs on: Windows (support features of the others. other controllers, or through for Mac OS X and Linux in Runs on: Windows (third- special-purpose “shield” Mono is promised soon) Runs on: Windows (IDE is party application available boards that stack on top of it Requires: USB A-to-micro-B available for Mac OS X and for Mac OS X and Linux) to add functionality such as cable Linux, with fewer features) Requires: Prop Plug, $15, motor drivers, Ethernet con- Inputs/outputs: 20 general Requires: Programming plus clock crystal, assorted nections, and many others. I/O, including 6 analog, cable, $4, and breadboard support components 4 PWM adapter, $26 Inputs/outputs: 32 Runs on: Windows, Languages: C# Inputs/outputs: Various: Languages: Spin Mac OS X, Linux Getting Started guides: 5 for PICAXE-08, 32 for Getting Started guides: Requires: USB A-to-B cable Clear and well-written. PICAXE-40X2 There is no Getting Started Inputs/outputs: 20 includ- It took only a few minutes Languages: BASIC guide. Reference manual is ing 6 PWM, 6 analog in to get an LED blinking. Getting Started guides: very thorough, but it’s not Languages: Wiring/Arduino, Knowledge base: Well-written, with lots of for the beginner; assumes C/C++ • Small knowledge base tutorials. Once you’ve familiarity with computer Getting Started guides: so far assembled the microcon- architecture and assembly Clear step-by-step instruc- • Several user-contributed troller circuit on a board, language syntax. tions, from download to tutorials getting an LED blinking is Knowledge base: blinking LED.** • Videos on the website for very quick. • Plentiful examples on Knowledge base: blinking an LED and read- Knowledge base: Parallax site, and some • Many simple examples ing a switch are clear and • Many examples on user-generated code on the included with download** succinct, but tutorials don’t Revolution Education site web — but not many basic • Good reference guide to explain all the code that • Plentiful examples on the examples the commands shows up when you make web Pros: • Large knowledge base on a project • PICAXE BASIC is similar to • Inexpensive to get started Arduino site and elsewhere • There’s an advanced tuto- Parallax BASIC, so code is • Multiple-core processor Pros: rial on event handlers, but easy to convert allows multitasking and • Can be run as I/O board, no basic tutorial on analog Pros: other complex functions using Firmata firmware input, PWM, or serial • Inexpensive to get started Cons: • Very large knowledge base Pros: • Simple language • Requires more circuit- • Simple language, but • Compatible with Arduino • Graphical programming making ability than expandable using C/C++ shield modules option (Windows only) programmable modules • Multiple models, for • ARM processor allows for • Helpful code wizards • Language is too compli- shields, breadboards, multitasking and event (Windows only) cated for beginners — more wearables, extra I/O pins handlers • Multiple hardware versions like assembly language than • Many shield modules Cons: • Plenty of examples any of the others • Large number of open • Installation took me 60 Cons: source derivative boards minutes, during which I was • Requires more circuit- Cons: able to complete installa- making ability than Tom Igoe is an associate • C language constructs tion for all the other tools programmable modules arts professor at the Inter- (semicolons, brackets, case mentioned in this article on • Language is limited: no active Telecommunications sensitivity) are confusing another machine block IF statements, no Program (ITP) at NYU (itp. for some beginners • Microsoft Visual C# Express passing of parameters to nyu.edu), a co-founder of 2010 IDE is complex, not functions the Arduino microcontroller good for beginners platform, and the author of Making Things Talk.

Make: 45

M_042-45_SS-MicroconSel_F1.indd 45 12/10/10 3:07:47 PPMM