Project developed by Zola Lab - Eduardo Zola - www.zolalab.com.br
Tetris using Adafruit Neopixel Matrix
Since I started with arduino, i always wanted to make a game based on this plataform. So one day I thought, why not create an old classic Tetris ? I remember to play it a lot in old times, mainly in windows 3.1 and 95 ages.
So, the first thing i needed to start the project, was to find out a RGB display, push buttons or a small joystick, and an enclosure to attach everything. After some researchs, I found out the Adafruit Neopixel Matrix 8x8, which is very easy to apply because it uses a just a single wire interface and simple handy library. So, I used two matrix of this, which gave me a display of 16 rows and 8 columns of RGB LED (or pixels). For powering, I used a Lithium Ion 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 was to find out a way to control each tetris piece in the game. Moves like left, right, down, fall and rotate, could be done with five push-buttons, Or just one small component named 5-way navigation switch, which can be found easily on ebay. For the enclosure I used an old plastic box which came some headphones, but any kind of box could be used also. After that, to make things a little more funny, I solved to add some sound effects where I used a small speaker 8 Ohm, and also a vibrating motor, which is turned on for each completed line in the game.
I also used a bar led display, to show the actual level of the game, and another one to show how far is needed to reach next level.
This Tetris algorithm is a variation of the source code from Valentin Ivanov. I did some logic modifications, and solved the allocation memory problem.
Here is the component list:
2 x Adafruit NeoPixel Matrix 8x8.
1 x small Vibrating Motor (for completed Lines)
1 x small speaker 8 Ohm
1 x Mini 5-way joystick,
1 x Led bar display
1 x rechargeable battery
1 x usb battery charger
1 x arduino pro
1 x capacitor (for smoothing the neopixel)
You can create your own version, and add extras features like background music, or add an alpha-numeric segment display to show the next coming piece in the game.
Hope you like it !