It’s easy to feel overwhelmed when you’re building low power electronics. There are so many different components and technologies to learn that it can be hard to know where to begin.
Recently, one of our clients wanted to redesign their field-deployed IoT environmental monitor to a smaller, lighter, and more power-efficient package with longer battery life and could be placed more easily into 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.
In this post, we look at the differences between single board computers and microcontroller kits 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.
A microcontroller is a small all-in-one computing platform with features like onboard memory, built-in timers, IO handling, and other key features 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.
When it comes to computing power, how resource-intensive is your problem? Will it be 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?
To help you evaluate the strengths and weaknesses between your options, we’ve added them to Table 1 below, followed by a detailed breakdown of each feature.
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’s 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.
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. It is important for you 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.
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.
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.
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 protocol like USB, it will be even easier to change the compute platform because there’s often libraries and drivers available. In summary, depending on the tools you are planning to use some platforms might be more flexible to be interchangeable than others.
The boot time of a 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, the 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.
Ultimately, SBCs and microcontroller kits are both solutions for embedded applications that require computing; it’s 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 development of features might need to be considered.
In the case for our client, there were tradeoffs for both; a microcontroller-based platform/MCU could achieve lower power consumption, but would require more custom firmware development to integrate. The SBC accelerated development by providing a lot of open-source software packages and drivers that could be rapidly configured, but at the expense of higher power consumption.
When it comes to making the right selection, 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.
This article was originally written by Malcolm Dimeglio, Software Developer at MistyWest, for the MistyWest blog.