Story
Tetris is a puzzle video game created in 1985 by Alexey Pajitnov. Players manipulate falling geometric shapes called "tetrominoes." The goal is to create horizontal lines without gaps. Completed lines disappear, granting the player points, and all other blocks move down the corresponding number of lines.
The game speeds up as you progress. Many different versions of Tetris have been released for PC, consoles and mobile platforms.
In this project I will present you a way to make a colorful version of Tetris with probably the lowest possible display resolution of only 64 pixels.
Detailed video description at: https://youtu.be/0n85455Zpvg
In fact, the display is a cheap 8x8 LED matrix consisting of 64 RGB diodes with a built-in WS2812 chip. This allows us to control the entire matrix with just one pin from the microcontroller. This project is extremely simple to make, and is suitable even for absolute beginners in this field. However, despite its simplicity, as you will see later, the game is endlessly addictive and is intended for players of all ages.
Now let's see what elements the device contains:
- Arduino Nano microcontroller board
- 8x8 Led matrix with WS2812b chips.
- 3 Buttons
- Buzzer
- and optional battery
I should mention that if the device is powered by an external 5VDC source, it should be capable of delivering a current of at least 1Ampere.
All components used are standard except the LED matrix which can be found on the market in several versions. They all differ in the way and order of connecting the LEDs in them (zigzag horizontally, then vertically, snake connection, etc.). It is obvious that we cannot make hardware changes, so for this purpose I created a part of the code where any version of these matrices can be selected.
We need to select one by one of these 4 connection methods until we get the correct image on the matrix display.
First, let me introduce you to the options and how the device functions in real-world conditions. Immediately upon switching on, a characteristic sound sequence is activated and the scrolling text Mini Tetris appears on the display. Then the display is divided into two halves, one blue and the other magenta. The blue side is the normal game mode, and the magenta side is the KIDS (easy) game mode.
In normal mode, the Tetrominoes are of standard size, shape and number as in the original and a faster reaction is required, especially considering the small distance between the top and bottom rows of the display. The outer buttons move the tetromino left and right, and the middle button is for rotation. The speed of movement of the tetromino increases with time. With each cleared row, 100 points are obtained. If two rows are cleared at the same time, the reward is 400 points. The final score is displayed at the end in the form of scrolling text, followed by a smiley figure.
From this moment if we press any of the buttons, a new game begins, signaled by the display filling with green. The entire gameplay is accompanied by appropriate sound effects.
Now to select kids mode, we have to restart the device. Otherwise, the kids mode option is very useful because it is much easier and simpler to play and so children can play it. In this mode, the tetrominos are much smaller, there is no rotation option, and they are much easier to arrange. The other functions are identical to the normal mode.
A few words about the code, as you can see, it is designed in a way that allows you to easily change almost all the parameters of the game, starting from the intensity of the LEDs, changing the colors, the sounds, and probably the most important parameter, which is the initial speed of the tetromino, the degree of acceleration during the game, and the maximum speed limit.
Below you can see several gameplays in normal and kids modes.
And finally a short conclusion: This extremely simple project is actually the minimum possible version of the Tetris game made on a 64 pixel display, but still with all the standard options and sound effects, and even a Kids mode intended for the youngest.
As for the case, it is from one of my previous projects and is made of 5mm thick PVC material and has the shape of a classic arcade game console where this game was most often played many years ago. It is covered with self-adhesive wallpaper.