Skip to content

Control Systems: How Machines Hold a Setpoint

A thermostat, a cruise control and a hovering drone do the same thing: measure, compare, correct. Why that works, and why too much of it makes things oscillate.

11 min readReadInteractive

You set the cruise control to 100 km/h and drive up a long hill. The engine works harder and the speed barely moves. Nobody told the car about the hill. A thermostat holds a room at 21 °C through a heatwave and a cold snap. A drone hovers in a gusty wind as if hung from a hook. A rocket booster lands upright.

All of them do the same thing: they measure what is happening, compare it with what should be happening, and push on the difference. That loop is feedback, and control systems is the course on how to do it well, and what happens when you do it badly (it oscillates, sometimes violently).

The course in one box

Who takes it: mechanical, aerospace, electrical and chemical engineers, usually in year 4 (sometimes late year 3).

What it's for: making a machine hold a speed, a heading, a temperature or a position on its own, even when the world pushes back.

Comes after: Differential Equations (34/03), Vibrations (34/17) and Linear Algebra (34/04).

Leads to: Systems Engineering & the Capstone (34/22), where the controller has to agree with every other subsystem. In Computer Science it meets Software Engineering (34/31) in embedded code and Machine Learning (34/32) in reinforcement learning, which is control with a learned rule.

Honest line: you won't be able to design a flight controller after this. You will see why a loop oscillates when its gain is too high, and what the three letters PID are doing in the car you drive.

Open loop versus closed loop

A toaster is open loop: you pick a time, it heats for that long and stops, whether the bread is pale or black. It never looks at the result. A thermostat is closed loop: it measures the room and decides, again and again, whether to heat. Open loop works when you know the system exactly and nothing disturbs it. The real world is not like that, and closed loop is how machines cope.

Here is the cruise control, as a toy car with a first-order lag (a time constant of 25 s). In open-loop mode the throttle is set once to hold 25 m/s on flat ground. Add a hill and watch.

Interactive · Open loop, then closed
Hill steepness
Feedback gain

Open loop on a 2% hill: speed drops about 4.7 m/s (17 km/h) and stays down.

A toy car: 1,200 kg, drag 48 N per m/s, engine force 0 to 3,000 N, starts at 20 m/s. Closed loop adds force in proportion to the speed error. Gain 600 cuts the loss on a 2% hill to about 0.36 m/s.

Feedback and the block diagram

Control engineers draw every loop as a block diagram: boxes for things that transform a signal, arrows for the signals. The set speed goes in; a comparator subtracts the measured speed to give the error; the controller turns the error into a command; the actuator (here the engine) does the pushing; the plant (the car) responds; the sensor (a speed sensor) reports back. A disturbance, the hill, enters from the side.

ControllerActuatorPlantSensor set speederrorPIDenginecarhillspeed−+

Why is this so powerful? Suppose the plant's gain G is uncertain by ±30% (a heavy load, a worn part). Open loop passes that uncertainty straight to the output. With feedback and a high controller gain K, the output is KG/(1 + KG), which is close to 1 for any G, so the loop all but ignores the uncertainty. That is also why feedback rejects disturbances: the error shows up and the controller pushes back.

Interactive · Feedback shrinks uncertainty
Controller gain K

With K = 10, plant gains of 0.7, 1.0 and 1.3 give 0.875, 0.909 and 0.929 instead of 0.7, 1.0 and 1.3.

Command = 1. Open loop output = G; closed loop output = KG ÷ (1 + KG). The leftover shortfall is what integral control, below, removes.

First- and second-order response: time constant, overshoot, settling

To judge a controller you look at its step response: how the output follows when the command suddenly jumps. Two shapes cover most of what you meet.

First order is a smooth exponential approach, like the car's speed or a cooling cup of tea. It has one number, the time constant τ: the output covers 63% of the gap in one τ, 95% in 3τ and 98% in 4τ, which engineers call "settled". It can never overshoot.

Second order has inertia as well as lag, like the mass-spring of Vibrations (34/17), and it is described by the very same two numbers: the natural frequency ωn and the damping ratio ζ. Low ζ gives fast but overshooting ringing; ζ near 0.7 gives about 5% overshoot and is a common design target. The overshoot depends only on ζ: 53% at ζ = 0.2, 16% at 0.5, 4.6% at 0.7. Settling time is roughly 4 ÷ (ζωn).

Interactive · Step response
Time constant τ
Natural frequency ωₙ
Damping ratio ζ

First order, τ = 2 s: 63% at 2 s, 98% at 8 s. Never overshoots.

Exact formulas, checked against a step-by-step numerical solution. In second order: ζ = 0.2 gives 52.7% overshoot, 0.5 gives 16.3%, 0.7 gives 4.6%.

Transfer functions and Laplace, in plain words

Here is the trick that makes control theory work. Differential equations are awkward to combine: put two systems in a chain and you must solve their equations together. The Laplace transform turns calculus into algebra. It replaces "take the derivative" with "multiply by s", so that a differential equation becomes a fraction, the transfer function: output divided by input, written in terms of s. Chains of systems become products, and feedback loops become the formula you already met, G ÷ (1 + GC).

The part a graduate carries for life is what the fraction's roots, the poles, mean. Each pole is an exponent the system can "ring" with: a pole at s = −σ gives e−σt, a decay with time constant 1/σ. A pair at s = −σ ± jω gives a decaying oscillation at frequency ω. The first-order car has one pole at −1/τ. The mass-spring has the pair −ζωn ± jωn√(1 − ζ²). If every pole sits on the left side of the s-plane, every response dies out: the system is stable. One pole on the right and something grows without limit.

Interactive · Place a pole
Real part (decay or growth)
Imaginary part (ringing)

Pole at s = −0.8 ± 3.0j: stable, ringing about 0.5 times a second.

The response plotted is eσt·cos(ωt). Left of the vertical axis everything decays; right of it, everything grows.

PID control, explained with a cruise control

The workhorse controller turns the error into a command with three terms:

  • P (proportional): the present. Push in proportion to the error now. Simple, but it leaves a permanent leftover error when something (the hill) needs a steady push, because a push needs an error to exist.
  • I (integral): the past. Add up the error over time and push on the total. A leftover error keeps growing the sum until the leftover is gone. This is what removes the steady-state error, but too much of it overshoots.
  • D (derivative): the future. Push against how fast the error is changing, a guess at where it is heading. It adds damping, but it amplifies sensor noise.
u = Kp·e + Ki·∫e dt + Kd·de/dtcommand = P × error + I × accumulated error + D × rate of change of error

This three-term rule runs most of industry. Åström and Hägglund, authors of the standard text on PID, report that more than 95% of the control loops in process industries are of the PID type, and most of those are really PI. Ziegler and Nichols published the classic tuning rules in 1942 and they are still taught. Try tuning the cruise control yourself. Start with P only: see the leftover. Switch to PI: the leftover vanishes. Then switch on sensor noise and add D.

Interactive · Tune the cruise control
Hill steepness
P gain
I gain
D gain

P only on a 2% hill: about 0.36 m/s below the set speed, for good. With PI: back to the set speed.

The same toy car, with a feed-forward trim of 1,200 N plus PID on the measured speed (anti-windup included). Noise: 0.15 m/s of random error on the speed sensor, fixed seed so runs repeat.

Stability: why too much gain oscillates

If a little feedback is good, is more better? Not forever. Imagine steering a car by looking only at your distance from the centre line. If you correct with too much force, you overshoot, correct back too hard, and weave. A real loop has delays: sensors take time, computers take time, motors take time. A correction that arrives late can push at the wrong moment, adding energy instead of removing it. Past a certain gain a loop goes from settling to ringing to growing: it has gone unstable. It is the same negative-damping story as the bridges in Vibrations.

The drone below holds an altitude. Its plant is almost pure inertia (thrust makes acceleration), so P alone swings it up and down forever: there is no damping in the plant. The D term is the missing damper (ζ = Kd ÷ 2√Kp). Now add what real hardware does: delay the commands, or update them only every so often.

Interactive · Hold the altitude
P gain
D gain
Delay in the loop
Controller update interval

Well damped: settles on the target with no overshoot.

A 1 kg drone, thrust limited to ±1 g about hover, 0.3 m step. P only never settles (it swings at √Kp rad/s). With the D term, a 250 ms delay is enough to make it grow, and a 0.3 s update interval makes the higher-gain setting ring.

Sensors, actuators and digital control

A loop is only as good as what it can see and what it can do. Sensors (encoders, gyros, thermocouples, pressure and GPS) set the noise floor, and you can't control what you can't measure. Actuators (motors, valves, heaters, control surfaces) have limits: the engine in the sim can't produce negative force or more than 3,000 N. When an actuator saturates while the integral keeps adding up, the controller "winds up" and overshoots badly, so real controllers freeze the integral at the limits. The sim does exactly that.

Today nearly every controller is digital: a microcontroller samples the sensor, computes, writes an output, and holds it until the next sample. The delay and the holding are real and are what the "update interval" slider is imitating. A textbook rule (Franklin, Powell and Emami-Naeini) is to sample about 20 times faster than the closed-loop bandwidth you want, and other texts quote anywhere from 10 to 30. So a flight controller usually runs its loop tens to hundreds of times a second. This is where this course meets Computer Science: a control loop is a real-time program with a deadline, and missing the deadline is a stability problem, not a slowdown.

What a graduate just sees

  • Every automatic machine is a loop: measure, compare, correct. Ask what the sensor sees and what the actuator can do.
  • Open loop is a bet that nothing changes; feedback is how you stay right when it does.
  • A first-order system has a time constant (98% settled in four of them); a second-order one has ζ and ωn, and ζ sets the overshoot.
  • Poles tell the story: left of the axis it decays, right of it it grows, and the imaginary part is the ringing.
  • P alone leaves an error, I removes it, D adds damping, and each has a cost (overshoot, windup, noise).
  • More gain is faster until delay turns correction into a push in the wrong direction.
  • Real actuators saturate, real sensors are noisy, and real computers sample.
  • A controller is a damper you can reprogram.

Where it shows up next

  • Systems Engineering & the Capstone (34/22): a controller is useless without sensors, actuators, power and software that agree with each other; the capstone is where they are tested together.
  • Vibrations (34/17): feedback is active damping; a flight controller does for a drone what a viscous damper does for a bridge.
  • Propulsion (34/21): engines run on control loops for fuel flow and turbine speed.
  • The real world: thermostats, cruise control, 3-D printers, robot arms, drones, aircraft autopilots, rockets, chemical plants, insulin pumps.
  • Computer Science and Electrical Engineering: embedded and real-time software (Embedded Systems, 34/41; Operating Systems, 34/26) run the loops; reinforcement learning (34/32) learns a control rule from experience instead of deriving it.

If you want to go deeper

  • 📘 Textbook: Franklin, Powell and Emami-Naeini, Feedback Control of Dynamic Systems (Pearson; 8th edition): the standard undergraduate text, with a full digital control chapter.
  • 📘 Textbook: Katsuhiko Ogata, Modern Control Engineering (Pearson): a long-time classroom favourite, strong on transfer functions and root locus.
  • 📘 Gentler (free): Karl Johan Åström and Richard Murray, Feedback Systems: An Introduction for Scientists and Engineers (Princeton University Press; 2nd edition, 2021), which its authors keep available free online. Also Brian Douglas's Control Systems Lectures on YouTube and Steve Brunton's Control Bootcamp, both free video series.
  • ▶️ Free course: MIT OpenCourseWare 2.04A Systems and Controls (Spring 2013): from differential equations to Laplace, transfer functions and root locus, with a lab on a rotating flywheel.
  • 🌐 Easier first read in this library: Fourier Transform (12/12).
The takeaway

Feedback means measuring, comparing and correcting, and it lets a machine hold a setpoint despite hills, loads and uncertainty. Systems respond with a time constant (first order) or with overshoot set by the damping ratio (second order), and their poles show whether they will decay, ring or blow up. PID combines the present, the past and the future of the error, and every term costs something. Too much gain, or too much delay, turns correction into oscillation, which is why stability comes before performance.

Try this: take a hot shower and adjust the tap. Notice how long the water takes to answer. If you turn it again before the last change arrives, you swing between scalding and freezing. That is a loop with delay and too much gain, and you are the controller.

Sources & Further Reading

Sources. Block diagrams, step response, Laplace and stability are standard textbook material (Franklin et al.; Ogata; Åström and Murray). PID prevalence (over 95% of process-control loops, mostly PI): K. J. Åström and T. Hägglund, PID Controllers: Theory, Design and Tuning and Advanced PID Control. Tuning rules: J. G. Ziegler and N. B. Nichols, "Optimum settings for automatic controllers", Transactions of the ASME 64 (1942) 759–768. Sampling rule of thumb: Franklin, Powell and Workman / Emami-Naeini, discussion of digital control (about 20 times the bandwidth; other texts say 10 to 30). Computed in node: the exact step responses (checked against numerical integration), overshoot and settling figures, the cruise-control and drone simulations and the stability thresholds quoted in the notes.