Lite / Discovering How the World Works / Week 25
On/off control: the bang-bang thermostat
Your heating clicks on, then off, then on again all evening. Is it broken, or is that the plan?
Why should I care?
The simplest feedback controller is a switch: full on or full off. Thermostats, fridges and ovens have used it for a century because it's cheap and robust. Understanding its wobble is the first step to designing something smoother.
- Describe how an on/off (bang-bang) controller works.
- Explain why its temperature wobbles around the target.
- Describe the trade-off set by the gap between switch-on and switch-off.
Predict
A heater switches ON when the room is below 17.9 °C and OFF above 18.1 °C. Compared with switching at 17.5 and 18.5 °C, what happens?
- The temperature is steadier but the heater clicks much more often
- The temperature is steadier and the heater clicks less
- No difference
Guess first, then reveal
Steadier, but much more clicking. In our simulated room a 0.2 °C gap switches about 37 times in two hours; a 1 °C gap about 13 times. Every switch wears the relay, so engineers choose a gap that balances comfort against wear.
Discover
With 'On/off', try a gap of 0.2 °C, then 1 °C, then 4 °C. For each, note how much the temperature swings and how many times the heater switched.
What the interactive shows (text version)
The thermostat plot can be replaced by these results from the same simulated room, target 18 °C. On/off with a 0.2 °C gap: swings about 0.5 °C, about 37 switches in 2 hours. 1 °C gap: swings about 1.2 °C, about 13 switches. 2 °C gap: swings about 2.4 °C, about 7 switches. In every case it takes about 34 minutes to warm up from 10 °C.
Watch (optional)
Watch for: Watch for the trick old thermostats use to stop the heater switching too often.
Opens up classic thermostats to show the clever mechanical tricks behind simple on/off temperature control.
“Thermostats: Cooler than you think!” by Technology Connections (opens YouTube; streaming video uses a lot of data)
The video is optional. Everything you need is in this lesson's text.
Understand
Full on or full off
A bang-bang controller has only two actions. Below the target: heater fully on. Above it: heater fully off. It's a single IF–THEN–ELSE rule inside a forever loop.
Why it wobbles
The heater can't be 'a bit on', so the temperature overshoots while it's on and drops while it's off. It never settles exactly on the target; it oscillates in a band around it.
The gap (hysteresis)
Switching at exactly one temperature makes the heater chatter on and off. So thermostats use two thresholds, a switch-on and a higher switch-off. The space between is called hysteresis. A small gap gives steadier temperature but more switching; a big gap gives fewer switches but bigger swings.
Explain it another way
Intuitive
Steering a bike by only ever turning the handlebars fully left or fully right. You'd still go roughly straight, but you'd zig-zag the whole way.
Technical
Bang-bang control with hysteresis: u = 1 if y < r − h/2, u = 0 if y > r + h/2, otherwise keep the previous u. The output oscillates; the band width and switching rate depend on h and how fast the system heats and cools.
Applied
Fridges switch their compressor on and off with a few degrees of hysteresis. A fridge that switched every few seconds would wear out its compressor in months.
Worked example 1
A thermostat is set to 20 °C with a 2 °C gap. When does the heater switch on, and when off?
The gap is split evenly around the target: switch on below 19 °C, switch off above 21 °C. Between 19 and 21 °C it keeps doing whatever it was already doing.
Common mix-ups
A thermostat that clicks on and off a lot is broken.
✓ Switching on and off is how bang-bang control works. Only very rapid switching suggests the gap is too small.On/off control is too crude to be useful.
✓ It's cheap, robust and good enough for fridges, ovens and heating everywhere.
Practice
Practice, not a test. Answers are checked on our server; a wrong answer gets a hint and another try. Nothing is saved.
Apply it
Design an on/off controller for a fish tank heater that keeps the water between 24 and 26 °C. Write the two thresholds and the rule. What would happen if a fish tank heater switched too often?
Reflect
Where else do you see a system that zig-zags around what it wants instead of holding steady?
Write your answer on paper or in your own notes. Lite never stores what you write.