Lite / Textbooks / Introduction to Intelligent Systems / Chapter 1
1. Sense, think, act
Introduction
A thermostat reacts; a robot vacuum decides. The difference is not cleverness for its own sake but a loop that senses the world, chooses an action from rules or models, acts, and then senses again because the world has changed. This chapter separates automatic from intelligent behaviour, turns sensor readings into decisions with complete rule tables, and shows why real machines run several loops at different rates, fast inside slow.
Figure 1.1. Loops inside loops (described in words)
A sense, think, act loop drawn as three boxes with an arrow back from Act to Sense. The outer loop runs at 50 Hz, a period of 20 ms. A motor loop inside it runs at 1000 Hz, every 1 ms, so it takes 20 inner steps for each outer decision.
Explanation
Built from 4 School lessons. Each part is the lesson's own explanation.
1.1 Automatic or intelligent?
A music box plays the same tune perfectly every time. A robot vacuum never cleans your room the same way twice. Which one is smarter?
Automatic machines repeat
A music box, a toaster with a timer, or a wind-up toy does the same steps in the same order, whatever is happening around it. That is automatic. It can be precise and useful, but if the world changes, it carries on regardless.
Intelligent machines respond
An intelligent machine senses something about the world, decides what to do using rules, and acts. A robot vacuum feels a bump and turns. A night light measures darkness and switches on. Change the world and its behaviour changes too.
Smart is a spectrum
Engineers rarely mean 'thinks like a person'. They mean 'does the right thing in more situations'. A light that turns on at 7 pm is automatic. One that turns on when it gets dark is a little intelligent. One that also learns when you usually come home is more intelligent still.
Common mix-ups
Intelligent machines think like people.
✓ In engineering, an intelligent machine senses, follows rules and acts sensibly in changing situations. It doesn't need feelings or understanding.A better sensor makes a machine smarter.
✓ Sensors only measure. The intelligence is in the rules that turn measurements into actions.
Open the Lite lesson: Automatic or intelligent?
1.2 Sense, think, act
A robot vacuum bumps a chair leg, backs off and turns. In that half second it did three different jobs. What were they?
Sense
Measure something about the world: a distance, a temperature, a colour, whether a button is pressed. A machine can only react to what it can measure.
Think
Compare the measurement with what you want and choose an action. At this level the thinking is usually a rule: if the wall is closer than 20 cm, stop. Rules can be simple and still produce clever-looking behaviour.
Act
Change something in the world: spin a motor, open a valve, sound a buzzer, light an LED. The parts that do this are called actuators.
Then do it again
Acting changes the world, so the next measurement is different. The loop goes round and round, often hundreds of times a second. That repetition is what lets a robot notice surprises and correct itself.
Common mix-ups
A robot senses once, makes a plan and follows it.
✓ Reliable robots sense again and again while they act, so they can react to changes.Only motors count as actuators.
✓ Anything that changes the world on the machine's command counts: valves, heaters, lights, speakers.
Open the Lite lesson: Sense, think, act
1.3 From readings to decisions
A sorting machine sees thousands of parts an hour and never gets bored. How does it decide where each one goes?
Thresholds
A threshold is a line you draw across a sensor's range: above it means yes, below it means no. Is it red? Reading > 65. Is it dark? Light < 30. Too hot? Temperature > 24 °C. One number becomes one clear answer a controller can act on.
Rule tables
With several yes/no answers, list every combination in a rule table. Three sensors (red? large? metal?) give 2 × 2 × 2 = 8 rows. For each row you choose an action: which bin. Writing every row stops you forgetting a case, a common cause of machines doing something silly.
Noise near the line
A reading close to the threshold can flip between yes and no just from noise. A thermostat might click on and off every few seconds. Fixes: average readings first, or use two thresholds: heater on below 19.5 °C, off above 20.5 °C. The gap between them is called hysteresis, and it stops the flicker.
Common mix-ups
Once you pick a threshold, decisions are always right.
✓ Noise near the threshold can still cause wrong calls. Averaging and hysteresis reduce them.You only need rules for the common cases.
✓ Machines meet rare cases too. A complete rule table gives every case a planned action.
Open the Lite lesson: From readings to decisions
1.4 Fast loops inside slow ones
A balancing robot corrects its motors a thousand times a second but decides where to go only once a second. Why not do everything at 1 kHz?
Rates follow the physics
Each loop should run several times faster than the quantity it controls can change. Motor current changes in microseconds to milliseconds, so current loops run at 10–20 kHz. Wheel speed changes in milliseconds (1 kHz). A robot's position on a map changes over tenths of a second (10–100 Hz). Goals change over seconds (1 Hz or less).
Cascaded loops
Layers are usually cascaded: the planner sends a path, a position loop turns it into speed targets, and a speed loop turns those into motor commands. Each inner loop treats its setpoint as constant between outer updates, which only works if the inner loop is much faster.
The cost of running fast
Running everything at the highest rate wastes processor time and energy, and heavy jobs such as vision may simply not finish in 1 ms. Splitting rates lets each job get the time it needs, often on different processors: a microcontroller for fast loops, a larger computer for perception and planning.
Common mix-ups
Faster is always better, so run every loop as fast as possible.
✓ Each loop needs a rate matched to its dynamics. Over-fast loops waste computing; heavy jobs may not even finish in time.The update rate is a software detail you can choose later.
✓ Rates decide processors, buses and stability, so they belong on the block diagram from the start.
Open the Lite lesson: Fast loops inside slow ones
Worked examples
Automatic or intelligent?: example 1
Is a microwave that runs for exactly 2 minutes automatic or intelligent? What would make it intelligent?
Solution
Automatic: it runs for 2 minutes whether the food is frozen or already hot. Adding a steam or temperature sensor and a rule like 'stop when the food reaches 70 °C' would make it respond to the food, which is intelligent.
Sense, think, act: example 1
Split a smart greenhouse fan into sense, think and act.
Solution
Sense: a thermometer reads 31 °C. Think: the rule says 'if hotter than 28 °C, run the fan'; 31 > 28, so run it. Act: the fan motor turns on. Then the loop repeats: when the reading falls below 28 °C, the rule switches the fan off.
From readings to decisions: example 1
A plant-watering rule: water if soil moisture < 30%. Readings over a minute: 31, 29, 32, 28, 30%. What goes wrong, and how would you fix it?
Solution
The readings hover around 30%, so a single-reading rule would switch the pump on and off repeatedly. Fix: average (here: 150 ÷ 5 = 30% → no watering yet), or use two thresholds: start below 28%, stop above 35%.
Fast loops inside slow ones: example 1
A planner runs at 5 Hz and a position loop at 200 Hz. How many position updates per plan, and what is the position loop's period?
Solution
200 ÷ 5 = 40 position updates per plan. Period = 1/200 s = 5 ms.
Interactive figures, in words
Figure 1.2 from Sense, think, act
This robot's 'think' step is one rule. Slide the sensor reading towards the wall and watch the decision change. Each time you move the slider, you are doing one more turn of the loop.
The rule tester can be replaced by this description: the rule is 'IF distance < 20 cm THEN stop ELSE drive forward'. At 35 cm the condition is false so the robot drives; at 15 cm it is true so it stops; at exactly 20 cm, 20 < 20 is false, so it still drives.
Laboratory
These run in a browser on the full site (they need a faster connection). Simulations are simplified educational models.
- Simulation OS: Greenhouse through a cold night (Simulation OS experiment)
Run the greenhouse heater with a simple threshold rule, then add hysteresis, and count how often the heater switches in each case.
Open on the full site - Nexus: Intelligent greenhouse (Nexus project)
Wire a sensor, a rule and an actuator into a loop and describe what the system senses, decides and does.
Open on the full site
Practice
Each question links to its Lite lesson, where your answer is checked on our server and a wrong answer gets a hint. Answers are never sent to your device.
- Which of these machines is intelligent rather than just automatic?
Answer it in “Automatic or intelligent?” - Put these lights in order from least to most intelligent: (A) on at 7 pm daily, (B) on when it gets dark, (C) on when it's dark AND someone is in the room.
Answer it in “Automatic or intelligent?” - Why must the sense–think–act loop keep repeating?
Answer it in “Sense, think, act” - A robot runs its sense–think–act loop 50 times every second. How many times does it run the loop in 3 seconds?
Answer it in “Sense, think, act” - A machine uses four yes/no sensors. How many rows does a complete rule table need?
Answer it in “From readings to decisions” - A heater keeps clicking on and off every few seconds when the room is near 20 °C. Which fix works best?
Answer it in “From readings to decisions” - Which job should run at the highest rate?
Answer it in “Fast loops inside slow ones” - Why must an inner speed loop be much faster than the position loop around it?
Answer it in “Fast loops inside slow ones”
Engineering applications
Robot vacuums
A robot vacuum's fast loop keeps its wheels at the commanded speed, a middle loop avoids bumps and cliffs, and a slow loop plans which room to clean next. Each loop trusts the one inside it.
Smart irrigation
A watering controller with a soil sensor, a rain forecast and a rule table is a small intelligent system: it senses, weighs evidence and decides, rather than running on a fixed timer.
Watch (optional)
Streaming video uses a lot of data. Everything you need is in the text.
- “What Is Artificial Intelligence? Crash Course AI #1” by CrashCourse
- “Robots: Crash Course Computer Science #37” by CrashCourse
- “Robotics: Crash Course AI #11” by CrashCourse
Summary
- Automatic machines follow a fixed sequence; intelligent ones choose actions from what they sense.
- The sense–think–act loop must repeat because acting changes the world.
- A rule table with every input combination written out leaves no case undecided; hysteresis stops chattering.
- Fast inner loops handle physics; slower outer loops handle plans, and each must be several times faster than the one around it.
Glossary
- Sense–think–act loop
- Most robots run a repeating cycle: read sensors, decide what to do, command actuators, then repeat, usually at a fixed rate. Field Guide
- 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. Field Guide
- 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. Field Guide
- Open-loop control
- Open-loop control sends commands without measuring the result: 'run the motor at 60 % for 2 seconds' and hope it went far enough. Field Guide
Project: Specify a small intelligent machine
Choose a household machine you would like to make smarter. List its sensors, write a complete rule table for its main decision, and draw its loops with their rates. Explain which behaviour makes it intelligent rather than automatic.
Deliverables
- A sensor and actuator list
- A complete rule table
- A loop diagram with rates and periods
Write it up on paper or in your own notes. Lite never stores what you write.
References
- Stuart Russell and Peter Norvig (2020). Artificial Intelligence: A Modern Approach, 4th edition. Pearson.