Skip to main content
Robotics & Embodied AI

⏱ About 15 min15 XP

The Controller: A Robot's Brain

Every robot has a moment when raw sensor data becomes a decision and that decision becomes a command to an actuator. The subsystem that makes this happen is the controller — the computer at the heart of the robot. The controller reads sensor inputs, executes the program, and sends output signals to actuators, all repeating this cycle many times per second. Understanding the controller means understanding what kind of computer is involved, how it runs a program, and what the program is actually trying to do.

Microcontrollers

The most common type of robot controller for small and medium robots is a microcontroller. A microcontroller is a single integrated circuit that contains a CPU (central processing unit), a small amount of memory, and input/output pins — all on one chip. Microcontrollers are tiny, cheap, power-efficient, and start up instantly when powered on. The Arduino family of microcontrollers is famous in education and hobby robotics, but the same basic architecture powers millions of industrial robots, household appliances, and cars. Microcontrollers are optimized for real-time control: reading sensors and updating actuator signals on precise, predictable time schedules. A microcontroller in a motor controller might update motor speed 1,000 times per second, making tiny corrections to keep the motor running smoothly. That kind of deterministic timing is hard to achieve on the larger computers found in laptops and phones.

Real-Time vs. General-Purpose

A real-time controller guarantees that it will respond to an event within a defined maximum delay — for example, within 1 millisecond. This predictability matters in robotics: a robot arm picking fruit must respond fast enough to stop before crushing the fruit. A general-purpose computer running a web browser might occasionally pause for hundreds of milliseconds — fine for email, catastrophic for robot control.

Single-Board Computers

More capable robots need more computing power — especially if they use camera-based vision, run machine learning models, or need to navigate complex environments. These robots use single-board computers (SBCs) like the Raspberry Pi. An SBC is a full Linux computer on a single circuit board, with a multi-core processor, gigabytes of memory, and Wi-Fi built in. It can run sophisticated software but is less predictable in timing than a dedicated microcontroller. Many robots use both: a Raspberry Pi handles high-level decisions (where to go, what object is this), while a microcontroller handles low-level real-time tasks (exactly how fast each motor should spin right now). This split architecture is called a layered control system.

The Control Loop

The controller does not run a program once and stop. It runs in a continuous loop called a control loop. Each iteration of the loop follows four steps: read sensors, compute the desired action, send commands to actuators, wait a brief time, then repeat. This loop might execute 50, 100, or 1,000 times per second depending on the robot and the task. The most common type of control loop in robotics is called PID control — short for Proportional-Integral-Derivative. A PID controller measures the error: the difference between where the robot is and where it wants to be. It then calculates a correction that is proportional to the error (bigger error = bigger correction), integrates accumulated past error (to eliminate slow drift), and responds to the rate of change of error (to prevent overshooting the target). PID controllers are inside every drone, every wheeled robot, every motor controller, and most industrial machinery.

The Thermostat Analogy

A household thermostat is a simple controller. It reads the temperature sensor, compares it to the target temperature (the setpoint), and turns the furnace on or off. A robot's PID controller does the same thing but many times per second and with smooth proportional corrections instead of on/off switching. The fundamental idea is identical: measure, compare to target, correct.

Match each controller concept to its correct description.

Terms

Microcontroller
Single-board computer
Control loop
Setpoint
Error

Definitions

The target value the controller is trying to reach or maintain
The difference between the current sensor reading and the desired setpoint
A program that repeatedly reads sensors, computes a response, and commands actuators
A single chip containing CPU, memory, and I/O pins; optimized for real-time, low-power control
A full Linux computer on one board; handles high-level processing but less timing-predictable

Drag terms onto their definitions, or click a term then click a definition to match.

A drone's flight controller must adjust rotor speeds hundreds of times per second to stay level. Which controller type is best suited to this task, and why?

In a PID control loop, what is the 'error' that the controller is always measuring?

Design a Control Loop

  1. Step 1: Choose a robot task that requires continuous adjustment — examples: keeping a ball balanced on a platform, following a line on the floor, maintaining a fixed distance behind a moving object.
  2. Step 2: Define the sensor: what does it measure, and what number does it give the controller?
  3. Step 3: Define the setpoint: what value is the controller trying to maintain?
  4. Step 4: Define the error: write the formula (error = setpoint - current reading).
  5. Step 5: Define the actuator response: if the error is large and positive, what does the controller do? If the error is zero? If it is negative?
  6. Step 6: Sketch a flowchart of your control loop showing all four steps (read, compute, act, wait) as boxes with arrows. Include where the sensor and actuator connect.