Embedded Processing

One of the design decisions in IoT applications is determining how and where data processing will take place. The data can either be processed on the device itself, or raw data can be transmitted to a different locations — such as a smartphone or a cloud server — to be processed. Naturally, this decision has an impact on the electronics architecture of the IoT device. Independent of where the data processing takes place, the device will need some sort of processor. However, the more computations the device needs to perform, the better and more performant the device’s processor needs to be. This decision has far-reaching consequences for the energy consumption, the cost, the development time of the device. This article aims to give a brief overview of the different possibilities with respect to embedded processing; the data processing on the device itself.

Microcontrollers

Microcontrollers are vastly simplified computers that are self-contained within a single chip. This chip contains both the processor, as well as the RAM memory and program memory. Semiconductor manufacturers offer a vast variety of different microcontrollers, each with their own competitive advantages and specific purposes. Important differentiators are (among others) the processing power, the input/output ports, the peripherals, and the memory. The list below gives a brief overview of several noteworthy microcontroller families:

  • Atmel AVR ATmega — Cheap 8-bit microcontrollers with a comparatively low amount of processing power. These chips are used in the well-known Arduino boards. Because of this, many reusable software libraries are available for this platform.
  • Microchip PIC — Known as one of the cheapest microcontrollers on the market.
  • Texas Instruments MSP430 — Microcontrollers that are specialized in ultra-low power applications. Useful for applications that are powered using small batteries, solar power, or energy harvesting technology.
  • STMicroelectronics STM32 — Good all-round 32-bit microcontroller. Based on the ARM processor architecture. Microcontrollers with this type of architecture are available from multiple manufacturers. The price of these microcontrollers is gradually approaching that of AVR and PIC microcontrollers, but ARM microcontrollers offer a much better performance.
  • Cypress PSoC — These chips are unique because, in addition to an ARM microcontroller, they also contain a number of programmable analog and digital building blocks. This makes it possible to eliminate or simplify external circuitry, leading to a cheaper and more compact product.
  • Espressif ESP8266 & ESP32 — Microcontroller with integrated WiFi and Bluetooth controllers. Cheap modules with a strong community presence.

Microcontrollers are almost always programmed in C or C++. Depending on the complexity of the firmware (the software running on the microcontroller), the code is either programmed directly or a real-time operating system is used. Simple applications with limited functionality are typically programmed directly, no external library is used to synchronize the execution of the different tasks. The programmer is responsible for executing the different tasks — such as reading sensors, sending data, and updating the user interface — at the appropriate time. When dealing with more complex scenarios, it is sometimes better to use an external library to handle task management. Such a real-time operating system (RTOS) handles suspending, resuming, and synchronizing tasks automatically. From the perspective of the programmer, it almost seems like multiple tasks are executed in parallel. Examples of RTOSs include freeRTOS and mbedOS. Both can be used on many different microcontroller platforms, however an RTOS typically requires a more powerful microcontroller, such as an STM32. Smaller microcontrollers, such as the AVR chips used in Arduino boards, are not suitable for this.

Single-Board Computer

As an alternative to microcontrollers, an IoT device can be built around a single-board computer (SBC). In the case of a microcontroller, the software is executed directly on the processor. An SBC, on the other hand, runs a full-fledged operating system such as Linux, and the application software runs on top of this OS. This approach offers several important advantages. Single-board computers generally have much more processing power than microcontrollers, meaning that powerful, high-level programming languages such as Python can be used. Additionally, the Linux operating system already contains many drivers for all sorts of peripherals. An important downside of SBCs is that you cannot guarantee real-time performance because task management is handled by the OS.
Additionally, when the device is turned on, the OS needs to be booted before the application software can start. Because of this, there is a small delay (+- 1 minute) when starting the device. SBCs also have a higher power consumption than microcontrollers, which may prove problematic for mobile IoT applications. Finally, development costs of SBCs are higher because the electronics design is much more complex than that of microcontroller-based circuit boards. This problem can be mitigated by relying on more expensive ready-to-use modules. Nevertheless, single-board computers offer important benefits, and are well suited for applications that rely on computer vision, machine learning, local web interfaces, audio processing, etc. The list below gives an overview of noteworthy SBC platforms:

  • Raspberry Pi — Originally developed as a mini-computer to be used in computer science education. The size and dimensions of the Raspberry Pi boards have become a de-facto standard. The organization also offers a Compute module, which is intended to be integrated into other commercial products.
  • BeagleBoard — Alternative for the Raspberry Pi. A bit more expensive, aimed primarily at embedded applications
  • BeagleBone on a chip — The OSD335x chip contains all necessary components required for a working SBC, drastically simplifying the development process of such devices. The PocketBone is a bare-bones example that makes use of this chip.
  • Arduino Yun — This board contains an Arduino-compatible microcontroller as well as a processor running Linux.
Microcontroller Single-board computer
Price $ $$$
Processing power low – medium high
Realtime Yes No
Startup instantaneous +- 1 minute
Circuit board complexity low high
Power usage low – medium high
Programming languages C/C++ any