Lesson plan

Build a robot vacuum lesson plan

Bumpers and cliff sensors, wheel encoders and a map, random bounce against spiral against rows, a five-layer behavior ladder, and a battery that sends it home to its dock.

4 chapters, 7 lessons, about 6 hours, on the Arduino Uno R3. Every lesson runs in the browser, with nothing to install.

The unit

Objectives and materials

By the end, students can

  • Two bumpers and a cliff sensor, and the layers that decide which one wins.
  • Encoders and dead reckoning, then three coverage patterns scored on a map.
  • A five-layer behavior ladder, a battery read through a divider, and the trip home to the dock.
  • Clean a whole room, survive the furniture and dock.

Materials for the whole unit

  • Arduino Uno R3
  • Battery: AA, coin cell, LiPo
  • Limit switch, lever microswitch x 2
  • Line sensor, TCRT5000
  • Motor driver, DRV8833
  • Obstacle sensor, FC-51
  • Resistor x 2
  • Robot car chassis, 2WD

Every part is already on the simulator’s bench, so there is nothing to buy or hand out. The counts are the most any one lesson uses, if you build it on real breadboards too.

Chapter 1. About 1 h 50 min

Sensing the world

Two bumpers and a cliff sensor, and the layers that decide which one wins.

LessonTimeWhat students do
Bump sensorsThe gallery’s robot vacuum: two lever microswitches on the front corners. Hit a wall on each side, watch it back up and turn away from the hit, and see why the turn is random.60 min
  1. Run it
  2. Hit a wall on the left
  3. Backing up
  4. And on the right
  5. Spiral, then cruise
Cliff sensorsA TCRT5000 looking at the floor: infrared light that comes back means floor, none means a stair. Find the edge, see the cliff beat a bump, and meet the black rug every robot vacuum fears.50 min
  1. The floor falls away
  2. The cliff wins
  3. The black rug
  4. Back up, then turn

Materials

  • Arduino Uno R3
  • Limit switch, lever microswitch x 2
  • Line sensor, TCRT5000
  • Motor driver, DRV8833
  • Robot car chassis, 2WD

Check for understanding

Each student finishes "Cliff sensors" on their own, without opening the hints. The simulator checks 4 of its 4 steps as they go.

Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Back up, then turn".

Chapter 2. About 1 h 50 min

Covering a room

Encoders and dead reckoning, then three coverage patterns scored on a map.

LessonTimeWhat students do
Where am I? EncodersThe vacuum grown up: wheel encoders, dead reckoning and a map of a room in 10 cm squares. Drive a meter, count the edges, turn on the spot, and calibrate the wheel size.60 min
  1. Run it
  2. Drive a meter
  3. Dead reckoning
  4. Turn on the spot
  5. Calibrate the wheel
Coverage patternsThree ways to clean the same room and a map that scores them: random bounce, a widening spiral, and rows back and forth (boustrophedon). Measure how much each covers, and tighten the rows.50 min
  1. Random bounce
  2. The long tail
  3. Rows
  4. Tighter lanes

Materials

  • Arduino Uno R3
  • Battery: AA, coin cell, LiPo
  • Limit switch, lever microswitch x 2
  • Line sensor, TCRT5000
  • Motor driver, DRV8833
  • Obstacle sensor, FC-51
  • Resistor x 2
  • Robot car chassis, 2WD

Check for understanding

Each student finishes "Coverage patterns" on their own, without opening the hints. The simulator checks 4 of its 4 steps as they go.

Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Tighter lanes".

Chapter 3. About 1 h 40 min

Behaviors and power

A five-layer behavior ladder, a battery read through a divider, and the trip home to the dock.

LessonTimeWhat students do
The behavior ladderFive layers, the higher always winning: cliff, bumper, obstacle, battery, clean. Trigger each one while it cleans, and prove a cliff beats a bump.50 min
  1. Five layers
  2. Slow down before the hit
  3. The cliff is on top
  4. Why a ladder works
Battery and dockingRead the pack through a voltage divider, decide when to head home, and drive back to the dock by dead reckoning. Then raise the threshold and see why real docks use an infrared beacon for the last bit.50 min
  1. Read the pack
  2. Time to go home
  3. Find the dock
  4. Come home sooner

Materials

  • Arduino Uno R3
  • Battery: AA, coin cell, LiPo
  • Limit switch, lever microswitch x 2
  • Line sensor, TCRT5000
  • Motor driver, DRV8833
  • Obstacle sensor, FC-51
  • Resistor x 2
  • Robot car chassis, 2WD

Check for understanding

Each student finishes "Battery and docking" on their own, without opening the hints. The simulator checks 4 of its 4 steps as they go.

Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Come home sooner".

Chapter 4. About 50 min

Project

Clean a whole room, survive the furniture and dock.

LessonTimeWhat students do
Project: clean a roomPut it all together: clean the whole room in rows, with the ladder watching, deal with a chair leg and a stair on the way, then drive home and dock.50 min
  1. The job
  2. Home
  3. A chair leg
  4. Make it yours

Materials

  • Arduino Uno R3
  • Battery: AA, coin cell, LiPo
  • Limit switch, lever microswitch x 2
  • Line sensor, TCRT5000
  • Motor driver, DRV8833
  • Obstacle sensor, FC-51
  • Resistor x 2
  • Robot car chassis, 2WD

Check for understanding

Each student finishes "Project: clean a room" on their own, without opening the hints. The simulator checks 4 of its 4 steps as they go.

Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Make it yours".

Your class

Teach this unit as a class

Start a class from this course and its 7 lessons are assigned in one go, in order. Students join with a six-character code or printed login cards, and each one’s work comes back to you.

The class tools are free for 30 days for one class of up to 20 students, with no card. The lessons themselves are free either way.