📘 CodingMarble Learn

Feedback Control

Feedback control measures the output, compares it with the set point and uses the error to correct the machine. ON-OFF control swings around the target, P control gives an error that gets smaller but leaves an offset, and adding I removes the offset. Good control is fast, steady and does not overshoot much.

🎬 Step-by-step story

  1. An oven must stay at 60°C. In open loop the heater runs at one fixed power and nobody checks. At first it is fine. Then the door opens (red tag) and the temperature drops and stays low.
  2. Now ON-OFF feedback. A sensor measures the oven. Below the set point the heater is fully ON, above it fully OFF. After the door opens, it recovers, but the line zigzags around 60.
  3. P control: heater power is proportional to the error. Large error, big power; small error, small power. The line is smooth, but a small gap (offset) stays below 60.
  4. PI control: the I part adds up the error over time, so it keeps pushing until the gap is zero. The temperature settles exactly at 60, even after the door opens.
  5. Your turn. Pick a mode, change Kp, open and close the door. Watch the red line, the green set point and the heater power.

Tip: drag the 3D scene to turn it. Use two fingers to zoom.

🤔 Common doubts, cleared

Why can open loop not fix the door problem?

It never measures the temperature, so it has no idea something changed. Watch the line stay low in step 0.

Why not always use ON-OFF, since it is simple?

It makes the value swing. That is fine for a fridge, but bad where the value must be steady.

What is the offset I see in P control?

The small gap between the red line and the green set point after it settles. P needs a bit of error to keep giving power.

How does I remove the offset?

It keeps adding the error. While any gap remains, the heater power keeps rising until the gap is zero.

What happens if Kp is very high?

The system reacts hard and may swing. Try a large Kp in free play and watch the line.

Overview of feedback control

Feedback control uses the result to decide the next action. It runs in a loop:

  1. Measure the output with a sensor (temperature, speed, level).
  2. Compare it with the set point (the target). The difference is the error: error = set point − measured value.
  3. The controller turns the error into a command.
  4. The actuator (heater, motor, valve) changes the output. Go back to step 1.

An open-loop system skips the measuring, so it cannot notice a disturbance (like the oven door opening). A closed-loop system sees the change in the output and corrects it.

Negative feedback means the correction works against the error (too hot, so heat less). That keeps the system stable. Positive feedback would push the error even bigger.

More on the basic idea of open and closed loops is in Control systems.

Control characteristics

We judge a controller by how its output responds after a change in set point or a disturbance.

Control modes:

Applying feedback control

Feedback control is everywhere in electronics and machines.

Tuning steps: start with P only and raise Kp until the response is quick but not shaky; add a little I to remove the offset; add D only if overshoot is a problem.

Practical points: choose a sensor that is fast and accurate enough; the actuator must be strong enough (a heater that is too small can never reach the set point); noisy sensor signals need filtering.

Try it: be the controller

At home: hold a tap so a bucket stays half full while a friend pulls water out of it. You are the sensor (eyes), the controller (brain) and the actuator (hand). When the friend pulls more, how do you respond? Did you act on the size of the error (P) or on how long it stayed (I)? In the 3D, set PI mode, open the door and see how the heater power rises on its own.

Key formulas and definitions

Worked examples

1. Set point 60°C, measured 52°C. What is the error?

Error = 60 − 52 = 8°C (positive, so the heater must give more).

2. A P controller has Kp = 2% power per °C. The error is 15°C. What is the heater power?

Power = 2 × 15 = 30%.

3. An ON-OFF thermostat has set point 25°C and hysteresis ±1°C. At what temperatures does it switch ON and OFF?

ON below 24°C, OFF above 26°C.

4. A water heater is set to 50°C. The peak reached is 56°C before settling. Find the overshoot.

Overshoot = (56 − 50)/50 × 100 = 12%.

5. With P control only, the final temperature is 56°C when the set point is 60°C. What is the steady-state error and which action removes it?

60 − 56 = 4°C. Adding an I (integral) action removes it.

6. Motor set to 1500 rpm; it reads 1380 rpm on a hill. Kp = 0.01 V per rpm. By how much does the controller raise the voltage?

Error = 1500 − 1380 = 120 rpm. Voltage change = 0.01 × 120 = 1.2 V.

Common mistakes

Practice quiz

1. Error is:
2. Which control swings around the set point?
3. The I part of PI control removes:
4. Overshoot is:
5. Which has no sensor feedback?

Practice: answer these yourself

Type or choose your answer, then press Check. Use a hint if you are stuck; the full solution appears after you answer.

Frequently asked questions

What is feedback control in simple words?

The machine measures what it is doing, compares it with what you want, and corrects the difference again and again.

What is the difference between ON-OFF and P control?

ON-OFF uses full power or none and swings around the target. P control uses power in proportion to the error, so it is smoother.

What is a PID controller?

A controller that adds three parts: P (present error), I (past error added up) and D (how fast the error is changing). It is the most common industrial controller.

Where this is taught

Japan高校(専門学科)1〜3年Electronic Measurement and Control

Learn first

Learn next

Related lessons

All Computer Science lessons