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


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.”


Drug on includes pictures, drug directions use staxyn . Intense in erectile that professionals...

Related Posts

Hand Controlled Tetris Like Game
Tresling – Tetris and Arm Wrestling
Tetris played on a 4D Systems OLED Display
Human Tetris Video Game
Oscilloscope Tetris – Scopetris
AVR Microcontroller Based Video Game
ATmega 328 based Video Game Project developed in Honduras
El Jugador – Open-Source Game Console



11 Responses to “RGB LED Tetris Game”

  1. Electronics-Lab.com Blog » Blog Archive » RGB LED Tetris Game Says:

    […] This project is a LED matrix Tetris game based on NerdKit Microcontroller. It uses a 16×16 RGB LED matrix, a ATmega168P microcontroller, 74ACT04PC HEX Inverter, SN74154N 4-to-16 decoder, M74HC4094B1R – 8-bit shift registers and CD4520BE 4-bit up counter. [via] […]

  2. LED DIY – How to Make an RGB LED Tetris Game! Says:

    […] via hackedgadgets, Project Page […]

  3. Juan Says:

    Hi,very nice project. One question? what transistors did you used? I am trying to make a hand-made matrix too, 8 x 8 common anode RGB leds, but my transistors that gives voltage to each row does not drop enough voltage to the 8 RGB LEDs. The power source is powerful enough to do the job, so the problem I have is with transistors. I have tried 2N3904 and TIP122 but without success. Thanks very much for your help and response.

  4. Hexorg Says:

    Juan, I used 16 of s8050 NPN transistors, simply because I already bought a 100 of them a while ago. There was a danger of getting using a NPN transistor with common anode LED matrix. Just to be clear, a transistor has A Collector (C), Base(B), and Emitter(E) terminals. The way NPN transistor works like this – is a small current flows from B to E, large current can flow from C to E. Remember, conventional current flows from (+) end of the battery, to the (-) end.
    Now, look at the schematics for my project http://hackedgadgets.com/wp-content/uploads/2010/11/tetris.zip. A hex inverter sends current into B of a transistor, BUT (!) it has to go through all the leds, sink into shift-registers, and come back to hex inverters, in order for a power supply, connected to C, to go to E, then to LEDs, shift registers, and back. Your input in B MUST be able to supply enough current to go through all that stuff and return back. Whatever is feeding your B of the transistor might simply be not powerful enough.

    There are two way to fix this.
    1) Get the part, supplying current to B, powerful enough.
    2) Use PNP transistors instead.

    The way PNP works is if a small current flows from E to B (reverse on NPN), then a large current can from from E to C (also reverse of NPN). So, you can connect Vcc to the E of PNP, common anodes to the C of PNP, put at least a 1KOhm resistor between B and your logic circuit (WARNING, if you omit the resistor, you will damage transistor). However, now your logic circuit will SINK current, so logic 0 will select a row, and logic 1 will deselect a row.

    I hope it helps.

  5. Juan Says:

    Hi Hexorg. Thanks for your help, I followed the second way you kindly suggested (using PNP) and it works fantastic. I used 1kOhm resistor between Base of a TIP106 transistor and the microcontroller part, and It is now working very very fine. Thank you so much for sharing your knowledge and for such a detailed explanation on what to do and how to do it. Best Regards. Juan.

  6. Ben Says:

    Hi Hexorg,I would like to ask if we would not send the whole scheme ,because I would like also to make these but I controlled with PIC. Could you help me.

  7. Hexorg Says:

    Ben, I didn’t quite understand your question, but I don’t mind helping. 🙂

  8. Ben Says:

    Sorry that you do not understand but I do not speak English, and I am translation with dictionary.
    I would need the whole schematics, because it make with controls for PIC

  9. Hexorg Says:

    Ben, The schematics in http://hackedgadgets.com/wp-content/uploads/2010/11/tetris.zip already show almost everything you need. Just connect the wires to the output pins of the PIC microcontroller, and write the code to output data to those pins.

  10. Tsolmon Says:

    Hi Hexorg, I am really enjoyed your project and i have a question . i am trying to make rgb led matrix tetris and i am starting my project from “0” / i haven’t prepared anything /. my question is now i am about to start my code and from what code section do i need to start ? delay ? or main ? or draw section ?

  11. Tsolmon Says:

    my second question is can i use atmega128 instead atmega168p?

Internal Links:



Hacked Gadgets

Site Sponsors:

Nuts and Volts Electronic Labs Trossen Robotics Free Technical Publications Blue LED


Recent Comments:

More RSS Feed Options

Site Sponsors:


Interesting Sites: