Source: https://mokxi.com/teachers/plans/escape-box
Updated: 2026-11-11

Lesson plan

# Build an escape-room puzzle box lesson plan

A keypad, a magnet key, an RFID card, a tilt sequence and a light puzzle, each one a lesson, then the whole box with its lock.

3 chapters, 7 lessons, about 4 hours, on the Arduino Mega 2560. 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

- A code on a keypad and a magnet nobody can see.
- A card, a tilt and a flash of light, each read by a different sensor.
- The clock, the hint and the lock, then all five puzzles at once.

### Materials for the whole unit

- Accelerometer and gyroscope, MPU6050
- Arduino Mega 2560 R3
- Character LCD, 20x4, with I2C backpack
- Full-size breadboard
- Hobby servo
- Keypad, 4x4
- LED x 5
- Photoresistor sensor module
- Piezo speaker
- Pushbutton
- Reed switch
- Resistor x 5
- RFID reader, MFRC522

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 10 min

## Locks without keys

A code on a keypad and a magnet nobody can see.

Lesson | Time | What students do

A keypad code lock Sixteen keys on eight wires: how a 4 x 4 keypad is scanned, and a code lock that lights the first lamp for the right year. | 35 min

- The first puzzle
- Press a key
- A wrong guess
- Crack the code
- Clear a mistake

A magnet for a key A reed switch hidden in the box opens to a magnet held in the right place for two seconds: a lock with no keyhole. | 35 min

- A lock with no keyhole
- Bring the magnet close
- Too quick
- Hold it there
- The second lamp

### Materials

- Arduino Mega 2560 R3
- Character LCD, 20x4, with I2C backpack
- Full-size breadboard
- Keypad, 4x4
- LED
- Piezo speaker
- Reed switch
- Resistor

### Check for understanding

Each student finishes "A magnet for a key" on their own, without opening the hints. The simulator checks 5 of its 5 steps as they go.

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

Chapter 2. About 1 h 35 min

## Puzzles that sense

A card, a tilt and a flash of light, each read by a different sensor.

Lesson | Time | What students do

Only the right card An MFRC522 reader on the SPI pins reads each card's UID, and only the card that ends in A7 opens the third lock. | 35 min

- The reader
- Read a card
- The wrong card
- The right card
- The third lamp

A tilt sequence An MPU-6050 feels which way gravity points, so the box knows how it is tipped. Left, right, then forward lights the fourth lamp. | 30 min

- A sense of down
- Tip it left
- The wrong order
- Left, right, forward

Three flashes of light A photoresistor module counts flashes, with two thresholds so a flickering light is never counted twice. Three flashes light the fifth lamp. | 30 min

- A light sensor
- One flash
- Two thresholds
- The fifth lamp

### Materials

- Accelerometer and gyroscope, MPU6050
- Arduino Mega 2560 R3
- Character LCD, 20x4, with I2C backpack
- Full-size breadboard
- LED
- Photoresistor sensor module
- Piezo speaker
- Resistor
- RFID reader, MFRC522

### Check for understanding

Each student finishes "Three flashes of light" 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: "The fifth lamp".

Chapter 3. About 1 h 15 min

## Lock it and escape

The clock, the hint and the lock, then all five puzzles at once.

Lesson | Time | What students do

The clock, the hint and the lock A one-minute clock on the LCD and the five lamps, a hint button that costs time, and a servo lock with a game master's release. | 35 min

- Locked
- The clock on the lamps
- Ask for a hint
- The game master's release
- Time is up

Escape the box All five puzzles in one box against a ten-minute clock, with hints that cost 30 seconds and a servo lock that opens only at the end. | 40 min

- The keypad
- Take a hint
- The magnet
- The card
- The tilt
- Escape

### Materials

- Accelerometer and gyroscope, MPU6050
- Arduino Mega 2560 R3
- Character LCD, 20x4, with I2C backpack
- Full-size breadboard
- Hobby servo
- Keypad, 4x4
- LED x 5
- Photoresistor sensor module
- Piezo speaker
- Pushbutton
- Reed switch
- Resistor x 5
- RFID reader, MFRC522

### Check for understanding

Each student finishes "Escape the box" on their own, without opening the hints. The simulator checks 6 of its 6 steps as they go.

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

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.
