Epic Tetris on the Seeeduino Wio Terminal: a 27-Column Challenge With Custom Controls

by daisykorr in Circuits > Arduino

69 Views, 1 Favorites, 0 Comments

Epic Tetris on the Seeeduino Wio Terminal: a 27-Column Challenge With Custom Controls

3.jpg

In this project, we transform the Seeeduino Wio Terminal into a fully functional Tetris console. This version of Tetris is different from the classic game – it features an expanded board with 27 columns and 17 rows, where each cell measures 12×12 pixels. A dedicated score display is set in the top area of the screen (30 pixels high), and the game offers custom controls for an enhanced playing experience.

Custom Key Controls:

  1. WIO_KEY_A (Pin 6):
  2. Short Press: Moves the falling tetromino left.
  3. Long Press (>500ms): Instantly drops the tetromino to the lowest available position.
  4. WIO_KEY_B (Pin 5):
  5. Short Press: Moves the falling tetromino right.
  6. Long Press (>500ms): Restarts the game (this applies both during normal play and when the game is over).
  7. WIO_KEY_C (Pin 9):
  8. Short Press: Rotates the tetromino 90° clockwise.

The code is designed to reduce screen flicker by updating the score area only when needed and using optimized drawing routines. Let’s dive in!

Supplies

材料.jpg
  1. Seeeduino Wio Terminal
  2. USB Cable for programming the Wio Terminal
  3. Arduino IDE (or another compatible development environment)
  4. TFT_eSPI Library installed via the Arduino Library Manager

Product Introduction

材料 - 副本.jpg
材料背面.jpg
微信图片_20250416141446.jpg

Start by familiarizing yourself with the Wio Terminal.

  1. What is the Seeeduino Wio Terminal?

The Seeeduino Wio Terminal is an all-in-one microcontroller board equipped with a color LCD and numerous IO options. It’s perfect for portable projects and interactive applications.

  1. Features for this project:
  2. Built-in TFT display
  3. Multiple digital IO pins for button inputs
  4. Compact design ideal for retro gaming projects

Connecting the Wio Terminal to Your Computer

屏幕截图(1)(1).png
  1. Power Up & Connect:

Use the USB cable to connect the Wio Terminal to your computer.

  1. Device Recognition:

Ensure your computer recognizes the device. Check in the Device Manager (on Windows) or System Information (on macOS/Linux).

  1. Select Your Board in the Arduino IDE:
  2. Open the Arduino IDE.
  3. Navigate to Tools > Board and select the correct Wio Terminal board.
  4. Choose the appropriate port under Tools > Port.

Preparing the Code

屏幕截图 2025-04-16 142426.png
  1. Install the TFT_eSPI Library:

In the Arduino IDE, go to Sketch > Include Library > Manage Libraries…, search for TFT_eSPI, and install it.

  1. Configure the TFT_eSPI Library:

Check the User_Setup.h file in the TFT_eSPI library folder to ensure the settings match the Wio Terminal specifications.

  1. Copy/ Write the Code:

Download and copy the complete code provided below into a new Arduino sketch. Or if you want to customize other features, just edit the code.

Uploading and Testing the Code

2.jpg
  1. Compile and Upload:

Click the Upload button in the Arduino IDE to compile and upload the sketch to your Wio Terminal.

  1. Run the Game:

Once uploaded, the Tetris game will launch automatically. Watch as a random tetromino (from seven classic Tetris pieces) starts falling onto a 27-column board.

  1. Use the Controls:
  2. Press Key A (Pin 6) to move left or hold it to drop the piece instantly.
  3. Press Key B (Pin 5) to move right or hold it to restart the game.
  4. Press Key C (Pin 9) to rotate the piece clockwise.
  5. Enjoy the Game:

Clear full lines to score points. Each cleared line adds 1 point, and your score is displayed in the top score area.

Application Examples and Expansion Ideas

Once the game is running, try the following enhancements:

  1. Sound Effects: Use the Wio Terminal's built-in buzzer to play sounds when rows are cleared or the game ends.
  2. High Score Tracking: Save the high score to the Wio Terminal's flash memory and display it.
  3. Speed Levels: Increase the dropInterval as the score rises to make the game more challenging.
  4. Custom Shapes: Modify the tetrominoes array to create new block designs.


References

TFT_eSPI Library on GitHub – Official repository and documentation.

Wio Terminal Resources:

  1. Seeed Studio Wio Terminal Product Page
  2. Wio Terminal Wiki

Tetris Fundamentals:

  1. Tetris Wikipedia
  2. Various online tutorials on game development and collision detection.