Hacked Gadgets Forum

November 7, 2010

RGB LED Tetris Game

at 3:53 pm. Filed under Complex Hacks, Cool Gadgets, DIY Hacks, Electronic Hacks, Game Hacks

rgb-led-tetris-game-_screen_on


Stanislav Ponomarev has been working hard with his NerdKit Microcontroller. He developed an impressive RGB LED Tetris Game. I think this version is probably more fun than the original version. 🙂 I could just imagine scaling this up and playing it on the side of an apartment building with each window acting as a pixel of the game. Stanislav will send in the code and schematics as soon as they are complete.

UPDATE: The code is now available here.

“In image file MainBoard.jpg in top there are ICs from left to right respectively:
3 of “74ACT04PC” – HEX Inverter
“SN74154N” – 4-to-16 decoder
“CD4520BE” – 4-bit up counter
“ATmega168P” – AVR’s microcontroller that came in the NerdKits package, “LM34” a temperature sensor, is connected to Analog-to-digital converter of the microcontroller. On the bottom row are 6 of “M74HC4094B1R” – 8-bit shift registers with latches connected through SPI interface of the microcontroller.

Principle of operation is quite simple. Up-counter is responsible for keeping track of which row is currently being shown, 4-to-16 decoder converts 4-bit binary number from up-counter into 16 different lines. The decoder I have outputs LOW for the current input value, so I had to pass all 16 lines from decoder through the inverters to
transistors, which just allow a higher current get to the LEDs. Without transistors LEDs show much dimmer and the whole row can not show white.

The shift registers are used to sink the current from LEDs, so I need a logical 0 to turn LED on, or 1 to turn it off. To eliminate the need of remembering 0 is on, 1 is off, I simply pass the SPI output from microcontroller through the inverter to the shift register. That solves the problem well and in my code, 1 becomes on, and 0 – off.

The rest is up to the code that I will post in a few days. In it I have a timer that updates the whole image 60 times a second, a double-buffered output with a vertical sync function, and I use temperature sensor reading, and a circuit noise to generate the seed for pseudo-random number generator, which is a must for most games.

I had the screen done a while before I decided to write tetris for it. The hardware + basic code for image output proved to be very useful. I was able to output current temperature reading, Images downloaded through the UART from the computer, and a output of a current time in analog format.”