NUTS AND VOLTS

Posted in: Developing Perspectives

The Microcontroller Debate

June 2010 Bryan Bergeron

If you’re an experienced microcontroller experimenter, you probably have a favorite chip or configuration — maybe a Microchip PIC, a Parallax BASIC Stamp or Propeller, or an ATMEL-based Arduino — and good reasons for your choice. Moreover, if you’ve worked with a particular microcontroller on several projects, you’ve no doubt developed a bag of tricks and workarounds that enable you to do just about anything you want. I’m sure you can defend your choice based on relative cost, performance, or ease of use.

However, if you’re just starting out in your exploration of microcontrollers, you have some decisions to make. Picking a microcontroller line is a big step, and one that deserves a bit of thought. The initial cost of the chip or board is typically trivial compared with the cost of accessories, books, and — most importantly — your time. You’ll have to invest time to learn how to properly configure the hardware, time to become fluent in the programming language, and time to get used to debugging the system.

Before I offer my advice, let me state that there’s no single best solution. Every product on the market has strengths and limitations. If you drop into the various forums on the web, you can read the myriad opinions why one particular microcontroller is better than all the others. The solution that’s best for you depends on your experience and what you expect to get out of working with a microcontroller.

In my opinion, if you’re new to microcontrollers, you can’t go wrong with the BASIC Stamp line of microcontrollers. A major strength of the Stamp is documentation — critically important to a novice. There are hundreds of articles and dozens of books devoted to the Stamp. Moreover, Parallax offers educational kits that include sensors and servos, and extensive documentation and source code for these peripherals. The Stamp boards are simple to set up and program. Even if you’ve never touched a microcontroller before, you can be up and running in less than an hour. The BASIC Stamp is still my microcontroller of chioice if the application has to be ready yesterday.

Parallax also sells a higher-performance Propeller chip. I’ve used the Propeller on several projects, and it’s both powerful and relatively easy to program. However, I think a novice might have a rough time getting the most out of the cogs and other non-standard architecture of the Propeller. This unique chip also uses a non-standard language called SPIN. If your goal is to understand different microcontroller architectures, then the Propeller chip may be just the thing for you. However, knowledge of SPIN doesn’t readily translate to other microcontrollers on the market.

When I started developing semi-autonomous robots, I was forced to look for something more powerful than the Stamp, and turned to the ATMEL line of processors. The cost for this step up in processing power, number of I/O ports, and other features was considerable. Instead of a simple USB connection between my PC and the Stamp, I had to purchase and learn to use a programmer. Then, there was the C compiler and the compile-run process instead of the instantaneous, interpreted Basic with the Stamp.

In retrospect, the progression from Stamp to bare ATMEL microcontroller was fortunate. It allowed me to learn to use a variety of sensors and servos in an interactive environment. In the less forgiving, more time-consuming compiler environment, it would have taken me much longer to learn to use the hardware. I think the same analysis holds true for the PIC — which I consider a top-notch production chip that can go toe-to-toe with the ATMEL.

I can’t speak from experience on the Arduino as a first microcontroller. However, it was designed as a painless introduction to microcontrollers, and it appears to be successful on that account. I’ve worked with the programming environment – which, by the way, is compatible with a Mac – and it’s solid and easy to use.

Moreover, there are dozens of add-on boards or shields, and multiple form factors to choose from. For example, I’ve used the Duemilanove — an ATMega328-based board — and it’s a pleasure to work with. I’m currently working on the LilyPad: a machine-washable, sew-on version of the Arduino from SparkFun (www.sparkfun.com) to try out some body network ideas.

If you’re deciding between the BASIC Stamp and Arduino for a beginner’s system, then relax. You can’t go wrong with either platform. However, if you want to learn or know how to program in C, then the Arduino is probably a better choice. On the other hand, if you’re comfortable with Basic and your focus is to learn about sensors, actuators, and other peripherals, then the Stamp may be a more efficient vehicle. I also think the Parallax-backed support forums are second to none — something to consider when you need help sorting out those input/output signals. NV


Comments

  • submit question
  • reader feedback
  • submit ideas

Projects: