top of page
  • Robert John

What Are Microcontrollers and Why Might You Want to Program Them

Updated: Nov 22, 2021


An arduino cc, a microprocessor that uses a chip licensed from Arm Holdings Ltd
Arduino Uno, courtesy: arduino.cc

A microcontroller (MCU) is a computer, but not in the traditional sense of the word.


When you think of computers, you might think of servers, desktops, or even laptops. If you are really young or modern, you might think of a tablet. This class of computers is called general-purpose because they can be used for a wide range of purposes. If you think about it, you can use a tablet for many things, such as playing games, watching movies, and sending emails.


A laptop and mouse, sitting on a desk, with a chair close to the desk
A general-purpose computer, credit: Wix

A microcontroller is normally designed and produced to carry out a single function. In this regard, it is called an Application-Specific Integrated Circuit (ASIC). Examples of this include:

  • heart-rate monitoring for healthcare

  • environment monitoring for agriculture

  • automotive use (with real-time processors)

  • sensors for industrial use

  • the brains for appliances in your home

Microcontrollers are stripped-down computers. As a result, they do not have the normal input and output devices that you are used to such as a keyboard and mouse. Instead, microcontrollers have I/O pins which are connected to sensors for input, and to other devices for output.

Microcontrollers are not meant for the regular activities you are used to, such as listening to music, watching videos, or creating office documents.


It is safe to say that we are in the age of Internet-of-Things (IoT) devices, and these devices are enabled by MCUs.


The key to what microcontrollers are meant for is in the name. They are designed to be controllers: to take input from the environment and to control other things such as a screen, led lights, actuators, or a screen. They can receive their inputs from other microcontrollers or computers.

An image of a Raspberry Pi Pico board with an RP2040 processor featuring an Arm Cortex M0+
Rasperry Pi Pico, with a dual-core Arm Cortex M0+ processor, 264kb RAM, and up to 16MB of off-chip storage, costs $4 only!

Microcontrollers are designed for specific use, which makes them different from general-purpose computers in a number of ways. Some of those differences will be covered in the following sections.


Size

Everything about MCUs is really small compared to a general-purpose computer. When you think about it, most specific use-cases do not require a large computer sticking out like a sore thumb. Consider the case of a heart-rate monitor. You might not want something the size of a phone attached to any part of your body just to measure your heart rate. Perhaps something the size of a watch would be preferable, or maybe even smaller. These are called wearables and present a huge market opportunity.


Power Efficiency

General-purpose computers require either electricity from a power cable, or an internal battery for operation. These batteries are rechargeable and rarely last longer than two days under steady operation. In contrast, MCUs run on really tiny batteries and can operate for months without needing any form of replacement. This makes them suitable for use in places where they would be hard to reach for replacement. The power efficiency means these MCUs can remain on continuously.


Processing Power

MCUs tend to have low processing speeds relative to general-purpose computers. These are frequently below 200MHz (compare this to general-purpose processors that operate in GHz).


Memory

The memory on an MCU is frequently in the kb range. This requires applications to be really small so that they can fit in memory. While this might appear problematic in the beginning, it is important to note that most applications that run on an MCU do not need to support portability and as a result do not make use of libraries that are portable across architectures.


Storage

You can expect MCUs to have somewhere between 32kb of storage and 2MB of onboard storage.


Fixed Configuration

MCUs typically have a fixed configuration of processor speed, memory, and storage. You will need to decide on all of these before you place your order for an MCU. If this looks like a problem, don't worry. You can start by building your application on a larger board using breakouts, and then scaling the solution down before production.


Sensors

This is one place in which MCUs shine. They support a host of sensors and I have listed some categories of sensors below which I took from a HarvardX course on TinyML (more on this in a later article):

  • motion sensors: these are designed to sense movement across a wide range of axes.

  • acoustic sensors: these are designed to capture sounds, both within the human range of hearing and outside.

  • environmental sensors: these are designed for measuring things such as temperature and humidity

  • biometric sensors: these are designed for measuring things on living things, such as heart rate

  • force sensors: for things such as push and pull pressure


Cost

MCUs are cheap! They tend to cost only a few USD per unit. The final cost would depend on the actual processor chip as well as the sensors you put on the device along with storage and memory.


Operating Systems

MCUs tend to come without an operating system. Operating systems provide a layer of abstraction on top of varying hardware, allowing for applications to run on different hardware without too much customization. However, they introduce a layer of complexity and cost that isn't beneficial for MCUs. As a result, most MCUs do not have one.


Vendors

A lot of MCUs run the Cortex-M family of processors from Arm Ltd. However, Arm Ltd doesn't manufacture MCUs, instead, manufacturers and vendors license the design (intellectual property) from Arm Ltd.


When you are ready to build a product, please take a look at one of the vendors listed below:

  • Analog Devices Inc

  • Atmel

  • Cypress

  • Infinion

  • NXP

  • Nuvoton

  • Silicon Laboratories

  • ST Microelectronics

  • Texas Instruments

You can also get devices for educational purposes from the following manufacturers:

In conclusion, I will attempt to give you a reason for programming MCUs: because there are billions of applications that do not involve a phone, tablet, laptop or desktop. If you look around you, you might find problems that you wish you could solve with a piece of hardware and some code but felt that the cost would be too much. Now, ask yourself whether the solution would be viable if the final product cost only $10 or $20, instead of the cost of the cheapest mobile device. If the answer is yes, then you have something you do.


Even if the final product was going to cost $100, ask yourself what your community is losing by not having this device. Could this device save lives? Or improve lives? Or improve the revenue from commercial activities?


I will write about what it takes to program MCUs in a future article. Until then, please share this article with your friends.

328 views0 comments
Post: Blog2_Post
bottom of page