When it comes to the Internet of Things (IoT) and smart objects, their computational ability is usually driven by microcontrollers or MCUs. These are essentially scaled-down computers that operate smart devices by providing processing power, memory, and input/output peripherals.
In this article, we provide a complete guide to microcontrollers for IoT, including:
- What is a microcontroller in IoT?
- Microcontroller versus microprocessor
- Microcontroller Features
- RTOS/OS for Microcontrollers
- How to Choose a Microcontroller for IoT
- List of Microcontrollers for IoT
What is a microcontroller in IoT?
When thinking about microcontrollers in IoT, it’s easiest to look at the IoT technology stack for an embedded device and see its place in this.
A simplified IoT stack for a smart camera device might look something like this:
- Communication protocol layer
- Hardware abstraction layer (HAL)
- OS/RTOS layer
The MCU operates at the hardware abstraction layer, running the chosen OS/RTOS, which operates the device.
Microcontrollers versus Microprocessors
Another common question we hear is what’s the difference between microcontrollers versus microprocessors. A microprocessor is a single integrated chip that contains a device’s CPU. However, it doesn’t contain any RAM or ROM memory, or other peripherals that a device may have. The chip instead relies on inputs/outputs (I/Os) to connect to memory and peripherals.
A microcontroller, on the other hand, has the CPU, RAM, ROM, and peripherals all embedded onto a single chip. This effectively makes it a computer on a single chip.
With everything embedded on a single chip, a microcontroller, of course, has lower performance capabilities than a microprocessor powered computer. However, when it comes to typical IoT devices such as smart industrial machines, microcontrollers are a much better choice, as they provide sufficient computing power while keeping costs and complexity low.
There are hundreds of CPUs on the market, so it’s important to understand common features before deciding on the best CPU for your IoT project.
This is the primary distinction between different MCUs. You’ll find five different options currently available:
4-8 bit: Used in remote controls and other inexpensive and constrained applications. Generally, not fit for use in IoT applications.
8-bit: Mostly used in a very cost constrained but more elaborate applications than 4-8 bit. With the correct setup, these can be used in IoT applications, sometimes running an RTOS, but mostly with a simple control loop. The well known Arduino project is an example of an 8-bit design.
16-bit: While these are an option, 16-bit architecture is not very common in IoT. Implementations will typically switch between 8 and 32-bit.
32-bit*: This is the normal entry point for IoT applications unless the application can fit on 8-bit architecture and has cost constraints. However, the price difference between 8-bit and 32-bit architectures is small enough that developers should think twice when choosing 8-bit. Whether these MCUs run an RTOS or OS mostly depends on the compute power of the MCU and/or if it has an MMU unit. Raspberry Pi is a well known 32-bit design.
64-bit: These are reserved for high-end systems, normally Linux or other OS. Normally you need a specific (compute intensity) reason to jump from 32-bit to a 64-bit system.
*Note on 32-bit systems: Normally, the clock frequency is an important design factor. Clocks above 100Mhz (especially Ghz designs) usually require extra thought on PCB design since the PCB traces can begin to interfere with each other.
The majority of MCUs use one of the following architecture:
This can vary greatly, from around 16B on 8-bit MCUs at the lowest end, up to about 4.5MB on 32 and 64-bit MCUs. In most people’s minds, the more RAM, the better, but this will increase costs substantially.
This stands for general-purpose input/output and are the pins that allow connectivity of hardware such as sensors to the CPU. As with RAM, the number of GPIOs can range substantially, to accommodate all types of device stacks.
Different CPUs come with different connectivity options, including Wi-FI protocols, Bluetooth, and wired ethernet ports.
RTOS/OS for Microcontrollers
There are a few different operating system options for MCUs. Here’s what you’ll find on the market:
RTOS stands for Real-Time Operating System. This is a software component that can execute only one program at a time, but which rapidly switches between programming tasks in order to accomplish multiple tasks simultaneously.
It delivers what’s known as deterministic hard real-time responses to external events. What this means in practice is that RTOS software can provide highly responsive processing for a limited number of pre-determined tasks far quicker than a traditional OS, which can be an advantage when it comes to an IoT device. You can read more here on how to choose the best RTOS for IoT.
An OS is a “traditional” operating system, such as Linux. Unlike an RTOS, a traditional OS provides non-deterministic soft real-time responses. This means it’s much more effective at processing large quantities of different tasks than to an RTOS, but it requires a lot more processing power. Therefore, OS software is usually only found on 32 and 64-bit MCUs that have MMU units. You can read more here on the advantages and disadvantages of RTOS v OS.
Some CPUs have no operating system software; instead, the firmware is written directly onto the hardware. Bare metal programming is very common with older generation embedded devices and MCU IoT.
However, as MCU processing power has advanced and comes down in cost, fewer devices are now operated bare metal. Although saying that, this is still used when the MCU has very low memory or when you want direct control over every piece of hardware to meet very strict timing requirements.
How to Choose the Best Microcontroller for IoT
As mentioned above, there are many microcontrollers used in IoT projects. We provide a list of common commercial MCUs in the next section, but first, we’ll explain how to choose the best microcontroller for IoT.
The amount of memory you choose will, of course, have a fundamental impact on the overall performance of the device. Therefore, carefully calculate the memory requirements of your device’s programming tasks, both the RAM and ROM.
You also need to ensure that you future proof your decision, by having enough spare capacity to handle the demands placed on it by future updates.
The power requirements of your device is another major consideration when it comes to choosing the best MCU. An IoT smart medical device such as a hearing aid, for example, will run on a very low power battery. On the other hand, heavy smart industrial equipment will consume a lot of electricity, but you’ll want the device to be as energy-efficient as possible.
Internet and other Communication Protocols
How will your IoT device connect to the application? What type of data will the device be pushing, and where? Does it need to interact with other devices locally?
For example, a residential smart alarm system may need Wi-Fi protocols, while an office IoT HVAC system may require a wired ethernet connection. For local device communication, a Bluetooth connection could be required, and remote devices outside of Wi-Fi ranges will require 4G data connectivity.
To work out how many GPIOs you need on your microcontroller, you first need to define what data inputs your device requires. Also bear in mind there are both digital ports and analog ports on a CPU, which process different types of data inputs and outputs.
As stated above, most applications run off ARM, MIPS, X86. Therefore, you need to ensure that your choice can support the complexity of your device and system, including the I/Os and data processing, and how much power this requires.
Dev Support and Community
If your team or organization has no prior experience working with MCUs, then the dev support offered by the manufacturer and the developer community is crucial. Check that there is comprehensive documentation from the manufacturer. Then check places like StackOverflow and Reddit for community support. You’ll also find plenty of useful tutorials on our blog.
You always need to have one eye on the future when considering microcontroller costs. There is no point building a prototype with a board that is then prohibitively expensive to scale and go to market with. Also, be aware that some MCUs come with licensing fees for individual device drivers.
Security is a significant consideration in all IoT projects and needs to be engineered across the stack. Standard security features on commercial boards include cryptographic bootloaders and hardware accelerators, shield layers, and memory protection units.
List of Popular Microcontrollers for IoT
PIC18 series (including PIC12 and PIC16)
LPC series (ARM Cortex-M0)
K32 Series (ARM Cortex-M4/M0)
LPC55x Series (ARM CortexM33)
i.MX series (Cortex-M7)
SimpleLink series (ARM Cortex M4)
MSP430 series (MSP432)
CC3200/CC3120/CC3220 SERIES (WI-FI ENABLED)
If you’re developing an IoT project, then there are several factors you need to consider when choosing the best MCU for IoT. These include power, architecture, memory, connection ports, cost, and security, as this guide to microcontrollers for IoT explains.