“The first thing I needed was an RGB display, push buttons or a small joystick and an enclosure. After some research, I found the Adafruit Neopixel Matrix 8×8, which is very easy to apply because it uses a just a single wire interface and simple handy library,” Zola explained in a recent YouTube post.
“So, I used two, which gave me a display of 16 rows and 8 columns of RGB LED (or pixels). For power, I used a LI battery of 3.7V 4400mAh. It was really necessary to put a capacitor (1000 µF, 6.3V or higher) across the positive and negative terminals of neopixel matrix.”
The next step? Determining how to control each Tetris “piece” in the game.
“Moves like left, right, down, fall and rotate – this could be done with five push-buttons – or just one small component [with a] 5-way navigation switch. For the enclosure I used an old plastic box, but any kind of box [will do],” Zola continued.
“After that, I added some sound effects [with] a small speaker 8 Ohm, [as well as] a vibrating motor, which is turned on for each completed line in the game. I also [included] a bar LED display to show the actual level of the game and another one to [display countdown info for the next level].”
On the software side, Zola employed a variation of Valentin Ivanov’s Tetris algorithm with a number of logic modifications to solve a specific memory allocation issue.
“You can create your own version, and add extras features like background music, or an alpha-numeric segment display to show the next coming piece in the game,” Zola concluded.
Interested in learning more? You can check out Zola’s lab page here.