Zeroing in on MCU's for IoT Projects
People talk a lot about “Smart Objects” nowadays. From smart cities to smart phones, smart plugs, mood-lights that are smart and what not! However, as Engineers lets not get carried away by the buzz-words that do rounds in the industry. Lets get logical as we are meant to be and scratch beneath the words “smart” that's a core aspect of the Internet of Things (IoT).
A lot of IoT applications require more than just adding a sensor to a physical object. And when we are talking of “Smart Devices”, we are talking about the good old microcontroller (also known as an MCU), albeit an internet-connect one.
Microcontrollers can be thought of as tiny computers that are added to any physical object or space to give it a ‘brain.' They contain one or more computer processors, along with memory and programmable input/output peripherals — all in a single integrated circuit.
MCUs are different from the microprocessors that are found in personal computers because they are specifically designed for embedded applications where computing is not the sole purpose of the application.
While MCUs have less capability than a standard computer processor, their low cost makes them a more practical option for adding computing capabilities to an object, space, or process that doesn’t have them.
Think of something like a warehouse, bridge, or industrial machine that typically doesn’t contain a computer. In cases like these, adding an Internet-connected microcontroller provides enough computing power to enhance these things without adding the higher cost and complexity of standard computer processors.
Key Features of Microcontrollers
In order to be able to determine which microcontroller will work the best with your application, you’ll need to know some of the key features of microcontrollers and what they do. Below are some of the specs that you’ll encounter and need to make sense of when looking at a data sheet for an MCU:
- Bits: Microcontrollers are typically sold by the number of bits that they offer. This impacts the speed at which they are able to perform non-trivial computations.
- RAM: RAM is a fast-access memory that does not retain data in an absence of power. All MCUs come with certain amounts of RAM, which allows your microcontroller to quickly perform various actions. The more you have, the better, but the added RAM increases the cost of the MCU.
- Flash: Flash is computer memory that retains data in the absence of power. At least some of this is essential, and it’s very useful for features like offline storage.
- GPIO: GPIO stands for general-purpose input/output pins. These are the pins that you will use for connecting your sensors and actuators to the MCU and the internet. The number of pins can range from one to the hundreds, depending on the microcontroller.
- Connectivity: This is how the board (and application) connects to the Internet via Wi-Fi, Ethernet, or some other means. This is an important aspect of connected sensor applications, so we’ll go over this topic in greater detail later.
- Power consumption: Power consumption is critically important for connected sensor applications, particularly when your device has to rely on something like a battery or solar power. This spec will tell you how power hungry the MCU is by default and whether or not it supports power-conscious programming techniques.
- Development tools and community: It’s important that there is a mature set of tools, documentation, and community support to help build programs that will run on the MCU you select for your application.
Microcontroller Operating Systems
Now, let’s talk about the operating system that runs on top of the Microcontroller hardware. In the same way that personal computers run an operating system like Windows, MCUs run an operating system, too.
You have three main options:
- Bare Metal means that there is, in fact, no operating system. This was the original approach to working with microcontrollers, and it’s still quite popular because it’s cost-effective and efficient. The main downside to this option is that it provides less support for the developer of the software.
- RTOS stands for "Real-Time Operating System." An RTOS system provides exact guarantees in regards to the time in which operations will complete. This is critical for coordinating physical machinery.
- Linux is much easier to program and connect to the Internet. It behaves more like a “real computer” as the average person might know it, which is great for many of the reasons previously stated. However, because of this, it does not provide any timing guarantees.
Development Boards
MCUs are most commonly brought along with what is known as a “development board." A development board provides everything necessary to program the MCU. They’re the perfect starting point for building connected systems.
Development boards are printed circuit boards containing an MCU and the supporting components needed to program the MCU.
They include things like a power source, support for connecting sensors, and sometimes even onboard sensors and actuators.
They’re useful for prototyping before final manufacture of a custom solution and popular for various engineers working on embedded systems development.
Development boards enable users to quickly connect sensors and actuators (if they’re not already included on the board) and their accompanying software facilitates the creation and deployment of code.
Choosing a Microcontroller for Your IoT System
There are many different development boards and microcontrollers available from a variety of companies: TI, Samsung, Arduino, Raspberry Pi and more. Choosing which one is right for you depends on a number of factors that vary depending on the nature of your application.
- Compatibility: Does the MCU support the sensors and actuators you want to use? Depending on your sensors and actuators, you might need many or just a few ports. You’ll want to make sure that you have enough input/output ports available.
- Architecture: Is the architecture sophisticated enough to handle the complexity of your program? Most applications use either ARM, MIPS, or X86. Choosing one depends on the functional requirements of your application and how much computing power your system needs.
- Memory: Does the MCU come with enough memory – RAM and Flash – for your program? It is highly recommended that you choose an MCU with a comfortable amount of extra memory for future updates. This will save you time, money, and some major headaches in the long run!
- Availability: Can you easily get the MCU that you want and in the quantity that you need? This is important to consider at the beginning of the process, especially if you plan on scaling up your system later on.
- Power: How much power will the MCU need? Will it need to be wired or can you use batteries? Energy efficiency is extremely important to consider for industrial IoT applications because you’ll want to minimize the need for sending maintenance crews to inspect edge infrastructure.
- Cost: How much does each unit cost? Does the price make sense based on the value it will deliver? Again, you’ll want to think about scaling the project up later on. Make sure that your IoT budget support including more of the MCUs you choose.
- Development Kit: Is a development kit available? Development kits are an excellent way to get started with the MCU you choose because they are designed to give customers an out-of-box experience. This will make the development of your IoT application much easier!
- Development Support: Is good documentation for your MCU available? What is the community surrounding this board like? These factors are crucial in order to make informed decisions on how to use your MCU properly. A good online community can help guide you when you are stuck or encounter a problem with your implementation.