Skip to content
Tactiverge

BUILD 003: Create an Intelligent Sorting Machine

Facilitator guide · 60 minutes · free to reuse with attribution

The objective

Design the decision logic for a virtual sorting machine: turn sensor readings into yes/no signals, write the rules as truth tables and logic gates, and make the machine tolerate one faulty sensor.

Safety. Browser simulation and paper design only. Never put hands near a real conveyor, diverter or factory machine, and never open sensor housings or mains-powered equipment. Any physical extension needs an adult's safety review and supervision before anyone starts.

Before the session

  • Open /build/sorting-machine/?level=3 and press Run belt at the default settings so you have seen everything pile into Mixed.
  • Fill in the Level 2 rule table yourself (it is remembered in your browser), then try 0.4 m/s and 1 m/s on Level 3 so you have seen accuracy fall as the belt speeds up.
  • Decide teams of three in advance. Learners who join alone can pair with the facilitator.
  • Check the live room link works, chat is off and the moderated question box is on.

Run of show

  1. 5 minHook. Run the belt with no rules: everything lands in Mixed. Ask: the sensors work, so what is the machine missing?
  2. 8 minInside the machine. Walk through the five intro beats on the conveyor. Level 1 learners do the machine map and the six parts now.
  3. 10 minThe ideas. Thresholds, truth tables and averaging. Build the 8-row rule table together on screen from the brief.
  4. 12 minGroup challenge. Teams tune the sensors to 96% at 120 parts per minute. Ask each team to read you one part's readings, bits and bin.
  5. 12 minDesign task. Individually, fastest belt that still passes. Learners on other levels work on their own level task (Level 4: the lying sensor).
  6. 8 minQuestions. Answer moderated questions, then set the 'unsure' bin extension.
  7. 5 minReflect & save. Everyone submits their machine and writes one sentence: which mistake would cost most in a real recycling plant?
Team challenge
Teams of three get the same conveyor, the same brief and the same noisy sensors. Each team finds settings that sort at least 96% of parts at 120 parts per minute, then explains the one decision that made the biggest difference. No leaderboard: every team that gets there explains how.
Individual design task
On your own: push the belt as fast as you can while staying above 96% on the unseen batches. Write down what you traded away, and which wrong bin worries you most.
Questions
Moderated questions in the live room. Questions are answered on screen without names, and chat stays off.
Extension
Add a fifth bin: 'unsure', for parts whose colour reading sits very close to the threshold, so a person checks them. Which parts would land there, and what does it cost the client in staff time?

Running it live

Opening demo (first 3 minutes)

Share /build/sorting-machine/?level=3 at the default settings and press Run belt. Say: “This is a recycling sorter: 100 parts ride past three colour sensors, a light gate and a metal detector, and a flap drops each one into a bin. Watch the lamps light up as each part goes past.” Everything lands in Mixed. Say: “The sensors are working perfectly well. The machine just doesn't know what to do with what it measures. In the next hour you're going to give it rules, tune its senses, and make it keep sorting correctly even when one of its sensors lies.”

Guided discovery

  1. Ask: Pick one part in the list under the belt. What does the machine actually know about it?
    Reveal: Five numbers: three colour readings, a length and a metal yes/no. Not 'it's a red cap'. Engineering starts by turning numbers into decisions.
  2. Ask: If each reading becomes a yes or no (red? large? metal?), how many different situations can the machine be in?
    Reveal: 2 × 2 × 2 = 8. A truth table with 8 rows covers every one, including the strange ones like 'red, large and metal'.
  3. Ask: With the rules in, orange caps keep landing in Red. Look at the colour histogram. Why?
    Reveal: Red and orange readings overlap: each part varies a little and every reading is noisy. Wherever you put the threshold, some parts near it land on the wrong side. Move it into the gap between the two humps.
  4. Ask: Slow the belt down and watch the histogram humps get narrower. Why does speed matter to a colour sensor?
    Reveal: It averages every sample it takes while the part is under it. Slower belt, more samples, less noise: σ / √n. But the client also needs parts per minute.
  5. Ask: Now sunlight dazzles one sensor. How could three sensors outvote a liar?
    Reveal: Believe 'red' only if at least two say so: (C1·C2) + (C2·C3) + (C1·C3). One sensor alone can no longer change the decision.

Everyone experiments

  1. Everyone opens /build/sorting-machine/?level=2 and fills in the rule table from the brief (the browser remembers it for the next levels).
  2. Switch to Level 3. Change ONE thing: the size limit from 100 to 65 mm. Run the belt. Where do the crates go now?
  3. Move the red threshold from 50 up into the gap you can see on the colour histogram. Watch the 'Wrong in Red' counter.
  4. Try belt speeds of 0.4 and 1.0 m/s. Note accuracy and parts per minute for each.
  5. Press 'Submit this machine': the server tests your settings on your batch and on two unseen batches.
  6. Explorers and Builders do Levels 1–2 instead (sense and sort, write the rules) and join a team for the challenge.

Design challenge

Teams of three: find the FASTEST belt that still sorts at least 96% of parts correctly on the unseen batches. Each team reports one number (parts per minute) and the one setting that mattered most. No leaderboard: we put every passing machine on screen and ask which wrong bin each team chose to risk.

Everyone leaves with

Each learner leaves with a rule table and machine settings that pass on unseen batches, saved in their Workshop (or written on the worksheet), and a one-sentence explanation in their own words of why a faster belt makes more mistakes.

Explain it yourself

Thresholds
A threshold turns a number into a yes or no: 'red' if the colour reading is at or above it. It's a design decision, not a fact about the part, and parts close to it are where mistakes happen.If asked “Why not use the exact colour instead of yes/no?”: You can, and real sorters often use many numbers at once. But in the end the flap can only go one way, so somewhere a number must become a decision.
Truth tables and rule order
Three yes/no signals give 8 combinations. The brief is checked in order: metal first, then size, then colour. A red tin can is red AND large AND metal: the first rule that applies (metal) wins.If asked “Why does the order matter?”: Because some parts match several rules. Without an order, the table would be ambiguous for those rows.
Noise and averaging
Each colour sample wobbles by about ±30 in this model. The sensor averages every sample it takes while the part is in view, and averaging n samples shrinks the wobble to σ / √n. At 0.4 m/s it takes 25 samples (±6); at 1 m/s only 10 (about ±9.5).If asked “Are those real sensor numbers?”: They're illustrative, chosen to make the trade-off visible. The square-root rule itself is real statistics for independent noise.
False positives and false negatives
A false positive puts a part in a bin it doesn't belong in (an orange cap in Red); a false negative misses one that does (a red cap in Mixed). Moving the threshold trades one for the other. Which is worse depends on the client.If asked “Which is worse for a recycler?”: Usually contamination: a wrong part in a 'pure' bin can spoil the whole batch, while a missed part just goes in the general pile.
Majority voting
Three sensors, believe what at least two say. If each is wrong 10% of the time independently, the vote is wrong only when two or three are: 3 × 0.1² × 0.9 + 0.1³ = 2.8%.If asked “So why not use five sensors?”: You can, and the vote gets even more reliable, but it costs money, space and wiring, and it only helps if the sensors fail independently.If asked “When does voting fail?”: When something makes several sensors wrong at the same time: one bright window dazzling all three, or a batch of faulty sensors from the same factory.
Testing on unseen batches
If you tune settings until one batch scores perfectly, you may have tuned to that batch's luck. The server tests two batches you've never seen: a machine has to work on parts it has never met.If asked “Is this what AI people mean by overfitting?”: Yes, the same idea: a model that memorises its examples instead of learning the pattern does badly on new data. Held-out tests catch it.

Lead

  • Runs the opening demo and the discovery questions
  • Shares the simulator and builds the rule table live from the brief
  • Calls time on each section

Co-host

  • Moderates the question box and reads questions aloud without names
  • Watches the room and the safeguarding channel
  • Posts links in the session page, not in chat
  • Collects each team's parts-per-minute figure for the on-screen comparison

Checklist

  • ☐ Session published with event type 'build' and series 'sorting-machine'; host and adult supervisor confirmed
  • ☐ Live room: unlisted stream, made for kids, chat off; question box tested
  • ☐ /build/sorting-machine/?level=3 open at the default settings, with the rule table cleared in that browser; screen-share tested at 1280×720
  • ☐ Worksheet PDF ready for learners without a second screen
  • ☐ Both founders (Karim Mohamed and Mohamed Meneesi) have read the explainers and can answer the 'if asked' questions; either can lead

Follow-ups

  • Level 4: build a voting circuit that survives a lying sensor, and work out how often a majority of three is wrong.
  • Level 5: run a controlled investigation (four runs, one variable) and send it for review.
  • Mission: The Three-Sensor Interlock uses the same voting idea to keep a robot cell safe.
  • Next: BUILD 008, Create a Virtual Computer, where the same gates add numbers instead of sorting parts.

Five levels, one project

LevelTaskEvidence
ExplorerWatch the conveyor run before anyone has told it the rules, then match each part of the machine to its job and sort six example parts by hand, using the client's brief and the thresholds.
Makes: A correct machine map and six correct bins, checked on the server.
Answer key: Colour sensor: how red. Light gate: how long. Metal detector: metal nearby. Diverter flap: steers the part. Parts: 1 Red plastic, 2 Mixed, 3 Metal, 4 Mixed (58 is below 65), 5 Reject, 6 Metal.
Checked by the facilitator against the answer key
BuilderTurn the client's four-line brief into an 8-row rule table: for every combination of red (R), large (L) and metal (M), choose the bin. Watch the slow belt run your table.
Makes: A complete 8-row rule table that matches the brief, checked on the server.
Answer key: Any row with M = 1: Metal. M = 0, L = 1: Reject. R = 1, L = 0, M = 0: Red plastic. R = 0, L = 0, M = 0: Mixed plastic.
Checked by the facilitator against the answer key
InnovatorReal sensors are noisy, and a faster belt makes them noisier. Choose the belt speed, the red threshold and the size limit so the machine sorts at least 96% of parts correctly at 120 parts per minute or more. The server tests your settings on your batch and on two batches you haven't seen.
Makes: Machine settings that pass on all three batches, with their accuracy and throughput.
Answer key: For example 0.4 m/s, red threshold 69, size limit 65 mm: about 97% across the three batches at 120 parts per minute. At 1 m/s the colour noise pushes accuracy below 95%.
Checked by the facilitator against the answer key
Systems EngineerGlare makes colour sensor C1 read 100 on 30% of parts. Build a voting circuit from at most five AND/OR gates that no single sensor can fool, calculate how often a majority of three is wrong when each sensor is wrong 10% of the time, and explain when voting would not help.
Makes: A voting circuit that passes the glare test on every sensor, a correct probability and a 30-word explanation, checked on the server.
Answer key: R = (C1 AND C2) OR (C2 AND C3) OR (C1 AND C3): five gates. 3 × 0.1² × 0.9 + 0.1³ = 0.028 = 2.8%. Voting fails when sensors fail together, for example one light source dazzling all three.
Checked by the facilitator against the answer key
Research EngineerAsk one question (for example, how does belt speed trade throughput against accuracy, or how much does majority voting help as glare gets worse?). Change one setting across at least four recorded runs on the same test batch, hold everything else fixed, and write a short technical report.
Makes: Four or more runs recomputed on the server and a report with a hypothesis, method, results and limitations, reviewed by a person.
Reviewed by an adult

Common misconceptions

  • ✗ “A sensor gives the true answer.”
    ✓ Every reading is a little bit wrong. Parts near the threshold, like orange caps next to red ones, can land on either side, so the machine has to expect mistakes.
  • ✗ “Adding more sensors always makes it more accurate.”
    ✓ Only if you combine them well. Majority voting helps when faults are independent; three sensors dazzled by the same light vote the same wrong answer.
  • ✗ “If it scores 100% on my test batch, it works.”
    ✓ Settings tuned to one batch can be lucky. That's why the server also tests two batches you haven't seen: the machine must work on parts it has never met.
  • ✗ “A slower belt is always better.”
    ✓ Slower gives cleaner readings but fewer parts per minute. The client needs both, so the engineering is in the trade-off.

Accessibility

Every part on the belt is also listed in text with its readings, bits and bin, and colours are always named in words, never shown by colour alone. Rule tables and truth tables are real tables that screen readers can read. The simulator works by keyboard, respects reduced motion (the batch jumps to its result) and runs on a low-cost phone.

BUILD 003 worksheet: decisions on a conveyor

Name: ______________________ Level: ____________

  1. A colour sensor reads 0–100 and the threshold is 60. Which of these become a 1: 59, 60, 72, 41?
  2. How many rows does a truth table need for three yes/no sensors? For five?
  3. Write the full 8-row rule table for the brief, with R (red), L (large) and M (metal) as inputs and the bin as the output.
  4. Three sensors read 1, 0, 1. What does a majority vote decide? What if the middle sensor is the faulty one?
  5. Your machine sorted 50 parts and got 46 right. What is its accuracy? Is that good enough for a recycling plant? Explain.
  6. Describe one false positive and one false negative for the 'metal' bin. Which would you rather avoid, and why?
  7. A colour sensor averages 25 samples, each with noise ±30. How noisy is the average? What happens if the belt runs 2.5 times faster?

Follow-up

  • Try BUILD 008 (Create a Virtual Computer) to see the same gates add numbers.
  • Mission: The Three-Sensor Interlock uses majority voting to keep a robot cell safe.
  • Playground: digital logic. Try the 2:1 multiplexer challenge, the circuit that steers a signal to one of two places.
  • Atlas: evaluation metrics, for better ways to score a classifier than accuracy alone.