Lesson plan

Build a claw machine lesson plan

Build a real arcade claw machine piece by piece, from one stepper motor to coins, a clock, a win sensor, lights and sound.

3 chapters, 8 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 stepper motors that go exactly where the stick says.
  • Find zero at power-up, then drop, grab and carry a prize home.
  • Coins, a countdown, a sensor that knows you won, and the lights and sound of a real cabinet.

Materials for the whole unit

  • Addressable RGB LEDs
  • Arcade button
  • Arduino Uno R3
  • Character LCD with I2C backpack
  • Claw machine cabinet, stepper gantry
  • Full-size breadboard
  • Limit switch, lever microswitch
  • Motor driver, DRV8833
  • Piezo speaker
  • Resistor
  • Stepper driver, A4988 x 2
  • Stepper motor, NEMA 17 x 2
  • Thumb stick

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 2 h 15 min

The gantry

Two stepper motors that go exactly where the stick says.

LessonTimeWhat students do
One stepper on a driverStart the claw machine with one axis: a NEMA 17 on an A4988, two signal wires from the Uno, and a test move that proves the wiring.45 min
  1. Why a stepper, and why a driver
  2. Run it: the test move
  3. Read what the sketch says
  4. Speed is timing
Steer with a joystickAdd the thumb stick so a player can drive the gantry, and turn how far it is pushed into how fast the motor steps.45 min
  1. Two pots in one stick
  2. Push it right
  3. The dead zone
  4. Counting is the position
The second axisCopy the first axis for Y: a second A4988 and NEMA 17, two more wires, and the claw can reach the whole cabinet floor.45 min
  1. Same driver, two new pins
  2. Both test moves
  3. Push it forward
  4. Never wait in loop()

Materials

  • Arduino Uno R3
  • Full-size breadboard
  • Stepper driver, A4988 x 2
  • Stepper motor, NEMA 17 x 2
  • Thumb stick

Check for understanding

Each student finishes "The second axis" 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: "Never wait in loop()".

Chapter 2. About 1 h 30 min

Home and grab

Find zero at power-up, then drop, grab and carry a prize home.

LessonTimeWhat students do
The cabinet and its home switchesMount the two motors in the cabinet, and wire the lever switch at the home end of each axis, so the machine finds zero at power-up the way printers and real cabinets do.45 min
  1. A stepper forgets where it is
  2. Home the X axis
  3. Then Y, and a switch that never closes
  4. The switch guards the end
The claw and the dropWire the cabinet's winch and servo claw and add the Drop button, and write the grab as a state machine: lower, close, lift, carry home, open.45 min
  1. The winch, the claw and a button
  2. Press Drop
  3. One state at a time
  4. Grip strength

Materials

  • Arcade button
  • Arduino Uno R3
  • Claw machine cabinet, stepper gantry
  • Full-size breadboard
  • Motor driver, DRV8833
  • Stepper driver, A4988 x 2
  • Thumb stick

Check for understanding

Each student finishes "The claw and the drop" 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: "Grip strength".

Chapter 3. About 2 h 15 min

The game

Coins, a countdown, a sensor that knows you won, and the lights and sound of a real cabinet.

LessonTimeWhat students do
Coins and a countdownAdd a coin switch and a 16x2 LCD, and load the full game: insert a coin, beat the clock, and drop.45 min
  1. A coin is a pulse
  2. Insert coin
  3. Beat the clock
  4. Drop, or run out of time
Knowing you wonWire the infrared beam across the prize chute, so the machine knows a prize really fell and can call a win.45 min
  1. A beam across the chute
  2. Play a round
  3. Win a prize
  4. Why not trust the claw
Lights, sound and the whole machineFinish the cabinet with a NeoPixel marquee and a speaker, and meet the payout setting real machines use.45 min
  1. Marquee and speaker
  2. Attract mode
  3. A coin and a jingle
  4. The payout setting, honestly

Materials

  • Addressable RGB LEDs
  • Arcade button
  • Arduino Uno R3
  • Character LCD with I2C backpack
  • Claw machine cabinet, stepper gantry
  • Full-size breadboard
  • Limit switch, lever microswitch
  • Motor driver, DRV8833
  • Piezo speaker
  • Resistor
  • Stepper driver, A4988 x 2
  • Thumb stick

Check for understanding

Each student finishes "Lights, sound and the whole machine" 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 payout setting, honestly".

Your class

Teach this unit as a class

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