Skip to content
Tactiverge

Textbooks/Feedback and Control/Chapter 2Lite (plain text) version

2On/off control and hysteresis

Version 1 · Technically checked (automated checks only) · 2 source lessons · 7 practice items

Text
All chapters and search
  1. 1. Open and closed loop
  2. 2. On/off control and hysteresis
  3. 3. Proportional control
  4. 4. Systems with memory: first-order response
  5. 5. Second-order response and damping
  6. 6. Stability and poles
  7. 7. PID control
  8. 8. Tuning, saturation and fair evidence

Introduction

The simplest controller has two moves: full on or full off. A thermostat switches the heater on when the room is cold and off when it is warm. With one threshold, noise near the setpoint makes the relay chatter; with two thresholds, a hysteresis band, the controller keeps its last decision inside the band. A wider band means fewer switches and bigger swings; choosing it is a trade-off, not a fix.

Two thresholds stop the chatteronoff1921temperature (°C)band 2 °C: keep the last state
Figure 2.1. Two thresholds stop the chatter. A hysteresis loop for a heater: on below 19 °C and off above 21 °C. Between them lies a band 2 °C wide, shaded, in which the heater keeps whatever state it was last in.

Explanation

This chapter is built from 2 School lessons. Each part below is the lesson's own explanation; open the lesson for its predict-and-discover activities.

2.1 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?

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.

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.

Open the full lesson: On/off control: the bang-bang thermostat →

2.2 On/off control and hysteresis

A heater with a single switch-point clicks on and off dozens of times a minute when the temperature hovers near it. How do real thermostats stop that?

Bang-bang control

On/off control has two outputs: full power or none. If too cold, heater on; if warm enough, heater off. The temperature therefore rises and falls around the setpoint in a sawtooth. It is cheap and robust, and the swing is often acceptable for rooms, fridges and greenhouses.

Two thresholds, not one

Hysteresis uses separate thresholds: switch on below the lower one and off above the upper one; between them, keep doing whatever you were doing. In code:

if temp < ON_BELOW:
    heater = True
elif temp > OFF_ABOVE:
    heater = False
# otherwise: no change

Notice it is a two-state machine: the heater's current state decides what happens in the band.

Choosing the band

A wider band means fewer switchings (less wear on relays and compressors) but a bigger temperature swing. A narrower band holds the temperature tighter but chatters with noise. A good rule: make the band clearly wider than the sensor noise, and place it so the swing stays inside the comfort range, remembering the temperature overshoots a little after each switch.

Common mix-ups

  • Hysteresis makes the controller less accurate, so avoid it.
    ✓ It deliberately allows a small swing to stop chattering. Without it, noise wears out relays and can cause rapid cycling.
  • The temperature stays inside the band.
    ✓ Thermal lag makes it overshoot both thresholds a little. Leave room for that.

Open the full lesson: On/off control and hysteresis →

Worked examples

On/off control: the bang-bang thermostat: example 1

A thermostat is set to 20 °C with a 2 °C gap. When does the heater switch on, and when off?

Solution

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.

On/off control and hysteresis: example 1

Seedlings must stay between 16 and 24 °C. The thermometer jitters by about ±0.3 °C, and the air overshoots by about 0.5 °C after each switch. Suggest thresholds.

Solution

Keep the lowest dip (on-threshold minus overshoot minus noise) above 16 °C: on below about 16.8 °C. Off above about 18.5 °C gives a 1.7 °C band, much wider than the 0.6 °C noise, and stays far below 24 °C. Then test in the simulator, because the overshoot estimate is a guess.

Interactive figures

Figure 2.2 from On/off control: the bang-bang thermostatWith '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.
Can't use the interactive? Read a description instead

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.

Interactive figure (online). Description: 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.

Laboratory

Everything runs in your browser. No kit, nothing mains-powered. Simulations are simplified educational models.

Guided practice

Answers are checked on the server; wrong answers get a hint and another try. Signed in, solved items also count towards the source lesson.

Practice 1

Why does a bang-bang thermostat never hold the temperature exactly on target?

Practice 2

An engineer shrinks the gap from 2 °C to 0.2 °C. What happens?

Practice 3

Gap set: on below 17 °C, off above 19 °C. The heater is ON and the room reaches 18 °C. What does it do?

Practice 4

A thermostat uses a setpoint of 20 °C and a total hysteresis band of 3 °C, centred on the setpoint. Below what temperature does the heater switch on, in °C?

°C

Practice 5

With 'on below 17, off above 19', the heater is ON and the temperature is 18.2 °C. What does the controller do?

Practice 6

What do you trade when you widen the hysteresis band?

Practice 7

Your thermometer jitters by ±0.4 °C. Which band is most likely to chatter?

  1. Why does a bang-bang thermostat never hold the temperature exactly on target?
    • The thermometer is broken
    • The heater can only be fully on or fully off, so it overshoots and undershoots
    • The target is set wrong
  2. An engineer shrinks the gap from 2 °C to 0.2 °C. What happens?
    • Smaller swings, more switching
    • Bigger swings, less switching
    • Smaller swings, less switching
  3. Gap set: on below 17 °C, off above 19 °C. The heater is ON and the room reaches 18 °C. What does it do?
    • Switches off
    • Stays on
    • Switches on
  4. A thermostat uses a setpoint of 20 °C and a total hysteresis band of 3 °C, centred on the setpoint. Below what temperature does the heater switch on, in °C? (°C)
  5. With 'on below 17, off above 19', the heater is ON and the temperature is 18.2 °C. What does the controller do?
    • Switch off
    • Keep the heater on
    • Switch on
  6. What do you trade when you widen the hysteresis band?
    • Fewer switchings for a bigger temperature swing
    • More switchings for a steadier temperature
    • Nothing changes
  7. Your thermometer jitters by ±0.4 °C. Which band is most likely to chatter?
    • 0.2 °C
    • 1.5 °C
    • 2.5 °C

Engineering applications

  • Fridges and boilers

    Fridges, kettles and many boilers are on/off controllers with hysteresis. The band is chosen so the compressor or burner is not switched too often, which would wear it out and waste energy.

  • Schmitt triggers

    Digital inputs often include hysteresis in hardware, a Schmitt trigger, so a slowly changing or noisy voltage produces one clean transition instead of a burst of false edges.

Watch

Optional verified videos. Nothing loads from YouTube until you press play.

Opens up classic thermostats to show the clever mechanical tricks behind simple on/off temperature control.

17 min 3 s · captions on YouTube · source

Nothing loads from YouTube until you press play.

Real factory examples of why feedback loops matter and what happens when they fail.

11 min 1 s · captions on YouTube · source

Nothing loads from YouTube until you press play.

  • Thermostats: Cooler than you think! (Technology Connections)
  • Cheese, Catastrophes, & Process Control: Crash Course Engineering #25 (CrashCourse)

Chapter summary

  • On/off control applies full effort or none, so the output always oscillates around the setpoint.
  • A single threshold chatters when noise crosses it repeatedly.
  • Hysteresis uses separate on and off thresholds; inside the band the last state is kept.
  • A wider band means fewer switches but larger swings.

Glossary

On–off control with hysteresis
On–off control switches the actuator fully on or off; hysteresis uses two thresholds, one to switch on and a different one to switch off, so the output does not chatter around a single value.
Setpoint and error
The setpoint (or reference) is the value you want; the error is the setpoint minus the measured value. Controllers act on the error.
Closed-loop (feedback) control
Closed-loop control measures the output, compares it with the target and adjusts the command to shrink the difference, over and over.

Definitions from the Field Guide.

Project: Design a thermostat band

A heater warms a small room by 1 °C per minute and the room cools by 0.5 °C per minute when it is off. For bands of 0.5, 1 and 2 °C around 20 °C, estimate the switching period and the temperature swing, and recommend a band for comfort and for relay life.

Deliverables

  • Switching period and swing for each band
  • A sketch of temperature against time for one band
  • A recommendation with its trade-off

Keep your work in your Engineering Journal; it stays private unless you choose to share it.

References

  • Karl Johan Åström and Richard M. Murray (2008). Feedback Systems: An Introduction for Scientists and Engineers. Princeton University Press.
  • Gene F. Franklin et al. (2015). Feedback Control of Dynamic Systems, 7th edition. Pearson.

Publication record

Version
1
Status
Technically checked (automated checks only)
Technical review
Automated checks only, last run 2026-11-29. No human, educator or mentor review is claimed.src/content/textbooks/textbooks.test.ts: schema, every lesson, diagram, practice item, video, Field Guide entry, lab and reference resolves; figure numbers recomputed; no practice answers in client payloads.
Written by
Compiled and written by the Tactiverge team with AI assistance, from Tactiverge School lessons that were themselves written with AI assistance.
Licence
All rights reserved by the founders unless a licence is approved.
Corrections
None recorded yet.Spotted a mistake? Use “Report a problem” on any chapter, or see the corrections page.