Microcontroller

Also known as: MCU

On this page 8

A microcontroller (MCU) is a single integrated circuit that combines a processor core, memory and input/output peripherals on one die, built to run one dedicated control task inside a larger device. Among processors in computer hardware, it sits at the opposite end from a desktop CPU: instead of maximizing throughput for many applications, it prioritizes low cost, low power and predictable timing.

Microcontrollers run washing machines, car door modules, thermostats, keyboards, power tools and medical sensors. Most of them execute firmware directly from on-chip flash, often without an operating system, and react to the physical world through timers, analog-to-digital converters and serial buses integrated on the same chip.

What a microcontroller contains

A microcontroller is a complete computer on one chip, so the board around it needs little more than a power supply, a clock source and connectors. The table below lists the main on-chip blocks and the role each one plays.

BlockTypical size or formRole
Processor core8-bit, 16-bit or 32-bitExecutes firmware instructions
Flash memory4 KB to 4 MBStores program code and constants
SRAM1 KB to 1 MBHolds variables, stack and buffers
Timers and PWM2 to 20 channelsMeasure time, drive motors and LEDs
ADC and DAC10-bit to 16-bit resolutionConvert between analog and digital signals
Serial interfacesUART, SPI, I2C, CAN, USBTalk to sensors, chips and other boards
GPIO pins6 to over 150 pinsRead buttons, switch loads, signal states
Main building blocks of a typical microcontroller

The core fetches instructions from flash over a bus that usually follows a Harvard-style split between code and data paths. Peripherals are controlled through memory-mapped registers: firmware writes a value to a fixed address, and the hardware block changes its behavior, which is why MCU programming is closely tied to the chip’s reference manual.

Interrupts are the other essential mechanism. When a pin changes state or a timer expires, the interrupt controller suspends the main program and jumps to a short handler. This lets a slow, cheap core respond to events within tens of nanoseconds to a few microseconds, far more consistently than a general-purpose computer with a complex operating system.

Core architectures and performance classes

Microcontrollers fall into classes defined by data width and core design, and each class targets a different balance of price, power and computing capacity. The following table summarizes the common classes.

ClassTypical clock speedRepresentative coresTypical use
8-bit MCU1 to 48 MHzAVR, PIC, 8051Simple appliances, toys, sensors
16-bit MCU8 to 100 MHzMSP430, PIC24Metering, low-power instruments
32-bit MCU48 to 600 MHzArm Cortex-M, RISC-VMotor control, IoT, wearables
Crossover MCU500 MHz to 1 GHzCortex-M7, high-end RISC-VAudio, graphics, edge machine learning
Common microcontroller classes

The Arm Cortex-M family dominates the 32-bit segment, while RISC-V cores are growing quickly because the open instruction set architecture removes licensing fees. Some recent parts add a small neural processing block for keyword spotting or vibration analysis, which brings them close to the territory of an NPU, but on a budget of milliwatts rather than watts.

Clock speed alone is a poor measure of capability. A Cortex-M4 with a floating-point unit at 80 MHz can outperform an older 8-bit part at the same frequency by more than an order of magnitude on signal-processing tasks, because it handles 32-bit data, hardware multiply-accumulate and single-cycle memory access.

Microcontroller versus microprocessor and SoC

The essential difference is integration and purpose: a microcontroller carries its memory on chip and runs a fixed task, whereas a microprocessor relies on external memory and runs a full operating system. The comparison below separates three device types that are often confused.

PropertyMicrocontrollerApplication processor or SoCDesktop CPU
MemoryOn-chip flash and SRAMExternal DRAM and storageExternal DRAM and storage
Operating systemNone or a small RTOSLinux, Android, WindowsWindows, macOS, Linux
Memory management unitUsually absentPresentPresent
Power consumptionMicrowatts to about 1 W1 to 10 W15 to 250 W
Unit priceUnder 0.10 to about 15 USD5 to 100 USD50 to 700 USD
Timing behaviorDeterministicVariableVariable
How a microcontroller differs from related processors

The absence of a memory management unit explains why most MCUs cannot run standard Linux. Instead, they use bare-metal firmware or a real-time operating system such as FreeRTOS or Zephyr, which schedules tasks with bounded latency. Concepts that matter for a desktop CPU, such as a large cache hierarchy, simultaneous multithreading or overclocking, are rare or absent in microcontrollers.

Power management and real-time behavior

Microcontrollers are designed to spend most of their life asleep, waking only to measure, decide and act. A battery-powered sensor may be active for a few milliseconds per second and sleep the rest of the time, which is how a coin cell can last several years.

ModeTypical currentWake-up timeWhat keeps running
Run50 to 300 µA per MHzNot applicableCore and all enabled peripherals
Sleep10 to 100 µAUnder 1 µsPeripherals and interrupts
Stop or deep sleep1 to 10 µA5 to 50 µsRAM retention, low-power timer
Standby or shutdownUnder 1 µAUp to several msWake-up pins, real-time clock
Typical power modes and their trade-offs

Real-time behavior means that the worst-case response is known in advance, not that the chip is fast. Engineers achieve it by keeping interrupt handlers short, assigning interrupt priorities carefully and avoiding unbounded loops. A missed deadline in a motor controller or airbag module is a functional failure, not a slowdown.

Choosing a microcontroller for a design

Selecting an MCU starts from the peripherals and power budget the product needs, not from raw speed. A part that lacks a required interface forces an extra chip, which raises cost and board area. The decision table below reflects common engineering practice.

RequirementRecommended choiceReason
Lowest unit cost at high volume8-bit or small 32-bit MCUSmallest die and package
Battery life of yearsUltra-low-power 32-bit MCUSub-microampere standby modes
Brushless motor controlMCU with advanced PWM and fast ADCPrecise switching and current sensing
Wireless connectivityMCU with integrated radioFewer components, certified RF design
Automotive or industrial safetyQualified MCU with lockstep coresSupports ISO 26262 or IEC 61508 processes
Matching the microcontroller to the requirement

Teams also weigh the toolchain, debug support and long-term availability. Industrial and automotive products often stay in production for ten to fifteen years, so a manufacturer’s longevity commitment can matter more than a slightly lower price.

Limitations and common mistakes

The main limitation of a microcontroller is its tight memory budget: kilobytes of SRAM leave no room for careless allocation, large libraries or heavy graphics. Typical problems in practice include the following.

  • Stack overflow from deep recursion or large local buffers, which corrupts memory silently.
  • Blocking code inside interrupt handlers, which delays every other event and breaks timing.
  • Floating inputs left without pull-up or pull-down resistors, which cause random readings and extra current draw.
  • Missing watchdog configuration, so a firmware hang leaves the device stuck instead of restarting.
  • Unprotected firmware, where disabled readout protection or an unsigned update path exposes the device to cloning or tampering.

Security deserves particular attention in connected products. Modern MCUs offer secure boot, hardware cryptography and isolated execution zones, but these features protect nothing unless the firmware enables and configures them correctly.

Explained without jargon

A microcontroller is a tiny, complete computer squeezed into one chip. It has its own brain, its own memory and its own connections to buttons, lights, motors and sensors. It does not run apps or browse the web. It does one job, again and again, very reliably.

Think of the chip inside a microwave oven. It reads the keypad, counts down the time, switches the heater and beeps at the end. That is all it ever does, and it does it for years on very little electricity. Most electronic devices around you contain at least one, and a modern car contains dozens.

A typical use case

An engineering team designs a wireless soil moisture sensor for vineyards. They choose a 32-bit low-power microcontroller with an integrated sub-GHz radio, a 12-bit ADC and 256 KB of flash. Every 15 minutes, the low-power timer wakes the chip, which powers the sensor probe, takes eight ADC readings, averages them and transmits a short packet to a gateway.

The whole active cycle lasts about 40 milliseconds. For the remaining time, the MCU sits in deep sleep at roughly 2 µA with only the real-time clock running. As a result, two AA batteries power each sensor for more than three years, and the vineyard manager receives irrigation data from 200 locations without replacing a single battery during the project.