Let’s walk through the IoT microcontrollers together. I’ll even help you get started on some projects you can run on your own MCU!

We’ll start with a rough description of how an IoT system works. For the sake of understanding, let’s look at an IoT system as a city, and we’ll call it a “New IoT City”. The MCU/SBC is the mayor of New IoT City. The mayor’s office or the city’s control center oversees operations, makes decisions, and ensures everything runs smoothly based on input from various departments.

And just like a mayor, the MCU serves as the central hub, processing data and making decisions for the whole IoT system.

New IoT City - the analogy of an IoT system and a city

What Are Microcontroller Units (MCUs)?

An MCU is a compact integrated circuit (IC) with low energy consumption that is designed for 3 core functions:

  1. Input processing
  2. Data Execution
  3. Output control

Input processing would be the mayor of our New IoT City receiving reports about how well the city is functioning. These would be traffic, garbage collection, and resident feedback for example. In the IoT system, it would be the reports from the data collection process that the sensor performs.

Now, our mayor needs to start making decisions – how is he going to get the traffic moving again and make the citizens happier? The MCU analyses the data from the sensors and then decides what actions the system should take.

Finally, our mayor deployed city workers to fix the traffic by moving the truck blocking the highway, for example. Similarly, the MCU will take the results after processing the data to command the actuators to perform tasks.

Components of an MCU

the MCU is made up of 3 key components

  • Central Processing Unit (CPU)
  • Memory (RAM, ROM, Flash Storage)
  • Input/Output (I/O) Interfaces

The CPU is the “Brain” of the MCU. Simply put, it fetches instructions from RAM, decodes them, and executes them. The CPU executes 1 instruction per clock tick, but the clock of a CPU is much faster than our daily clocks. A CPU’s clock ticks millions or billions of times per second. The higher the processing power, the more instructions it can execute.

An MCU has 2 main types of memory: RAM and program memory (aka Storage). RAM is used to run your code when the MCU has power, and loses everything on it when power is lost. Program memory stores your code and does not lose everything when power is cut off.

Why do need RAM if it is so volatile?

Excellent question! RAM is needed because the program storage is slow. RAM is fast and can quickly give the get the complex tasks that the CPU needs to execute from the your program.

IO Interfaces are the fun part of MCUs. They are the pins on the board that you can program to collect data from sensors and control actuators.

Microcontroller vs Microprocessor

What is the difference between a microcontroller and a microprocessor?

Microcontrollers, also written as µC, and microprocessors are not interchangeable terms. They are very different. Microcontrollers are embedded systems that come ready with a CPU, RAM, and ROM, as well as some embedded peripherals such as clocks and puls-width modulators (PWM).

Microprocessors, on the other hand, is a single chip that holds the CPU for a device. It does not come with anything else. They are also significantly smaller than a microcontroller. A single microprocessor can be small enough to fit into the dimple of a golf ball.

Understanding Microcontroller Architecture

This is a key part of understanding how an MCU works. The architecture determines a system’s processing speed, power consumption, latency, scalability, and more. So it’s kind of a big deal.

Hold on. What do you mean by Architecture? We’re not here to build houses.

Right, you are! The architecture of a system is essentially a blueprint that defines how the system is structured, how the components function, and how everything interacts within the system. The MCU architecture looks like this:

The first thing you should notice is that most of the communication on the MCU goes through the bus system. The bus system allows the other components to transfer data to each other.

Next, you’ll notice all the different components that are connecting to the bus. Let’s start with the core components: the CPU, the memory, the peripherals, and the IO pins. The CPU fetches, decodes, and executes instructions from RAM. RAM gets instructions from ROM or the flash storage. ROM and flash storage only store program data. The peripherals enable the system to perform tasks and interact with external systems. The IO pins are a way for the MCU to interface (connect to) with external systems.

The clock system ensures that all communications are running smoothly.

The interrupt controller alerts the CPU immediately when something important happens.

The concept is fairly simple. It is essentially the same as a student in class raising their hand in class as a teacher is teaching.

In this analogy, the student is the input controller and the teacher is the CPU.

interrupt controller and CPU analogy

Why Are MCUs Vital in IoT Development?

MCUs are vital in IoT development because they process the raw data from sensors and decide what to do with it. Additionally, the MCU can receive commands and control signals from other smart devices and influence actuators to which it is connected.

It will take the sensor data from a smart thermometer, for example, and decide that the room is too hot and turn on the AC.

Because of their low power consumption, they are energy efficient and can easily be battery-operated if necessary.

The size of the MCU makes it easy to cover up and to make an IoT visually appealing. They have a compact design that is easy to hide.

MCUs are affordable. They are cheap enough for technology hobbies like you (I’m assuming because you have read this far) and me to order online and get started in developing new tech.

Additionally, they are easily customizable and perform data processing in real-time.

Key Features of MCUs for IoT Applications

MCUs have several advantages that make them ideal for IoT applications. Here are some of the main features you will need to know about when developing IoT devices:

FeatureDescription
Connectivity OptionsMCUs connect to other devices locally through different connectivity options available. These options include:WiFiBluetoothZigbeeLoRaThreadEthernetNOTE: Not all MCUs have all of these options. You will need to read up on which connectivity options your MCU comes with when you buy it.
Low Power ModesMCUs can come with energy-saving features like sleep modes so that the IoT devices don’t deplete their battery too quickly.
Processing PowerProcessing power is typically measured in DMIPS (Dhrystone Million Instruction per Second). The more instructions a processing unit can execute per second, the more powerful it is. MCUs for IoT will generally have a processing range of 150 DMIPS to 850 DMIPS. (Regular computers have a processing power of 1,000-10,000 DMIPS, just for comparison)
Memory CapabilitiesMCUs typically have 3 types of memory: Flash memory, RAM, and EEPROM (Electrically Erasable Programmable ROM). Flash memory and EEPROM are nonvolatile, whereas RAM is volatile.EEPROM is used for storing permanent data like device parameters and sensor data and can be reprogrammed if necessary (unlike regular ROM).
Peripheral SupportTypically, MCUs will have many different embedded peripherals available to use. You just need to figure out which is best for your purpose. Here are some common peripherals:General Purpose Input / Output (GPIO) ports to interact with external devices and componentsAnalog to Digital Converter (ADC) for converting analog signals to digital values.Digital to Analog Converter (DAC) – the inverse of an ADCPulse Width Modulator (PWM) controls signal width for motors, LEDs, etc.Universal Asynchronous Receiver / Transmitter (UART) enables serial communication between devices.Embedded Timers are used to track time or trigger periodic events.

Projects and Resources

If you haven’t already, read through my Fundamentals of IoT post. I outline all the basics of IoT for beginners and recommend to start there.

I have a list of IoT projects for people at different skill levels to complete. Projects from setting up a Home Assistant server to creating a Smart Mirror. These projects will help you understand the potential of IoT solutions in various industries.

There are also courses online that are great introductions to IoT development. My favorite is MS IoT for Beginners. But I suggest joining the Reddit forum r/IOT for help in getting started. They have long threads on helping people get started.

Conclusion

To wrap it up, the MCU receives data from sensors, processes them, and makes decisions on what needs to happen next. The MCU then sends commands to the actuators to implement the changes.

The best way, in my opinion, to really understand MCUs is to practice and build your own projects. I have a list of IoT projects for you to try out on your own. This will help you understand MCUs better.

Send in the projects that you have created. My email is on the contact me page of this website.

FAQs

Frequently asked questions

What is an IoT microcontroller?

An IoT microcontroller is a small, integrated computer system designed specifically for Internet of Things (IoT) applications. It consists of a processor, memory, and input/output peripherals on a single chip, optimized for low power consumption and compact size.

What is the best microcontroller for IoT?

There isn’t really a “best” microcontroller for IoT devices. It heavily depends on what you want to use it for. However, the following MCUs stand out for IoT applications: ESP32, Arduino, Raspberry Pi Pico, STM32, and NVIDIA Jetson Xavier NX.

Similar Posts