Turn back time and build a classic handheld Tetris game using an ESP32-S3, a vibrant TFT display, and tactile buttons. A perfect weekend project for retro gaming fans!
Tutorial :
📝 Story
As an Android game developer, I don't just love playing games; I love creating them. My ultimate goal has always been to build a dedicated handheld game console—something like a DIY PSP with a custom PCB and game engine.
But before we get to the complex stuff, let's start with the classics. In this project, we are building a standalone Tetris game. It uses an ESP32 microcontroller and an ILI9341 TFT display. It is easy to build, requires minimal components, and is incredibly fun to play.
⚡ Things Used in this ProjectHardware Components- Microcontroller: ESP32-S3 Development Board (Note: A standard ESP32 works too).
- Display: 2.4" or 2.8" TFT LCD Display (ILI9341 Driver, 320x240 resolution).
- Input: 4x Tactile Push Buttons (6x6mm).
- Audio: 1x Passive Buzzer.
- Prototyping: Breadboard and Jumper Wires.
- Arduino IDE
- Library:
TFT_eSPIby Bodmer
We will be using the ESP32 in a breadboard setup. Place the ESP32 on one side of the breadboard to leave room for jumper wires.
1. Connecting the ILI9341 DisplayConnect the SPI display pins to the ESP32 as follows. (Note: We are not using the touch functionality for this project).
2. Connecting the ControlsWe use four buttons for game control. The code uses INPUT_PULLUP, so no external resistors are required. Connect one leg of the button to the GPIO and the other leg to GND.
If you haven't used ESP32 with Arduino IDE before:
- Go to File > Preferences.
- Paste the ESP32 Board Manager URL into "Additional Boards Manager URLs".
- Go to Tools > Board > Boards Manager.
- Search for "ESP32" and install the latest version
- Go to Sketch > Include Library > Manage Libraries.
- Search for
TFT_eSPI. - Install the library by Bodmer.
For the display to work with our specific pin wiring, we need to edit the library configuration files.
- Navigate to your Arduino libraries folder:
Documents/Arduino/libraries/TFT_eSPI.
Open User_Setup_Select.h.
- Uncomment the line corresponding to your specific driver setup (or leave default and edit the setup file directly).
Open User_Setup.h.
- This is where the magic happens. You must edit the pin definitions in this file to match the wiring table in Step 1 exactly (CS, DC, RST, MOSI, SCK, etc.)
Tip: If you see a white screen after uploading, double-check your User_Setup.h pin definitions!🚀 Step 3: Uploading the Code- Download the project code from the GitHub Repository (Link in the video description)
- Open the
.inofile in Arduino IDE. - Connect your ESP32 to your PC via USB.
- Select your board (e.g., ESP32S3 Dev Module) and the correct COM Port.
- Click Upload.
Note: You generally don't need to modify the main code, but variables are defined at the top if you wish to tweak game settings.
🎮 Step 4: How to PlayOnce uploaded, the game should start immediately.
- Rotate Button: Rotates the current block.
- Left/Right Buttons: Slides the block horizontally.Down Button: Makes the block fall faster.
Game Mechanics:
- Points: You earn 100 points for every line cleared.
- Speed: For every 500 points earned, the game speed increases, making it more challenging!
- Next Block: A preview of the upcoming block is shown on the right side of the screen.
This project is a stepping stone toward a larger goal: a DIY "PSP-like" handheld console with a custom PCB and a community-driven game engine. Stay tuned for that!
If you enjoyed this build, please consider subscribing to the channel for more hardware projects!







_8cjBRiU3as.png)





Comments