Skip to content
SDB
Embedded Control and Mechatronics

2 hours

Introduction to Embedded Computing and Control

Foundations of Real-Time Systems and Microcontroller Architecture

Subhendu Datta BhowmikRobotics Tutorials

What is an Embedded System?

An embedded system is a dedicated computer system designed to perform one or a few specific functions — often with real-time computing constraints. Unlike a general-purpose desktop computer, an embedded system is embedded as part of a complete device, frequently including hardware and mechanical components.

Embedded systems are ubiquitous: they power microwave ovens, anti-lock braking systems, medical pacemakers, industrial conveyor belts, and robotic arms. In robotics, virtually every subsystem — motor drivers, sensor interfaces, safety interlocks, communication stacks — relies on an embedded processor.

Key characteristics of embedded systems:

  • Real-time operation: responses must occur within defined time bounds (soft or hard deadlines)
  • Resource constraints: limited RAM, flash, CPU cycles, and power
  • Reliability: often must run continuously for years without human intervention
  • Low-level hardware access: direct manipulation of GPIO pins, timers, interrupts, and peripherals

Core Concepts in Embedded Control

  1. 01

    Microcontroller Unit (MCU): integrates CPU, RAM, flash, and I/O peripherals on a single chip

  2. 02

    Clock speed and instruction cycles determine how fast the CPU can execute code

  3. 03

    Interrupts allow the CPU to respond immediately to hardware events without polling

  4. 04

    Watchdog timers reset the system automatically if software hangs

  5. 05

    Direct Memory Access (DMA) transfers data between peripherals and RAM without CPU involvement

  6. 06

    Real-Time Operating Systems (RTOS) schedule tasks with deterministic timing guarantees

Microcontroller vs Microprocessor vs SBC

Microcontroller (MCU)

  • CPU + RAM + Flash + peripherals on one chip (e.g., ATmega328, STM32)
  • Low power, low cost — ideal for real-time I/O tasks
  • Runs bare-metal firmware or lightweight RTOS
  • No operating system overhead; deterministic timing
  • Typical clock: 8–480 MHz, RAM: 2 KB – 1 MB

Single-Board Computer (SBC)

  • Full Linux/Windows OS on a credit-card board (e.g., Raspberry Pi)
  • High computational power — suitable for vision, ML, ROS
  • Non-deterministic OS scheduler; hard real-time requires RT kernel patch
  • Higher power consumption (2–10 W typical)
  • GPIO available but with software overhead

Control Loops in Embedded Systems

A control loop is the fundamental pattern of embedded control software:

while (true) {
    read_sensors();       // sample physical world
    compute_control();    // run control algorithm (e.g., PID)
    write_actuators();    // drive motors, valves, LEDs
    wait_until_next_tick(); // maintain fixed sample rate
}

The sample rate (loop frequency) must be fast enough relative to the system dynamics. A rule of thumb is to sample at least 10× the bandwidth of the controlled process. Industrial servo drives typically run at 1–20 kHz; mobile robot base controllers at 100–500 Hz.

Hard real-time systems guarantee a worst-case response time — missing a deadline causes system failure (e.g., engine ignition timing, surgical robot). Soft real-time systems tolerate occasional deadline misses with degraded — but acceptable — performance (e.g., video streaming buffer).

Common Embedded Processor Families in Robotics

FamilyExamplesArchitectureTypical Use
AVR (Atmel/Microchip)ATmega328, ATmega25608-bit RISCArduino Uno/Mega, hobby robotics
ARM Cortex-MSTM32, nRF52, SAMD2132-bit RISCMotor drivers, sensor nodes, ROS 2 micro
ARM Cortex-ABCM2711 (Pi 4), i.MX864-bit ARMv8ROS 2 hosts, computer vision
RISC-VESP32-C3, GD32VF32-bit open ISAIoT sensors, low-cost wireless nodes
Xtensa LX7ESP32-S332-bit + vectorWi-Fi/BT edge AI, sensor hubs
x86-64Intel NUC, Jetson (ARM)64-bit CISC/ARMHigh-performance compute, simulation

Embedded Control and Mechatronics