← micro:bit and the computer

Capstone: your own AI sorter

Choose a sorting problem, build a fair test set first, train and improve a Teachable Machine model until every group passes, connect a micro:bit build that acts safely on its labels, and report what it still gets wrong.

Engineers who build an AI system are asked two questions before it is used: how did you test it, and when does it fail? This time the problem, the data and the answers are yours.

You have trained a model, tested it fairly, fixed it by changing its data, and sent its labels to a micro:bit. Now do it all on a problem you choose, in four milestones with less help each time.

Some ideas: ripe or unripe fruit; LEGO bricks by colour or size; tidy or messy desk; book or not a book; wet or dry washing (photos only); a recycling sorter for your school's own bins. Two to four classes, plus a Neither class for everything else.

WidthMore contexts, same idea.
Info

Plan

Write in your book or a document:

  1. The problem and who it helps.
  2. The classes (with exact names, as you will type them in Teachable Machine), including Neither.
  3. Where it will be used: the background, the light, the distance. These become your test groups.
  4. What the micro:bit does for each label, and what it does when it is unsure.

ModifyChange the code on purpose and check the result.

Milestone 1: build the test set first

Take your test photos before you train, and keep them apart from your training photos. For each class, take photos in at least three groups: different places, light or distances where the model will be used. On the board, choose the class, name the group, then Add photos. (The photos stay in this browser only.)

Try it yourselfYour edits are saved in this browser.

Add at least 24 test photos in at least 3 groups, with every class in every group.

Use the board. This ticks when you get there.

ModifyChange the code on purpose and check the result.

Milestone 2: train, test, improve

Train in Teachable Machine (new photos, not your test photos), export with Upload my model, and paste the link. Find the weakest group, work out what its failures share, change the training data, and test again. Keep a note of each change and its scores.

Try it yourselfYour edits are saved in this browser.

Get 80% or more overall, with no group below 60%.

Use the board. This ticks when you get there.

MakeBuild something new using what you have learned. Expect a few tries; that is normal.

Milestone 3: the build

Program the micro:bit: one branch for each of your labels, an else that does something safe, and a reply (serial write value) saying what it did. A servo flap, lights, a sound or the screen: your choice. If the build is across the room, add the radio bridge.

Try it yourselfYour edits are saved in this browser.
It takes a few seconds to load. Your work in this step is kept.

The micro:bit acts on each of your labels, does something safe for anything else (Unsure, Neither, or a word it doesn't know), and replies with what it did.

This ticks by itself when your blocks do what is asked.

Run TypicalRun it and compare the result with your prediction.

Milestone 4: the whole system

Load your model, connect your micro:bit, and run it on the webcam with real items. Watch what happens when you show something that is in no class at all.

Try it yourselfYour edits are saved in this browser.

Run the whole system: at least 5 labels sent from the webcam and 5 replies from the micro:bit.

Use the board. This ticks when you get there.

Info

Report

Write a one-page report (or a two-minute talk):

For teachers

Students build an AI sorter for a problem they choose, in four milestones (test set, model, build, system), and report its scores by group and its limits. About 120 minutes.

Open the teacher guide: answers, solutions, slides and a worksheet.

Students will be able to

Before class

The capstone brings the course together on a problem each student (or pair) chooses. The order matters: test set first, from photos the model never trains on, in groups that match where it will be used (place, light, distance). The board keeps the test photos in the student's browser only (testset: own); they are shrunk to small squares and never uploaded. Remind students not to photograph people.

Milestones: (1) at least 24 test photos in at least 3 groups; (2) 80% overall with no group under 60% (the board's acc_min); (3) a micro:bit program with a branch per label, a safe else and a reply; (4) the whole system on the webcam (typical: needs a micro:bit). The report is the assessment piece: scores by group before and after, the data changes made, and the limits.

Choosing problems: steer away from people (faces, emotions, who someone is) and anything where a wrong answer could hurt someone. Good problems have objects students can bring in. Two to four classes plus Neither is plenty.

Without micro:bits: milestones 1, 2 and 3 work without hardware (3 is checked in the editor); milestone 4 is typical.

Running the lesson

  1. Plan: check class names are exact and that every class has a Neither alternative.
  2. Test set: check groups are real conditions (window, desk, dim), not just more of the same.
  3. Improve: ask each student which group is weakest and what its failures share.
  4. Build: the safe else is the AI robots idea in a new setting.
  5. Report: ask 'who or what might it fail for?' of every report.

The hard part (on purpose)

Making the test set before training and keeping it separate. When the score is 100% at once, ask whether any test photos were also training photos.

When students get stuck

Stretch and support

Stretch: Add a second model in CreateAI (a movement) that starts or stops the sorter, so the two models work together.

Support: Offer a ready-made problem (the recycling sorter with your school's bins) and a planning template with the four plan questions.

Where it leads

Where this leads: AI robots (a robot driven by a model, with safety rules), and the Python pathway's Machine learning with Gradio. Real world: model cards and test reports for AI systems.

What each step is for

Now you can
You reached the endBack to micro:bit and the computer