Picking a Microcontroller

by Tom Igoe, August 2016
updated June 202
w

Introduction

With a wide variety of Arduino and Arduino-compatible options on the market, students often ask “which is the best controller for me to get?” What follows is a guide how to decide what to choose. This is by no means an exhaustive list, it only includes boards I use regularly enough to recommend.

The lab exercises for this class were originally written for the Arduino Uno. Currently we teach it with the Arduino Nano 33 IoT, for reasons explained below.

The things you should consider in picking a controller, other than price:

  • Is this controller compatible with my other components?
    • Does it operate on the same voltage range?
    • Does it have the correct interface (e.g. asynchronous serial, I2C, SPI)?
    • Is it programmable with the tools I am using and any existing code I am using?
  • What  physical inputs and outputs do I need?
  • With what other devices does it need to communicate?
    • What protocols will they use (e.g. WiFi, Bluetooth, USB, etc)?
    • What aspects of the project can be handled by those other devices?
  • Is the form factor one I can work with?

The processor at the core of the Uno, Atmel’s ATMega328, is an 8-bit microcontroller. The ATMega328 is one of the few processors that still comes in a breadboard-friendly DIP package, so you can even build your own Uno-compatible circuit on a breadboard if you want to save money. In projects where you’re using multiple controllers, the DIY breadboard option is a smart choice. However, it’s not a task for you if you aren’t yet comfortable building circuits and reading schematics.

Nowadays, 32-bit microcontrollers are available for about the same price or cheaper than 8-bit controllers. The Arduino Nano series and MKR series are mostly 32-bit processors (the Nano Every is still 8-bit) that can do all that the original Uno can do and more. These newer controllers have more processing power and memory for your program than the Uno and other 8-bit controllers, and with the various connectivity options (WiFi, Bluetooth) that these boards offer, you’ve got more room to grow. If you’re buying your first controller, your best choice is probably one of the 32-bit controllers. The Nano line and the MKR line are the ones I currently use the most.

3.3V? 5V? What’s the difference?

1.7V, of course (a little electrical humor).

The Arduino Uno and the boards that came before it operated on 5 volts DC. However many newer controllers, including all the ones here,  and the embedded Linux boards like the BeagleBone and the Raspberry Pi, operate on 3.3 volts instead. Many older components, like the Sharp IR rangers that are popular in physical computing, operate on 5 volts, and many newer ones operate on 3.3 volts. Because of this change, you often need to adjust the voltage output of one component before it goes into another component. This is called level shifting. It’s a common technique you learn how to deal with when you work with many different components.

I Need A Lot of Input and Output…

Many physical computing projects need lots of input and output connections to read lots of sensors. There are lots of strategies for handling this. Many of the most common strategies are described in chapter 14 of Physical Computing: Sensing and Controlling the Physical World by Dan O’Sullivan and Tom Igoe. Although that book describes processors other than the Arduino, the circuits and techniques described work well with Arduino-compatible boards.

If you just want a single board with a lot of pins, consider the Arduino Due.   The Due has an Atmel SAM3X8E ARM Cortex-M3 processor, which is a more powerful version of the processor than the M0 in the MKR boards. This, or the strategies in Physical Computing, are probably the best option for multiple I/O for beginners.

If you’re feeling more advanced and want another approach, consider building your project with multiple processors. You can build your own Uno variant on a breadboard, or you can use the even smaller ATTiny84 and ATTiny85 controllers. These controllers have only a few I/O pins, but they are a couple of dollars each, and David Mellis has an excellent guide to programming them. You can link several of them together in one circuit and have each one control a handful of your I/O pins, then use one of the other processors mentioned here as a main controller.

Connectivity

Increasingly, projects need not just basic input and output, but also WiFi, Bluetooth, USB, or some other form of connectivity. This is where the more modern boards outshine the Uno and derivatives. Bluetooth, WiFi, and USB are pretty easy to get on a variety of boards. Other radio types are less common, but there’s a board for pretty much every form of connectivity.

Nano

The Nano family is a good, inexpensive starting place for beginners, with lots of room to grow. The Nano Every is thoroughly compatible with the Uno’s architecture for a lower price. It operates on 5 volts, just like the Uno. The Nano 33 IoT is a 3.3V board, with lots of extra features. It has the same processor as the MKR series, the SAMD21 Cortex M0+ ARM processor, and has a Bluetooth and WiFi radio on board, at a lower price than the MKR line.  At the top of the line, the Nano 33 BLE and BLE Sense and the Nano RP2040 Connect have enough processor power to run TinyML machine learning models as well.

Code you’ve written for the Uno will also run on the Nanos as well, but you’ll need to pay attention to which pins your external components are connected to, since the layout is not the same as the Uno. All of the Nanos except the Every are 3.3V boards, meaning that the default voltage is 3.3 volts, not 5 volts. This can present some challenges when dealing with sensors that operate on 5 volts, though nowadays most sensors are 3.3-volt compatible.

MKR

The MKR family are handy when you need advanced connectivity features.They have the same SAMD Cortex M0+ as the Nano 33 IoT, and a built-in rechargeable battery connector and charging circuit. Like most of the Nanos, the MKRs are 3.3V boards. There are several boards in the MKR line for different connectivity needs: The MKRZero has a built-in MicroSD card. The MKR1000 and MKR1010 are WiFi boards; the MKR1010 has Bluetooth as well. The MKR1300 and MKR1310 have LoRa and LoRaWAN connectivuty. The MKR1400 has a GSM radio, and the MKR1500 has a NB IoT 3G radio. In addition, there are several special purpose shields for the MKR boards.

Caveat: be wary of cheap derivatives, clones, and counterfeits of these boards. There are a number of very good derivatives that offer extra features, or different layouts. There are also a number of derivatives and clones that try to look the same, but use lower quality components or spend less time on inspecting assembled boards. We see a few broken projects every year that are due to a clone board failing.  Many of the vendors linked from this page sell their own Arduino-compatible variants that are reputable, if you want to look for derivatives.

Feather

Adafruit’s Feather M0 boards are also good DIP-format boards. They use the same processor, Atmel’s CortexM0+, they also use the DIP package, and they come in a variety of special-purpose variations. The basic Feather M0 Proto board has just the processor, it’s like a MKR1000 without the Wifi. The Feather Adalogger M0 is the same thing with a built-in SD card. The Feathers also have a built-in LiPo battery charger.

With one of the boards above, you can do everything covered in the labs for this class, with a faster and more capable processor than the Uno. Everything that follows is for readers who are already comfortable with microcontrollers, and looking for more info for advanced projects. For more information, see the comparison chart and vendors at the bottom of this page.

ESP

You could also consider Espressif’s processors, if you need lots of processors connected wirelessly. They’re not as inexpensive as the ATTiny processors, but they have built-in WiFi. Espressif’s ESP8266 processor is a very inexpensive 32-bit processor with WiFi built in. It’s very popular when you’re building projects that need lots of WiFi devices. THE ESP boards have relatively little I/O, however,  and only one analog in that can only read a 1-volt range. So the lower cost is often lost in extra components to add I/O.  The Feather Huzzah ESP8266 is a good implementation of the ESP8266, as is Spark Fun’s ESP8266 Thing Dev board. Many other vendors sell their own version of the ESP8266 board, but these are the two that I’ve used which are simplest for relative beginners to use. The ESP8266 WiFi libraries are based on the Arduino WiFi101 libraries, so code is relatively compatible with the MKR1000. The ESP32 is an upgraded version of the ESP8266.

The ESP8266 boards can also run other languages. There’s a port of JavaScript, a MicroPython version, and Lua version that are relatively mature, and others still in development. Watch the ESP repositories for updates.

The ESP8266 boards are not great for the absolute beginner, but they’re relatively easy for intermediate users, and handy when you need a lot of processors networked inexpensively.

Can I Program it in Python/JavaScript?

Yes, but there are limitations. There are microcontrollers on the market that you can program with scripting languages like Python and JavaScript. The Espruino is a good version of JavaScript for microcontrollers, and the MicroPython board does the same for Python. The BBC Micro:Bit runs both. The Espruino JavaScript engine is available for the ESP8266 as well. The RP2040 Connect and some of the Feathers run Python as well.

Although these scripting engines seem enticing for microcontroller use, they come at a cost. Scripting engines can never run your code as fast as compiled code, and sometimes the timing can be inconsistent, because the engine’s cleaning up memory and not listening to your I/O pins. Any good programming tool needs a good framework for building libraries as well. When you’re looking at new tools like this, check what libraries are available, and what the framework for building libraries looks like, and how many programmers are using it. Also consider that any scripting language on a microcontroller means that your source code, not the compiled binary program, is present on the processor itself. This is no big deal for hobbyists, but is a potential security risk for commercial products.

What About Embedded Linux?

There are a number of different embedded Linux processors on the market now that are in the same price range as microcontroller boards. The Raspberry Pi and the BeagleBone Green Wireless are excellent examples of this, and good products. These boards are getting more capable all the time. Many of the Processing and P5.js/node.js examples for this class run on the Raspberry Pi 2 and 3, for example, or the BeagleBone Green Wireless.

For this intro to physical computing class, they are overkill, however, because they require you to learn how an embedded operating system works in addition to the electronics, programming, and physical interaction design we’re already covering. It’s not uncommon to combine a microcontroller with an embedded linux processor, with the former handling physical I/O and the latter handling media control or network communication. The two communicate via asynchronous serial, just like your laptop and your microcontroller will do in the serial labs in this class.

For the purposes of this class, you’re welcome to explore the embedded Linux boards independently once you’ve shown mastery of the material covered in class. Your projects will be evaluated mostly on how well they demonstrate good physical interaction design, however.

Where To Get Boards

The Arduino boards mentioned here are carried by the Arduino online store as well as many of the vendors mentioned here: Adafruit, Spark Fun, Seeed Studio, and Digikey are the vendors I use most frequently. For Seeed Studio products in the US, Digikey is a useful reseller. It’s worth comparing them all for pricing, though the differences are not usually large.