6 · Training a robot by example
Here's the part that feels like magic but isn't: you can teach a robot a new skill without writing a single rule — just by giving it examples. This is the same "learn the pattern from examples" idea from Young Makers, except now you are the teacher and the model controls a real device.
The loop has three stages, and the best part is you can actually do it for free:
- Collect data. Do the thing you want the robot to recognize, over and over, while a sensor records it. Each recording is a labeled example.
- Train & test the model. The tool finds the pattern that separates your examples (a "wave" from a "clap"), then you test it and see where it's confused.
- Improve, then use it. Add more or better examples to fix mistakes, then run the trained model on the device so it responds to new movements live.
This is exactly what micro:bit CreateAI does, and it's free with no login. You "collect your movement data from the micro:bit's accelerometer, train, test and improve your own machine learning model, then use it" in a MakeCode program (Micro:bit Educational Foundation, n.d.-a). The official guidance walks through it as one workflow: "Collect data, iterate training, testing and improving a ML model, then code with it" (Micro:bit Educational Foundation, n.d.-a). Notice the word iterate — the build-test-improve loop from the engineering design process, now applied to teaching a model.
Two lessons fall out of doing this yourself:
- Better examples beat more rules. When the model confuses two movements, you don't write code — you give it clearer, more varied examples. The data is how you teach.
- You can feel the bias. If you only record yourself doing a slow, gentle wave, the model gets confused by a fast one. You just experienced "the model is only as good as its examples" with your own hands.
Think about it. Suppose you train a micro:bit to tell "shake" from "still," but it keeps thinking a gentle bump is a shake. Following the loop above, what would you do — and notice you're fixing data, not writing rules.
Sources
Micro:bit Educational Foundation. (n.d.-a). Artificial intelligence (AI) — micro:bit CreateAI. https://microbit.org/get-started/features/ai/ Code.org. (n.d.). How AI works (training data; machine learning). https://code.org/ai