Lesson plan

Build a pinball table lesson plan

From two flipper buttons to a full table with a kicker, lights, sound and a saved high score, on a Mega.

3 chapters, 5 lessons, about 5 hours, on the Arduino Mega 2560. Every lesson runs in the browser, with nothing to install.

The unit

Objectives and materials

By the end, students can

  • Flippers that answer, and targets that score once per hit.
  • Fire a 12 V coil safely, then add lights and a tune that never wait.
  • Tie it all together in a state machine with a high score that survives a reset.

Materials for the whole unit

  • Addressable RGB LEDs
  • Arcade button x 3
  • Arduino Mega 2560 R3
  • Bench power supply
  • Diode
  • Four-digit display, TM1637
  • Full-size breadboard
  • Half breadboard
  • MOSFET
  • Piezo speaker
  • Pinball table

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

The playfield

Flippers that answer, and targets that score once per hit.

LessonTimeWhat students do
Pinball: flippers that answerTwo arcade buttons and the table’s two flipper servos on a Mega. Read a button with the chip’s own pull-up and move a flipper the moment it changes.65 min
  1. Meet the cabinet
  2. Raise the left flipper
  3. And the right one
  4. Why pressed reads LOW
  5. Let go
Pinball: targets and a scoreThe table’s three standup targets and a four-digit TM1637. Count a hit once, however much the switch bounces, and reward the whole bank.65 min
  1. Three targets
  2. Hit target A
  3. Put it on the display
  4. One hit, one score
  5. Finish the bank

Materials

  • Arcade button x 2
  • Arduino Mega 2560 R3
  • Four-digit display, TM1637
  • Full-size breadboard
  • Half breadboard
  • Pinball table

Check for understanding

Each student finishes "Pinball: targets and a score" 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: "Finish the bank".

Chapter 2. About 1 h 40 min

Power and show

Fire a 12 V coil safely, then add lights and a tune that never wait.

LessonTimeWhat students do
Pinball: a bumper that kicksA pop bumper switch fires the table’s 12 V kicker coil through a logic-level MOSFET, with a diode across the coil. Big current from a small pin, safely.50 min
  1. A pin cannot do this alone
  2. Kick
  3. The MOSFET does the lifting
  4. Every hit, every time
Pinball: lights and soundSixteen WS2812 lamps and a piezo. Run an attract-mode rainbow and play a tune at the same time, with nothing ever waiting.50 min
  1. Attract mode
  2. Every lamp lit
  3. Press START
  4. Hear it

Materials

  • Addressable RGB LEDs
  • Arcade button
  • Arduino Mega 2560 R3
  • Bench power supply
  • Diode
  • Full-size breadboard
  • Half breadboard
  • MOSFET
  • Piezo speaker
  • Pinball table

Check for understanding

Each student finishes "Pinball: lights and sound" 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: "Hear it".

Chapter 3. About 1 h 15 min

The game

Tie it all together in a state machine with a high score that survives a reset.

LessonTimeWhat students do
Pinball: the whole tableEverything together in a state machine: attract, launch, play, drain, game over and high score entry, with the best score kept in EEPROM.75 min
  1. The finished table
  2. Start a game
  3. Play the bank
  4. Ball save
  5. Lose a ball
  6. Set a high score

Materials

  • Addressable RGB LEDs
  • Arcade button x 3
  • Arduino Mega 2560 R3
  • Bench power supply
  • Diode
  • Four-digit display, TM1637
  • Full-size breadboard
  • Half breadboard
  • MOSFET
  • Piezo speaker
  • Pinball table

Check for understanding

Each student finishes "Pinball: the whole table" 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: "Set a high score".

Your class

Teach this unit as a class

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