Source: https://mokxi.com/teachers/plans/build-robot-vacuum
Updated: 2026-11-19

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.

Start a class from this course

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.

Lesson | Time | What students do

Bump sensors The 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

- Run it
- Hit a wall on the left
- Backing up
- And on the right
- Spiral, then cruise

Cliff sensors A 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

- The floor falls away
- The cliff wins
- The black rug
- 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.

Lesson | Time | What students do

Where am I? Encoders The 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

- Run it
- Drive a meter
- Dead reckoning
- Turn on the spot
- Calibrate the wheel

Coverage patterns Three 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

- Random bounce
- The long tail
- Rows
- 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.

Lesson | Time | What students do

The behavior ladder Five 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

- Five layers
- Slow down before the hit
- The cliff is on top
- Why a ladder works

Battery and docking Read 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

- Read the pack
- Time to go home
- Find the dock
- 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.

Lesson | Time | What students do

Project: clean a room Put 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

- The job
- Home
- A chair leg
- 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.

Start a class from this course See the demo class

More units

## Other lesson plans

Electronics basics 20 lessons, about 10 h. Embedded on the Arduino Uno 16 lessons, about 12 h. Embedded on the ESP32-C3 13 lessons, about 11 h. Embedded on the Raspberry Pi Pico 7 lessons, about 6 h. Build your own fight stick 5 lessons, about 4 h. Embedded on the STM32F411 6 lessons, about 6 h. C++ on a board 13 lessons, about 10 h. Digital logic and memory 4 lessons, about 4 h. Interactive devices on the Uno 9 lessons, about 8 h. From gates to a computer 23 lessons, about 16 h. Build a claw machine 8 lessons, about 6 h. Every unit All the courses as ready-made units, on the teachers page.
