Lesson plan

Build a handheld game console lesson plan

Wire a color screen, buttons and sound to an ESP32-C3, one working step at a time, and finish with three games you can play.

3 chapters, 7 lessons, about 6 hours, on the ESP32-C3-DevKitM-1. Every lesson runs in the browser, with nothing to install.

The unit

Objectives and materials

By the end, students can

  • Wire the panel and the pad, and see every press on the glass.
  • Draw a sprite, move it, and run a steady game loop.
  • Add music, a menu and a battery gauge, then play three games.

Materials for the whole unit

  • Battery: AA, coin cell, LiPo
  • ESP32-C3-DevKitM-1
  • Full-size breadboard
  • Game console buttons
  • Piezo speaker
  • Pushbutton x 2
  • Resistor x 2
  • TFT display, 240x320

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

Screen and buttons

Wire the panel and the pad, and see every press on the glass.

LessonTimeWhat students do
Light up the screenWire a 2.4 inch color TFT to an ESP32-C3 on four wires, wake it up, and paint your first title and color bars.50 min
  1. Four wires and a screen
  2. Run it
  3. Watch the clock wire
  4. Make it yours
Add the D-pad and buttonsSix buttons to ground, read with the chip's own pull-ups: see every press on the screen and in the serial monitor.50 min
  1. A switch to ground
  2. Press A
  3. Watch the pin go low
  4. Every direction

Materials

  • ESP32-C3-DevKitM-1
  • Full-size breadboard
  • Game console buttons
  • TFT display, 240x320

Check for understanding

Each student finishes "Add the D-pad and buttons" 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: "Every direction".

Chapter 2. About 1 h 40 min

Make it a game

Draw a sprite, move it, and run a steady game loop.

LessonTimeWhat students do
Draw a sprite and move itTurn a little text picture into pixel art, then walk it around the screen by erasing only the strip it leaves behind.50 min
  1. A picture made of letters
  2. Walk right
  3. Why only the strip
  4. Draw your own hero
Write a game loopRead, update, draw, wait: a catch game at a steady forty frames a second, and how a loop keeps its own beat.50 min
  1. Three jobs, forever
  2. A steady beat
  3. Catch one
  4. Speed it up

Materials

  • ESP32-C3-DevKitM-1
  • Full-size breadboard
  • Game console buttons
  • TFT display, 240x320

Check for understanding

Each student finishes "Write a game loop" 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: "Speed it up".

Chapter 3. About 2 h 30 min

Make it a console

Add music, a menu and a battery gauge, then play three games.

LessonTimeWhat students do
Add chiptune soundA piezo on one pin plays a looping tune from tone(), and a jump sound on A cuts in without ever stopping the loop.50 min
  1. A piezo and one pin
  2. Music that never stops the game
  3. Jump
  4. Turn it off
Build the game menuAdd Start and Select, then a menu that opens a game and always finds its way back: the screens every console is made of.50 min
  1. Start and Select
  2. Screens and a variable
  3. Open a game
  4. Find your way back
The finished consoleThree real games, music, a pause button and a battery gauge: everything from the path in one handheld you can play.50 min
  1. A battery gauge
  2. Run the battery down
  3. Play Blocks
  4. Runner, Snake, and pause

Materials

  • Battery: AA, coin cell, LiPo
  • ESP32-C3-DevKitM-1
  • Full-size breadboard
  • Game console buttons
  • Piezo speaker
  • Pushbutton x 2
  • Resistor x 2
  • TFT display, 240x320

Check for understanding

Each student finishes "The finished console" 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: "Runner, Snake, and pause".

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.