Source: https://mokxi.com/teachers/plans/build-magic-wand
Updated: 2026-11-19

Lesson plan

# Build a gesture magic wand lesson plan

A wand that turns flicks into spells: angles from an MPU6050, poses, a time window and a state machine that recognize spells, LED effects, an IR cast that opens a box, and a battery that lasts.

3 chapters, 6 lessons, about 5 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

- Angles from gravity, poses past a threshold, a window that tells a flick from a tilt, and spells from a spellbook.
- Effects on eight WS2812 LEDs, a spell of your own, and an NEC code at 38 kHz that opens a servo latch.
- A LiPo read, budgeted and put to sleep, and a box that opens only for your secret spell.

### Materials for the whole unit

- Accelerometer and gyroscope, MPU6050
- Addressable RGB LEDs
- Arduino Uno R3 x 2
- Battery: AA, coin cell, LiPo
- Hobby servo
- Infrared LED, 940 nm
- Infrared receiver, VS1838B
- Resistor

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

## Gestures

Angles from gravity, poses past a threshold, a window that tells a flick from a tilt, and spells from a spellbook.

Lesson | Time | What students do

Motion as gestures An accelerometer in the wand’s tip feels which way is down. Turn that into angles, angles into poses, and tell a flick from a slow tilt with a time window. | 55 min

- Run it
- Down is a direction
- A flick, not a tilt
- Twist
- Tune the threshold

Recognizing spells String flicks into spells with a tiny state machine and a pause that ends each one, look them up in a spellbook, and see how the big systems do it with dynamic time warping. | 55 min

- Lumos
- Nox
- Two moves
- Not a spell
- A faster finish

### Materials

- Accelerometer and gyroscope, MPU6050
- Addressable RGB LEDs
- Arduino Uno R3 x 2
- Battery: AA, coin cell, LiPo
- Hobby servo
- Infrared LED, 940 nm
- Infrared receiver, VS1838B
- Resistor

### Check for understanding

Each student finishes "Recognizing spells" 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: "A faster finish".

Chapter 2. About 1 h 30 min

## Light and casting

Effects on eight WS2812 LEDs, a spell of your own, and an NEC code at 38 kHz that opens a servo latch.

Lesson | Time | What students do

Light effects Every spell needs a look: a white glow, darkness, a blue cast and a flickering fire on eight WS2812 LEDs, and a new spell of your own in the spellbook. | 45 min

- Lumos lights all eight
- Incendio
- Flicker
- Write a spell

IR casting A spell that leaves the wand: an NEC code flashed at 38 kHz through an infrared LED, decoded by the box, which opens its latch only for the right address and command. | 45 min

- Cast it
- The box hears it
- The latch
- Lock it again

### Materials

- Accelerometer and gyroscope, MPU6050
- Addressable RGB LEDs
- Arduino Uno R3 x 2
- Battery: AA, coin cell, LiPo
- Hobby servo
- Infrared LED, 940 nm
- Infrared receiver, VS1838B
- Resistor

### Check for understanding

Each student finishes "IR casting" 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: "Lock it again".

Chapter 3. About 1 h 40 min

## Build it

A LiPo read, budgeted and put to sleep, and a box that opens only for your secret spell.

Lesson | Time | What students do

Battery A wand runs on a 500 mAh LiPo. Read the cell, budget the LEDs’ current, dim when the cell runs low, and sleep when nobody is casting. | 55 min

- Read the cell
- The current budget
- Running low
- Sleep
- Wake on a flick

Project: a spell that opens a box Make the box yours: a secret three-move spell to open it, a spell to lock it, and a wand that sleeps between uses. | 45 min

- The box
- A secret spell
- Lock it
- Ready for the shelf

### Materials

- Accelerometer and gyroscope, MPU6050
- Addressable RGB LEDs
- Arduino Uno R3 x 2
- Battery: AA, coin cell, LiPo
- Hobby servo
- Infrared LED, 940 nm
- Infrared receiver, VS1838B
- Resistor

### Check for understanding

Each student finishes "Project: a spell that opens a box" 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: "Ready for the shelf".

Your class

## Teach this unit as a class

Start a class from this course and its 6 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.
