Source: https://mokxi.com/learn/path/control-systems-pid
Updated: 2026-11-11

All paths

# Control systems: PID

Feedback control on real physics: open and closed loops, P, I and D one at a time, tuning by the numbers, encoders, a balancing robot, and a motor that holds its speed whatever you throw at it.

Arduino Uno R3 Free 7 lessons 7 h 5 chapters 2,584 XP Robotics · Advanced +250 XP

0 of 7 done

Start the course free Open loop, closed loop Lesson plan for teachers

What you will build

## 2 projects, built step by step

7 lessons in 5 chapters, about 7 hours on a simulated Arduino Uno R3. Free, in your browser, every step checked by the simulator.

Chapter 2 project

### D: damping

A position loop that turns the wheel to an angle: P alone acts as a spring and overshoots, D acts as a damper and stops it clean, friction leaves the last few degrees, and too much D buzzes.
Open it in the simulator

Chapter 3 project

### Encoder speed

Count a quadrature encoder in interrupts: direction from the phase between A and B, x1, x2 and x4 decoding, speed by counting edges or by timing them, and how the measurement decides how steadily a loop can hold 30 rpm.
Open it in the simulator

The map

## Chapter by chapter

Each lesson opens when the one before it is done, and each chapter ends in a project.

Chapter 1

## Feedback

Why measuring and correcting beats a good guess.

Open 326 XP

### Open loop, closed loop

Drive a gear motor at a fixed PWM and watch the speed drift the moment the supply sags. Then close the loop: measure, compare, correct, and the speed comes back on its own.

0 of 7 steps

Start What is in it

Chapter 2

## P, I and D

Each term on its own: what it fixes and what it breaks.

Locked 288 XP

### P, then I

Proportional control and the offset it always leaves, why cranking the gain makes it hunt instead, the integral term that wipes the offset out, and the windup that bites when the output hits its limit.

0 of 6 steps

Project Locked 576 XP

### D: damping

A position loop that turns the wheel to an angle: P alone acts as a spring and overshoots, D acts as a damper and stops it clean, friction leaves the last few degrees, and too much D buzzes.

0 of 6 steps

Chapter 3

## Tuning and sensing

Step tests and Ziegler-Nichols, and the encoder every loop leans on.

Locked 288 XP

### Tuning by the numbers

Step tests that measure rise time, overshoot, settling time and steady-state error, the Ziegler-Nichols experiment for finding the ultimate gain and period, and a tune refined until it meets a written spec.

0 of 6 steps

Project Locked 530 XP

### Encoder speed

Count a quadrature encoder in interrupts: direction from the phase between A and B, x1, x2 and x4 decoding, speed by counting edges or by timing them, and how the measurement decides how steadily a loop can hold 30 rpm.

0 of 6 steps

Chapter 4

## Unstable plants

A balancing robot, where the controller is all that keeps it up.

Locked 288 XP

### Balance control

PID on an unstable plant: the balance bot’s tilt held at zero, each term knocked out to see what it was doing, pushes measured, and a stiffer tune written into the code.

0 of 6 steps

Chapter 5

## Boss

Hold a motor speed through a sag, a surge and a stall.

Locked 288 XP

### Boss: hold the speed

The final fight: a clean start to 120 rpm, a supply sag, a surge, and a stall no controller can win, refereed round by round by the sketch. Beat all four with your own gains and anti-windup.

0 of 6 steps

Syllabus

## Every lesson in the course

All 7 lessons, in order, each with what it covers. Any of them opens in the editor right away.

Chapter 1

### Feedback

- Open loop, closed loop Drive a gear motor at a fixed PWM and watch the speed drift the moment the supply sags. Then close the loop: measure, compare, correct, and the speed comes back on its own.

Chapter 2

### P, I and D

- P, then I Proportional control and the offset it always leaves, why cranking the gain makes it hunt instead, the integral term that wipes the offset out, and the windup that bites when the output hits its limit.
- D: damping A position loop that turns the wheel to an angle: P alone acts as a spring and overshoots, D acts as a damper and stops it clean, friction leaves the last few degrees, and too much D buzzes.

Chapter 3

### Tuning and sensing

- Tuning by the numbers Step tests that measure rise time, overshoot, settling time and steady-state error, the Ziegler-Nichols experiment for finding the ultimate gain and period, and a tune refined until it meets a written spec.
- Encoder speed Count a quadrature encoder in interrupts: direction from the phase between A and B, x1, x2 and x4 decoding, speed by counting edges or by timing them, and how the measurement decides how steadily a loop can hold 30 rpm.

Chapter 4

### Unstable plants

- Balance control PID on an unstable plant: the balance bot’s tilt held at zero, each term knocked out to see what it was doing, pushes measured, and a stiffer tune written into the code.

Chapter 5

### Boss

- Boss: hold the speed The final fight: a clean start to 120 rpm, a supply sag, a surge, and a stall no controller can win, refereed round by round by the sketch. Beat all four with your own gains and anti-windup.

Keep going

## The next course on your track

Control systems: PID is part of the embedded track, a ladder of courses from zero to expert.

Next course

### Scheduling and RTOS

From a scheduler written by hand to FreeRTOS on the Uno: tasks and priorities, time slicing on the logic analyzer, queues, mutexes and priority inversion, starvation and the watchdog, and a four-task device.
Open the next course

Track

### Embedded track

Arduino, ESP32, Raspberry Pi Pico and STM32: pins, timing, buses, motors, WiFi, registers and debugging, every lesson checked on a simulated board.
See every course on the track

Kits

## Build it on your bench too

Every lesson runs in the simulator with nothing to buy. When you want the real thing, these kits have the parts.

Have a kit already?

### Find your kit

Pick the starter kit you own and run every lesson in its manual with the same parts on the same pins.
See every kit

Questions

## About Control systems: PID

Is Control systems: PID free?

Yes. All 7 lessons of Control systems: PID are free and run in your browser, with nothing to install and no parts to buy before you start.

Do I need a real Arduino Uno R3?

No. Every lesson runs on a simulated Arduino Uno R3 with its parts on the canvas, and the simulator checks each step as you go. When you want to build it for real, the same wiring and code work on a real board.

How long does Control systems: PID take?

About 7 hours: 7 lessons in 5 chapters, each one a few short steps. Your progress is kept, so you can stop after any lesson and pick up where you left off.

What will I build?

Each chapter ends in a project that puts it together: D: damping and Encoder speed.

Where do I start?

With "Open loop, closed loop", and each lesson builds on the one before it. New to circuits? Electronics basics is the course that starts from zero.
