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.
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.
Screen and buttons
Wire the panel and the pad, and see every press on the glass.
| Lesson | Time | What 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 |
|
| 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 |
|
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".
Make it a game
Draw a sprite, move it, and run a steady game loop.
| Lesson | Time | What 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 |
|
| 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 |
|
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".
Make it a console
Add music, a menu and a battery gauge, then play three games.
| Lesson | Time | What 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 |
|
| 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 |
|
| 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 |
|
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".
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.