TactivergeLite

Lite / Discovering How the World Works / Week 8

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?

About 25 min · 3 goals · Reviewed by the founders' mentors · Full interactive version

Why should I care?

Sensors give numbers; machines need decisions. The bridge between them is often a threshold and a rule table, the same logic behind sorting machines, thermostats and automatic lights.

Predict

A red-detector says 'red' if its reading is above 65. A part reads 58. What does the machine decide?

  1. Red
  2. Not red
  3. It can't decide
Guess first, then reveal

Not red: 58 is below the threshold of 65. Thresholds turn a number into a clear yes or no. The tricky part is choosing the threshold: too low and orange parts count as red; too high and real red parts are missed.

Discover

Do Level 2 of the sorting-machine Build: turn the client's brief into a rule table with a row for every combination of red, large and metal. Watch the belt follow your table. Did any row surprise you?

What the interactive shows (text version)

The sorting-machine rule table has eight rows, one for every combination of red or not, large or not, and metal or not. For each row you choose the bin. A part whose reading sits close to a threshold can be misjudged if the sensor is noisy, which is why thresholds are chosen with care.

You can also open the interactive on the full site when you have a faster connection.

Understand

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.

Explain it another way

Intuitive

A height line at a theme park ride is a threshold: taller than the line, you ride; shorter, you don't. A rule table is like a recipe card for every possible situation.

Technical

Thresholding classifies a continuous reading into categories. Combining binary features gives 2ⁿ cases for n features. Hysteresis (separate on and off thresholds) prevents rapid switching, called chattering, when a noisy signal hovers near one threshold.

Applied

Street lights switch on when a light sensor reads below a threshold and off at a higher threshold, so passing car headlights or a cloud don't make them flicker.

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

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%.

Common mix-ups

Practice

Practice, not a test. Answers are checked on our server; a wrong answer gets a hint and another try. Nothing is saved.

Practice 1. A night light turns on if the light reading is below 40. The reading is 52. What happens?

Practice 3. A heater keeps clicking on and off every few seconds when the room is near 20 °C. Which fix works best?
Practice 4. Why write out every row of a rule table, even unlikely ones?

Apply it

Design the rules for an automatic plant-watering helper with two sensors: soil moisture and light level (don't water in full midday sun). Choose thresholds, write the full rule table (4 rows), and add hysteresis to the moisture rule. Test your rules on five made-up sets of readings.

Reflect

Where in daily life do you make threshold decisions without noticing (for example, deciding to take a coat)?

Write your answer on paper or in your own notes. Lite never stores what you write.

← Every sensor jittersYour design challenge: a helpful machine →