What the course teaches
Build a robot vacuum is seven lessons on the Uno, in four chapters:
- Sensing the world: two bumper microswitches and a TCRT5000 cliff sensor, the black rug problem, and the layers that decide which one wins.
- Covering a room: wheel encoders, dead reckoning, braking and coasting, then random bounce, spiral and rows (boustrophedon) scored on a map.
- Behaviors and power: a five-layer behavior ladder with an FC-51 obstacle sensor, a battery read through a divider, and the trip home.
- Project: clean a whole room, survive the furniture and dock.
Each chapter ends in a short quiz. Open it from /learn.
The circuits
The first two lessons open the gallery's Robot vacuum behaviors, which the
robotics capstone also starts from. The rest run the vacroom sketch on the
same robot with the chassis's wheel encoders on pins 2 and 3, an FC-51 on pin
12, and a 4 x AA pack driving the motors and read on A0 through two 10 kilohm
resistors. Type clean, mode bounce, mode spiral, mode rows, go 1000,
turn 90, home or status into the Serial Monitor.
The room lives in the sketch
The simulated floor is endless, with no walls. So vacroom keeps a 2 m by
1.5 m room in memory, in 300 squares of 10 cm, with the dock in one corner.
The encoders say where the robot is in it, coming within 12 cm of a virtual
wall counts as a bump, and every square under the brush is marked clean. The
bumpers, cliff sensor, obstacle sensor, encoders and battery are real parts.
Troubleshooting
- It never stops where it should. On a DRV8833 both inputs low is a coast. The sketch brakes with both high and cuts the motors early by the coast.
- Rows drift off their lanes. Each turn leaves a few degrees of error. The sketch turns to absolute headings and steers to hold each lane.
- It docks a little off. Dead reckoning error grows with distance; real docks finish with an infrared beacon.
- It backs away from a black floor. That is the cliff sensor seeing no light, as it would over a stair.