Which MCU should I use?

Nowadays there is a seemingly infinite stream of fancy microcontrollers to use for your new project. nRF? ARM? ESP32? PIC?
How to decide?
Here’s a handy list of a few common microcontrollers/modules! I’ll only be reviewing ones that I have experience using, as there are far too many MCUs out there for me to compare them all.

Chip shortage update: Buying these chips on their own has become extremely difficult or expensive, so the use of development boards such as the Arduino, Digispark or Adafruit Feather series is recommended where possible.

Chip shortage un-update: The availability has improved somewhat. I recommend http://findchips.com to see whether the one you want is available anywhere.

TL;DR (Right Click -> “Open Image in New Tab” for higher resolution)

ATtiny85/84

The ATtiny85 and its bigger brother are handy little chips for simpler projects, and can save both power and cost. The ’85 and ’84 have the most program memory (flash) of their respective variants in the ATtiny family. As a bare chip they don’t need anything else except power to function; however, an optional oscillator/crystal can be used to increase accuracy of timing-sensitive signals, as the built-in CPU oscillator is not very precise. Programming the chip itself also needs a separate programmer, unless you have installed the USB bootloader (that then occupies some program memory). Rarely seen on development boards today, as it has been largely superseded by more capable devices. However, if your project only needs a little power (e.g. to blink a few LEDs), this little chip could be right for you.

A place where the chips roam wild and free… (ATtiny 84 and 85)
Benefits Limitations
Low priceLimited RAM and program memory
(512 bytes RAM, 8kB program memory)
Can run on low voltage (1.8V) with V variantLimited Input/Output pins and features
Tiny, especially in the SMD versionNot recommended for beginners, needs an external programmer to use

Arduino Uno (ATmega328)

Perhaps the most well-known of all microcontroller boards, the Arduino Uno is a tried and tested workhorse that fits most projects. Its 8-bit ATmega328 MCU strikes an excellent balance between features and complexity, and will handle most of your ideas with the right peripherals. Onboard the Arduino module, it is trivially easy to program with a USB cable and your choice of software; on its own, the ATmega328 has most of the benefits of the ATtiny, and its larger physical size is reflected in the amount of space you get to store your cool programs.

File:Arduino uno r3.jpg
The ubiquitous Arduino Uno board. (src)
BenefitsLimitations
Extremely easy to use. Great for beginnersNo official Python support.
Enough program memory for most projects (32kB).Pulse-width modulation (PWM) only available on select pins.
Many I/O pins, and many features available on select pins.RAM can become limiting with more complex projects
Hardware peripherals (Serial, I2C…)No built-in USB support.

Caveat: The only hardware serial port is used by the Serial connection on the Arduino boards, as they have a Serial programmer along with a special bootloader. If you want to use hardware serial you will need to use a bare chip or choose another device. Software serial will work, but will be slower and use up processor time.

ATSAMD51

(and its younger cousin ATSAMD21)

These 32-bit microcontrollers pack big power inside their small surface-mount packages. Capable of running at frequencies of more than 120 megahertz, their number-crunching performance vastly exceeds the 8-bit chips previously mentioned. Boards using ATSAMD devices are almost as ubiquitous as the Arduino series nowadays, with the Adafruit Feather(s) M0/M4 being one example with a similarly large ecosystem.

However, due to their tiny pin pitch (distance between pins) and surface-mount package, trying to solder these micros to your own board is only recommended for experienced makers and designers. Tphey are incredibly hard to solder successfully – a reflow oven or hot air gun is necessary.

BenefitsLimitations
Extremely powerful. Faster 32-bit (ARM Cortex M0/M4) processor cores (did I mention that they can be multicore as well?)More difficult to use as a bare chip than through-hole (DIP) chips such as ATmega/ATtiny series.
Vast amounts of program memory (256kB for SAMD21, up to 1MB for SAMD51)More expensive than less powerful microcontrollers.
Many versatile hardware peripherals (multiple Serial ports, I²C, SPI…)
DAC (Digital-to-Analog Converter) for voltage output or simple audio
Incredibly low power sleep mode (43 microamps!)

ESP32/ESP8266 (“NodeMCU”)

These two chips from Espressif specialize in wireless communication. Both have built-in WiFi hardware and TCP/IP stacks making them perfect for Internet of Things (IoT) projects. Often available on SMD modules with castellated pins, it is relatively easy to incorporate these onto your own printed circuit boards (PCBs) as well, although the usual selection of development boards from Adafruit and the like are available.

The ESP32 is significantly more powerful than the ESP8266 while being about £3 more expensive, having 2 processor cores instead of one; it also has many more useful I/O pins and built in capacitive (touch) inputs, giving you much more versatility. Still, the ESP8266 can suffice for some projects as well, as it has the common peripherals on its limited pins (I²C, SPI, Serial…) and plenty of processing power.

BenefitsLimitations
Built-in WiFi for easy connectivity to the internet/other devices (ESP8266 only) Main program has to have pauses for the WiFi to work, as it only has one processor core
Many hardware peripherals (ESP8266 only) Only one limited ADC, 0-1.8V
Lots of processing power and RAMPower-hungry when wirelessly sending data.
(ESP32 only) Built-in Bluetooth, allowing mobile app functionality
(ESP32 only) Support for cameras in pre-made modules such as ESP32-Cam

RP2040 (Raspberry Pi Pico)

The RP2040 is a wonderful MCU. Low price, many peripherals, configurable PIO state machine – what’s not to love? Firstly, the fact that it’s only available in a tiny QFN format… and that’s it. As well as being one of the few micros available during the chip shortage, the Raspberry Pi Pico devboard only costs £3.

BenefitsLimitations
Fast 133MHz dual ARM M0 core with plenty of RAMNo FPU (Floating Point Unit), so not good for heavy decimal calculations
Many hardware peripherals (2xUART, 2xI2C, 2xSPI)QFN package near impossible to hand solder
Versatile PIO state machine that can implement custom functionality without using CPU powerOnly 4 ADCs (2 available on Pico)

Conclusion?

Naturally, some microcontrollers are better suited for particular applications, but most of the more modern 32-bit models are versatile enough to fit in most projects. It’s best to see if you can do what you want with the resources you have, before buying more hardware – but if necessary, don’t hesitate to get the final piece of the puzzle to complete your project. Happy tinkering!


Posted

in

by

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *