It is easy to feel overwhelmed when you’re building low-power electronics. There are so many different components and technologies that it can be hard to know where to begin. Recently, a MistyWest client wanted to redesign their field-deployed IoT environmental monitor to a smaller, lighter, and more power-efficient package with a longer battery life that could be placed more easily in remote locations. In order to achieve this, they faced a choice of going with a Linux-based single-board-computer with a microprocessor or a microcontroller-based compute platform. Let’s take a look at the differences between a microcontroller and a microprocessor when it comes to designing a successful remote sensor so that you have the information you need to choose the right solution for future applications.
Microcontroller Kits vs. SBCs
A microcontroller is a small, all-in-one computing platform with features like onboard memory, built-in timers, IO handling, and others for interacting with electrical hardware. Microcontrollers’ common uses are devices like remote controls, toys, industrial equipment, cars, and implantable medical devices. You can find them in microcontroller kits like Arduino.
A microprocessor is similar to a conventional computer CPU, which is only the processor, and needs to be connected to external memory, timers, storage, and IO peripherals in order to function. Microprocessors are generally more powerful and allow for a more granular hardware design by selecting the exact memory, timers, and other features that one needs. You’ll find microprocessors in consumer computing equipment, and the increase of small and cheap single-board computers (SBCs) like Raspberry Pi has enabled them to be used in new applications like smart devices.
Strengths & Weaknesses: Microcontroller vs. Microprocessor
When it comes to microcontroller vs. microprocessor, you must consider computing power, how resource-intensive your problem is, and several other variables. Will your sensor require simple sensor reading (low intensity), image processing (high intensity), or machine vision/AI (very intense)? For development, can you use an off-the-shelf operating system or reuse other people’s code? And how much power consumption or battery life will you require?
Here is a detailed breakdown of each feature:
#1: Computing Power
Some microcontrollers are designed with low power consumption in mind and are specified to be run at reduced clock frequencies, meaning the chip computes more slowly but with less power consumption. This makes microcontrollers good for less compute-intensive applications like sensor reading, serial communication, or mechanical control systems, but they don’t tend to have the processing power for computationally intensive tasks, like image processing.
In comparison, there is often much more computing power available on commercial microprocessor boards like Raspberry Pi, which can support more complicated tasks like streaming video or running a local website. There are also microprocessors with additional modules, such as the Nvidia Jetson Nano, which has a graphics processing unit for tasks like machine vision and AI.
#2: Packages, Development Resources, and Support
If you pick an established platform like Arduino or Raspberry Pi, there are many existing open-source libraries and a community that can help debug issues. However, If you pick a more specialized and less common platform, you may be on your own when sorting through documentation and trying to fix the issue. You need to decide if you need the specialized features of a particular platform and trade that against the support.
With embedded Linux solutions, most of the basic drivers for common connections like ethernet, audio, and video are already available, tested, and stable. In contrast, you may need to write the drivers for your particular microcontroller to connect with peripherals, which can be time-consuming and challenging.
#3: Power Consumption
Microcontroller-based boards usually use less energy than microprocessor-based SBCs. One of the reasons is that microcontrollers generally run at lower clock frequencies than microprocessors, which in turn also means reduced computing power.
#4: Coding Language Support
If you’re running your code on a microcontroller, you’re likely going to need to build your software with a lower-level language like C or C++. On a microprocessor with a Linux distribution, you will have the choice between many more languages. This can help to create POCs (Proof Of Concepts) at a much faster pace. There are many libraries for peripherals like cameras, sensors, etc. written in higher-level languages like Python, for instance. By picking a platform that can run those languages you will be able to leverage those open-source libraries. However, If your solution requires a lot of low-level hardware manipulation, this may not be helpful.
#5: Code Portability
How tightly integrated is the code with the hardware? If you write a bare-metal application for a microcontroller, it will be challenging to switch over to another platform – but projects that are running FreeRTOS, for example, make switching easier. If you’re using a Linux-based SBC and peripherals over a protocol like USB, it will be even easier to change the compute platform because there are often libraries and drivers available. Depending on the tools you are planning to use some platforms might be more flexible to be interchangeable than others.
#6: Boot time
The boot time of an SBC with embedded Linux on it is significantly greater than that of a microcontroller, be it bare-metal or running an RTOS. When utilizing an SBC, an application must not depend on fixed time slots during start-up, and a few seconds for it to come up must be acceptable.
In general, microcontrollers cost less than microprocessors. As an example, top-of-the-line Teensy costs $26 and the flagship Arduino board (Uno) costs $25, whereas the flagship Raspberry Pi board (Pi 4) starts at $35, and more expensive boards like the Jetson Nano may range up to $130. There is a wide range of costs in both domains and plenty of choices available on the market.
Making the Best Choice
Ultimately, SBCs and microcontroller kits are both solutions for embedded applications that require computing. It is the use case that will inform which selection is the right one to make. SBCs with an embedded Linux OS, even though more costly, offer greater computing power, and allow a quick start to your project, with a wide range of options for your application’s programming language, very active online communities, and advantageous portability. Microcontrollers, on the other hand, are much more energy efficient and allow full control and fine-tuning of their internal configuration – but additional time for the development of features might need to be considered.
When it comes to making the right selection between a microcontroller vs. microprocessor, if a quick prototype for a proof of concept is needed or if the device is going to be used for inference, object localization, or other demanding computing tasks, an SBC is likely the better solution. The portability of the code and the flexibility of the system will simplify development and maintenance significantly.