Design challenge 2: design the brain
A sorting machine's whole brain fits on one small table. How can eight rows of yes and no sort thousands of parts?
About 30 min · 3 goals · Checked by automated tests; not yet reviewed by an educator
1.Why should I care?
Now you put the whole term together: sensors to measure, rules and loops to decide, actuators to act, and feedback to correct. Designing the brain on paper first, before any building or coding, is exactly what professional engineers do.
- ◇ Design the sense–think–act structure of an intelligent system.
- ◇ Write its rules using IF–THEN–ELSE, AND/OR and a loop.
- ◇ Cover every possible combination of sensor readings.
2.Predict
A sorter has three yes/no sensors: red?, large?, metal?. How many different combinations of readings are possible?
Guess first. Being wrong here is how the surprise works.
3.Discover
Turn the client's four-line brief into an 8-row rule table, choosing a bin for every combination of red, large and metal. Then watch the slow belt run your table.
Can't use the interactive? Read a description instead
The sorting-machine level can be replaced by this rule table for red (R), large (L) and metal (M): any row with M = yes goes to Metal; M = no and L = yes goes to Reject; M = no, L = no and R = yes goes to Red plastic; M = no, L = no and R = no goes to Mixed plastic. That covers all 8 combinations.
4.Understand
Start with the loop
Sketch the structure first:
forever: read every sensor → apply the rules → drive the actuators
Name each sensor and actuator. If the system aims at a target (a temperature, a position), mark where the gap is measured and fed back.
Cover every case
List every combination of sensor readings. Two yes/no sensors give 4 rows, three give 8. A rule table with an action for each row guarantees there's no situation your system hasn't thought about.
Priority rules
Some rules must win over others. Any metal part goes to Metal, whatever its colour or size. Put safety and top-priority rules first, so they're checked before anything else. 'IF metal THEN Metal ELSE IF large THEN Reject ELSE …' makes the order clear.
Explain it another way
A rule table is like a choose-your-own-adventure book where every page has a next step. No reader ever gets stuck on a page with nothing to do.
With n binary inputs there are 2ⁿ input combinations. A complete decision table maps each to an output. Nested IF–ELSE IF chains express priority: earlier conditions take precedence.
The client's sorting brief becomes four rules: metal first, then large, then red, then everything else. That one ordering fills all 8 rows of the table with no gaps and no contradictions.
Worked example 1
Brief: metal parts → Metal bin. Large non-metal → Reject. Small red plastic → Red. Everything else → Mixed. Write it as a priority chain.
IF metal THEN Metal ELSE IF large THEN Reject ELSE IF red THEN Red ELSE Mixed
Check one row: red, large, not metal → not metal, but large → Reject. Every one of the 8 rows lands in exactly one bin.
Common mix-ups
- You only need rules for the situations you expect.
✓ List every combination; the unexpected ones are where machines go wrong. - Rule order doesn't matter.
✓ In an IF–ELSE IF chain, the first true rule wins. Put the most important rules first.
5.Practice
Practice, not a test. Wrong answers get a hint and another try.
Practice 1
A smart greenhouse has four yes/no sensors (too hot?, too cold?, soil dry?, daytime?). How many rows does its complete rule table need?
Practice 2
Using the chain IF metal THEN Metal ELSE IF large THEN Reject ELSE IF red THEN Red ELSE Mixed, where does a small, red, metal part go?
Practice 3
A rule table for two sensors has only three rows filled in. What's the risk?
Practice 4
In your design, where do the sensor readings and rules go?
6.Apply it
For your term project, draw the sense–think–act diagram and write the rules as an IF–ELSE IF chain inside a forever loop. If you have yes/no sensors, fill in the complete rule table. Mark the one rule that must always win.
7.Reflect
Concepts: The design cycle and prototyping · Decisions and loops · Logic gates and Boolean algebra