Lesson plan

Build an electronic chessboard lesson plan

Build a chessboard that knows where every piece is: reed switches and an expander, move detection, the rules, LED hints and a small engine to play.

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

  • Reed switches under the squares, and moves from lifts and places.
  • Every legal move, and lights that show them.
  • A small engine with alpha-beta, then the finished board.

Materials for the whole unit

  • Addressable RGB LEDs
  • Arduino Uno R3
  • Full-size breadboard
  • I/O expander, MCP23017
  • Reed switch x 16

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

Feel the pieces

Reed switches under the squares, and moves from lifts and places.

LessonTimeWhat students do
Reed square matrixRead the squares of a chessboard: a reed switch under each, a magnet in every piece, and sixteen of them in one I2C read through an MCP23017.60 min
  1. Sixty four switches
  2. Put a piece on e4
  3. A light under it
  4. Lift it
  5. Two pieces, no ghosts
Move detectionTurn reed events into moves: a lift and a place, a piece put back, and a capture made of two lifts, with every square debounced first.60 min
  1. A move is two events
  2. Set a piece down
  3. Lift and place
  4. Changed your mind
  5. A capture

Materials

  • Addressable RGB LEDs
  • Arduino Uno R3
  • Full-size breadboard
  • I/O expander, MCP23017
  • Reed switch x 16

Check for understanding

Each student finishes "Move detection" 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 capture".

Chapter 2. About 2 h

Know the rules

Every legal move, and lights that show them.

LessonTimeWhat students do
Legal movesTeach the board the rules: a 0x88 board, every piece's moves, a king that may never be left in check, and checkmate and stalemate.60 min
  1. Twenty moves
  2. Play e2e4
  3. Not like that
  4. Twenty nine
  5. The quickest mate
LED hintsLight the board: every piece dim, the last move in blue, and when a piece is picked, every square it may legally go to in green.60 min
  1. The position in lights
  2. Where can it go?
  3. Count the lights
  4. A king with nowhere to go
  5. The last move

Materials

  • Addressable RGB LEDs
  • Arduino Uno R3
  • Full-size breadboard
  • I/O expander, MCP23017
  • Reed switch x 16

Check for understanding

Each student finishes "LED hints" 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 last move".

Chapter 3. About 2 h 10 min

Play the board

A small engine with alpha-beta, then the finished board.

LessonTimeWhat students do
A chess engineGive the board a mind: an evaluation, negamax with alpha-beta pruning three plies deep, captures first, and an honest look at how weak three plies is.60 min
  1. Play against it
  2. Its first reply
  3. Alpha-beta
  4. A free bishop
  5. Your move again
Project: play the boardThe finished board: moves from the reeds or the keyboard, LED hints, the engine's replies, a hint for you, and a fresh game when you want one.70 min
  1. Set up
  2. Ask for a hint
  3. Open the game
  4. Move it by hand
  5. A new game
  6. Share your board

Materials

  • Addressable RGB LEDs
  • Arduino Uno R3
  • Full-size breadboard
  • I/O expander, MCP23017
  • Reed switch x 16

Check for understanding

Each student finishes "Project: play the board" 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: "Share your board".

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.