Lesson 09 · 60 minutes
Robots Go Wrong
Debugging like an engineer
Today's goal
Find and fix three planted faults using the robot's own messages and Watch mode, and write down how you found each one.
Ideas in this lesson
- Every robot goes wrong; engineers just get faster at finding why
- Read the message before you touch a wire
- Change one thing at a time
- The robot can tell you a lot: Watch mode, pin clashes, 'not found', 'not mapped'
Sense → Think → Do
Debugging is sensing the robot itself: its messages are clues. 'none found' is a sense problem, 'PIN CLASH' is a think problem, a wheel going backwards is a do problem.
How the session runs
- Before class, plant three faults on different robots: swap SDA and SCL; set a line sensor channel to the wrong pin in the Sensors tab; unplug one motor.
- Teach the routine on the board: 1 read the console, 2 guess, 3 change one thing, 4 test, 5 write it down.
- Clues to show: 'imu: none found' (I2C wiring), 'PIN CLASH: line sensor and light sensor both on pin a2', the app's pin map in red, Watch (lw) with a channel that never moves, t0-t3 to find a dead motor.
- Groups rotate between robots, 10 minutes each, logging clue, guess, fix.
- Share the real stories from building this robot: the cheap BNO055 that needed its PS0/PS1 pads checked and its address moved; a remote key that printed 'ir: key 0x.. not mapped'; a sensor whose label was hard to read.
- Each group presents its fastest find and its slowest find.
Try this
- Plant a fault for another group (with the teacher's OK).
- Which faults could the robot detect by itself? Which needed a human?
- Write a 'when it goes wrong' table for your own robot.
When it goes wrong
| What you see | What it means |
|---|---|
| Fixed one thing, broke another | Change one thing at a time and test after each change. |
| Can't find it at all | Go back to a known-good state: re-flash, restart, check the console banner. |
| Readings look fine but behaviour is wrong | Watch mode shows raw numbers with the robot standing still. Compare with what you expect. |
Notes for the grown-up
Make debugging the hero, not the embarrassment. The course promise is 'robots go wrong, and working around that builds creative tenacity'. Celebrate good guesses even when they were wrong.
Ages: K-5: one obvious fault (unplugged motor, swapped remote batteries) and a 'detective' sheet. 6-12: subtle faults (wrong polarity setting, swapped I2C) and a written bug report.
Materials: Two or three robots, app on each, small screwdriver, labels, bug-log worksheet.