HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClasses

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Computer Science
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Prepare for an Exam
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Glossary
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpFor SchoolsAboutContactPrivacy PolicyTerms of UseRefund Policy
Automated Systems: Sensors, Microprocessors and Actuators
  1. 1Sensors, microprocessors and actuators
  2. 2Control loops and feedback
  3. 3Automated systems in use: advantages and disadvantages
  1. Computer Science
  2. /Automated Systems: Sensors, Microprocessors and Actuators
  3. /Control loops and feedback

Course 6.1·Lesson 2 of 3

Control loops and feedback

An automated system never checks only once. It reads, compares and acts in a loop, and what the actuator does changes the next reading. This is feedback. This lesson follows a control loop step by step, draws it as a flowchart and writes it in pseudocode and in Python.

about 25 min1 simulation1 practice question
Lesson 2 of 3Show all lessonsHide
Automated Systems: Sensors, Microprocessors and Actuators
  1. 1Sensors, microprocessors and actuators
  2. 2Control loops and feedback
  3. 3Automated systems in use: advantages and disadvantages

Try the code and the simulations beside the lesson.

A loop that never ends

You set a room heater to keep the room warm. The room is cold, so the heater comes on. The room warms up. After a while it is warm enough, so the heater goes off. The room slowly cools, and the heater comes on again.

The heater does not check the room once. It checks again and again for as long as it is switched on. This repeated sequence is a control loop:

  1. read the sensor;
  2. compare the reading with the stored values;
  3. decide, and send a signal to the actuator if a change is needed;
  4. go back to step 1.

Feedback

Look at what happens after the heater comes on. The heater warms the room, so the next reading from the temperature sensor is higher. The output of the system has changed its own input. This is feedback.

Feedback lets the system correct itself. If the room becomes too warm, the next reading shows it, and the microprocessor switches the heater off. If the room cools, the next reading shows that too. So the temperature stays close to the stored values without anyone touching the heater.

A system with feedback is a control system. A system that only measures and records, such as a weather station, has no actuator to change what it measures, so it has no feedback of this kind.

Two stored values

Suppose the heater went off at 21 ∘C21\ ^\circ\text{C}21 ∘C and on again just below it. It would switch on and off every few seconds. Many systems therefore use two stored values: the heater comes on below a low value, such as 20 ∘C20\ ^\circ\text{C}20 ∘C, and goes off above a high value, such as 23 ∘C23\ ^\circ\text{C}23 ∘C. Between the two, nothing changes.

The loop as a flowchart

A flowchart of a heater control loop drawn with the standard symbols. A terminator says Start. A parallelogram says INPUT Temperature. A diamond asks: Temperature less than 20? Yes leads to a rectangle, Heater on. No leads to a second diamond: Temperature greater than 23? Yes leads to a rectangle, Heater off. The No line and both rectangles lead by flow lines back to the input.

The flowchart uses the standard symbols of the syllabus. The rounded box (the terminator) is the start. The parallelogram (input/output) is the reading of the sensor. Each diamond (decision) asks one question with a Yes and a No line. The rectangles (process) switch the heater. The flow lines carry control back to the reading, so the loop repeats.

The loop in pseudocode and in Python

The box marked pseudocode is Cambridge pseudocode, the form used in the examination. It is shown, not run. The Python box below it does the same job, and you can run it.

pseudocode
CONSTANT Low ← 20
CONSTANT High ← 23
WHILE TRUE DO
    INPUT Temperature
    IF Temperature < Low
      THEN
        OUTPUT "Heater on"
    ENDIF
    IF Temperature > High
      THEN
        OUTPUT "Heater off"
    ENDIF
ENDWHILE

If the reading is between the two values, neither IF is true, so the heater stays as it was.

Practise with new numbers

Try it in Python

The program runs the loop for 30 minutes. In each minute the heater warms the room by 0.8 ∘C0.8\ ^\circ\text{C}0.8 ∘C or the room cools by 0.5 ∘C0.5\ ^\circ\text{C}0.5 ∘C. That change is the feedback: it decides the next reading.

Read it first. Then run it. Watch the temperature rise and fall between the two stored values.

1. Change high = 23 to high = 21. Does the heater switch on more often or less often? Run it to check.

2. Change the warming from 0.8 to 0.4. Can the heater still keep up with the cooling?

Common mistakes

  • One check only. A control system repeats the loop for as long as it runs.
  • Feedback means a message to the user. Here it means that the output changes the next input.
  • Comparing with the wrong value. The heater comes on below the low value and goes off above the high value.
  • A flowchart with no way back. Draw the flow line back to the input, or the loop never repeats.

Remember these

  • A control loop reads, compares, acts and repeats.
  • Feedback: what the actuator does changes the next sensor reading, so the system corrects itself.
  • Two stored values stop an actuator from switching on and off too often.
  • In a flowchart, the terminator starts, the parallelogram is input or output, the diamond is a decision and the rectangle is a process.

Check yourself

Try each one on your own first. If you are stuck, open a hint. Then check with Show the answer.

  1. Explain, in your own words, what feedback means in a heating system.
  1. A heater comes on below 18 ∘C18\ ^\circ\text{C}18 ∘C and goes off above 21 ∘C21\ ^\circ\text{C}21 ∘C. The heater is off and the reading is 19.5 ∘C19.5\ ^\circ\text{C}19.5 ∘C. What happens?
  1. Which flowchart symbol shows the reading of the sensor?
  1. A room at 25 ∘C25\ ^\circ\text{C}25 ∘C cools by 0.25 ∘C0.25\ ^\circ\text{C}0.25 ∘C each minute. The heater comes on at 19 ∘C19\ ^\circ\text{C}19 ∘C. When does it come on?
  1. Why does a weather station that only records readings have no feedback?

Enroll free in Automated Systems: Sensors, Microprocessors and Actuators

Every lesson is open to read. Enrolling also lets you:

  • Mark lessons done and carry on where you stopped.
  • Take the tests of this lesson and its course.
  • Count the course towards the certificate for its chapter.
No payment. You can leave at any time.

Problems (3)

A heater uses two stored values. It switches on when the reading is below 18 °C and it is off, and…Medium · High School (9–10) · by StemPy Lab
An office is at 26 °C when the air conditioning leaves it…Easy · High School (9–10) · by StemPy Lab
A freezer must sound an alarm whenever its temperature rises above -15 °C…Hard · High School (9–10) · by StemPy Lab
Next: lesson 3Automated systems in use: advantages and disadvantages
← Automated Systems: Sensors, Microprocessors and Actuators
← Sensors, microprocessors and actuatorsAutomated systems in use: advantages and disadvantages →

Discussion (0)

Log in to join the discussion.

Loading…

1 Python program
5 questions to check yourself

This lesson is free to read. Enroll free to keep your place and take the tests.

Python Labs (1)

Two stored values and a heaterPython Lab · by StemPy Lab