Introduction: Arduino Based Bi-color LED Matrix Tetris Game

Picture of Arduino Based Bi-color LED Matrix Tetris Game

One of the electronics DIY kit jolliFactory came up with is the Bi-color LED Matrix Driver Module Kit. This module is designed to be chain-able so that you may daisy-chain the modules together to the number of modules you need to suit your project.

The following are some of the projects built using this Bi-color LED Matrix Driver module:

It is amazing to browse through instructables and find projects which may interest and inspire you to embark on the project or ignite new ideas for your project.

Tetris is a tile-matching puzzle video game released in 1984 and it was the hugely successful handheld version for the Game Boy launched in 1989 that established the game as one of the most popular ever.

Just for FUN, we thought we could build a simple Tetris game by daisy-chaining two of the Bi-color LED Matrix Driver modules together driven by an Arduino micro-controller simply by adapting similar projects found at instructables. We searched through the instructables here but did not manage to find any similar Tetris project to work on.

We expand our search to other online sites and managed to find some information which we adapted to build a simple Arduino based Bi-color LED Matrix Tetris game here.

To build this project, basic electronics knowledge with electronics component soldering skill and some knowledge on using the Arduino are required.

You may view the following YouTube video to see what we are building.

Step 1: Building the Bi-color LED Matrix Driver Module

Picture of Building the Bi-color LED Matrix Driver Module

We will be building a two LED Matrix tall Tetris game here driven by an Arduino Nano for this project. We will need two of the Bi-color (Red/Green) LED Matrix Driver Module Kits from jolliFactory. Each of these modules uses two MAX7219 Display Driver ICs to drive a Bi-color LED Matrix. These ICs are excellent because they take a lot of work off the micro-controller and simplify the wiring and logic design.

You can find this Bi-color LED Matrix Driver Module kit from here.

This kit comes with all through-hole components and someone with basic soldering skill should be able to assemble it without much difficulty.

See the following YouTube video on how to assemble the LED Matrix Driver Module Kit:

Step 2: Wiring

Picture of Wiring

After all the LED Matrix Driver Module kits are completed, they are connected together with the Arduino Nano micro-controller as shown in the wiring diagram (LED Matrices not installed for better view).

For the game audio output, we used one 8 ohms 0.5 watt speaker driven directly by one of the Arduino’s digital pins through a 100 ohms resistor. Basic sound tone is used for this project and the low sound volume should be sufficient for a hand-held game with this simple setup.

Four SPST Panel Mount Momentary Push Button Switches are required for the project for navigation and rotation of the Tetris blocks.

Note the use of 10Kohms pull-down resistors on the DATA IN, CLK and LOAD input pins. When power is first applied to the micro-controller or when they are reset, their I/O lines float. The MAX7219 can see this as valid data and display garbage until the micro-controller gains control. The pull-down resistors prevent these problems. To reduce the part count for this project, you may try without the 10Kohms pull-down resistors for the DATA IN and CLK input lines.

Except for the two Bi-color LED Matrix Driver modules and the four push button switches, we hook up the entire circuit on a small piece of perf-board around 60mm x 60mm in size.

Note that there are four PCB mount push buttons on the perf-board in the photo. We initially used them for the game control but after building a simple enclosure for the game, we decided to use four panel mount push buttons instead for better game control. We parallel wired our panel mount push button with the PCB mount push buttons so game control can now be performed using either the PCB or panel mount push buttons.

Edit:For those who do not want to mess around with too much wiring using perf-board, jolliFactory have designed a bare interface PCB board suitable to build this project. If you are using this interface PCB board, do remember to change the speaker output digital pin from D9 to D8 in the sketch downloaded from this instructable to drive the speaker.

You may find our bare interface PCB board at

Step 3: Programming the Arduino Board

The Arduino board needs to be loaded with the Arduino sketch to run the display.

We used Arduino IDE V1.03 for our project. Download the Arduino sketch below for this project.

Download jollifactory_Tetris_V1_1.ino

The Tetris game sketch we have here is very basic without any game levels and scores. You may amend and enhance the sketch.

Note: Having some problems with your Bi-color LED Matrix Display modules? Download the following test program to test each of your modules separately. The display should light up RED, GREEN and ORANGE in sequence row by row to fill up the entire display repeatedly.

Download jolliFactory_Bi_Color_LED_Matrix_Test_Check.ino

Step 4: Enclosure and Assembly

Picture of Enclosure and Assembly

As this project is simply built for the FUN factor with no intention of using it for long, we did not pay too much attention to build a proper enclosure. However, the enclosure built should enable the player to hand-held the gadget to play quite comfortably.

What we have for the enclosure is a cardboard box backing with a blue tinted acrylic protective front with the game control push button switches mounted. We did not even secure the modules to the enclosure as they fit quite snugly in the enclosure.

We will not delve into the detail on how we build our game enclosure here. The pictures show the various stages of assembling the completed sub-modules together.


筱萱張 made it! (author)2017-06-12

Hello, I would like to ask two points after the matrix, the synchronization ran out of the box (pictured), which side is wrong?

mibarnett (author)2017-04-19

I'm trying to connect 3 or more LED matrices to add on

It seems to skip one Matrix and moves on to another, even when you define the number

is there something that I need to do to amend the code to work with 4 matrices in series?

Juan CarlosD22 (author)2017-04-10

Hola, gracias por este post muy bueno, logré hacerlo pero no me funciona bien, a ver si pueden ayudarme
Use 2 matriz 8x8 single color, y me aparecen días y las piezas salen de un lateral, gracias por la ayuda

GutierrezC (author)2016-10-30

can we add another lcd for score and highscore?? and game difficulty??

jollifactory (author)GutierrezC2016-10-31

Yes. It should be possible to connect a separate LCD for display. Use a I2C LCD Display for ease of interfacing though it is a bit more expensive. You will need to modify the code yourself to implement score display and game difficulty.

GutierrezC (author)jollifactory2016-11-06

can i use this led matrix?

jollifactory (author)GutierrezC2016-11-07

No. That LED matrix display is a single color display. We are using a bi-color LED matrix display for this project which we are able to make it light up in three colors . You may find online for Tetris games implemented using a single color display or modify our Arduino sketch to work with it. We prefer the bi-color LED matrix display for implementing this game as it makes the game look more interesting.

GutierrezC (author)jollifactory2016-11-06

and what arduino can i use if i don't have arduino nano??

thanks for the answer.

jollifactory (author)GutierrezC2016-11-07

The entry level Arduino UNO should be a good choice. It is very similar to the Nano except for the size.

GutierrezC (author)jollifactory2016-11-04

thank you sir!

Nachitoosss2 (author)2016-11-03

One question, I do not have the bi Matrix color, which would only be having one color, that part of the exchange code, leaving only one color?

GutierrezC (author)2016-10-30

can we add a score and highscore?? and game difficulty??

Trying0ut (author)2016-08-19

How do you actually wire all of them on small piece of board???

jollifactory (author)Trying0ut2016-08-22

We used perf-boards with copper dough-nuts and solder thin wires for point to point connections.

Trying0ut (author)jollifactory2016-08-24

Im currently interested in building this project,however I'm currently getting the error " Programmer is not responding" so im just curious in what "programmer" did you use in the "tool" selection in the arduino program?

jollifactory (author)Trying0ut2016-08-25

Since we are using the Arduino Nano, we do not need any programmer to program our Arduino. If you are using Arduino IDE 1.0.6 for program upload, then under Tools -> Board, simply select Arduino Nano w/ ATmega328 and then upload the program to our Arduino board by selecting File -> Upload.

Trying0ut (author)jollifactory2016-08-28

I've tried to do the steps abovr but i still cant upload it. I've searched around and the usual answers are to check the port in which i cant select it as it was greyed out. I can't even find it in the device managers. Any help? Ive tried all kinds of way to install the drivers and even reinstalling the program

jollifactory (author)Trying0ut2016-08-29

Your problem probably lies with the Arduino board you are using. You may need to check with your Arduino vendor on how to install the driver for your board especially if your Arduino board is a clone.

MatthewG139 made it! (author)2016-08-14

Hi, I made this using Colorduinos and RGB LED Matrices via I2C addressing
Thank you for the tutorial!


jollifactory (author)2016-08-04

Are you using the exact Bi-color LED Matrix modules as in thus project?

Brix JohnP (author)2016-08-04

The two led matrix displays the same output. how to fix the or have any one with a functioning codes?

TimSpins (author)2016-07-28

Finally, problem solved!
I found out it was my bad soldering skills. I forgot to solder one little hole that caused a big problem. Now the game works just fine
Thanks Jolli for such a great idea and coding

jollifactory (author)TimSpins2016-07-28

Glad you managed to find and rectify the fault. This bi-color LED Matrix module is designed to be modular so you may chain them up to form longer displays if your project requires longer displays. Check out our other instructables using this LED Matrix module and also other interesting projects by searching using jollifactory as the search keyword here. Cheers!

TimSpins (author)2016-07-28

Ok I found out the problem
2nd led matrix not working properly

TimSpins (author)2016-07-27


Ive got a problem with my tetris. Ive got 2 led matrices connected but it works only for 1 bottom led matrix, so the game starts in the middle and the top led matrix just stays turned off. Although when I connect Arduino to the pc the top matrix turns on green for a few seconds and then turns off

jollifactory (author)TimSpins2016-07-27

First test each of your modules separately to make sure they are working.

You may go to Step 3: Programming the Arduino Board to download the jolliFactory_Bi_Color_LED_Matrix_Test_Check.ino sketch for testing.

The display should light up RED, GREEN and ORANGE in sequence row by row to fill up the entire display repeatedly.

BTW, did you connect the 10K pull-up resistors?

kostuly (author)2016-07-23

Hello .. Good evening!
I 'm interested in your product , but as I live in Brazil worry about the time , you could say that arrive in less than a month?

jollifactory (author)kostuly2016-07-23

We send the items via SingPost and normally takes 6 to 12 working days for items to be delivered after shipping which should be around 3 weeks.

kostuly (author)2016-07-23

Hello .. Good evening!
I 'm interested in your product , but as I live in Brazil worry about the time , you could say that arrive in less than a month?

kostuly (author)2016-07-23

Hello .. Good evening!
I 'm interested in your product , but as I live in Brazil worry about the time , you could say that arrive in less than a month?

gabrielaguiar-0 (author)2016-07-19

Hello, how are you?

I'm attending the second year of high school with integrated mechatronics and received a proposal from school to set up a project using Arduino, I started researching and I was very interested in the Tetris game. I'm based on your game, but I'm having difficulties in construction.
I saw your KIT (AX7219 Display Driver ICs) and I was interested, but I'm afraid that doesn't arrive on time, since I live in Brazil. I wonder if you could say an estimated time for delivery with and without delay (if the product is stopped because of tariffs, laws, etc.) and would also like to know if you have the design that was used in Bare Bi-color plate LED Matrix Driver Module PCB to provide.


Thanks for your interest in our product. We ship our products via SingPost and it normally takes 6 to 12 working days for delivery baring any unforeseen circumstances. We are sorry we are unable to provide you our PCB design.

Tae WonK (author)2016-05-19

what parts of the code should i delete if i have no speaker connected?

jollifactory (author)Tae WonK2016-05-20

There is no need to delete any part of the code even if no speaker is connected.

If you really would like to clean up the code so as not to use the speaker, then delete the following two routines in the code and any calls to these routines;

1. void TriggerSound()

2. void playTone()

and find the following in the Arduino sketch and delete them;

/* ============================= Audio ============================= */
int speakerOut = 9;

#define mC 1911
#define mC1 1804
#define mD 1703
#define mEb 1607
#define mE 1517
#define mF 1432
#define mF1 1352
#define mG 1276
#define mAb 1204
#define mA 1136
#define mBb 1073
#define mB 1012
#define mc 955
#define mc1 902
#define md 851
#define meb 803
#define me 758
#define mf 716
#define mf1 676
#define mg 638
#define mab 602
#define ma 568
#define mbb 536
#define mb 506

#define mp 0 //pause

// MELODY and TIMING =======================================
// melody[] is an array of notes, accompanied by beats[],
// which sets each note's relative length (higher #, longer note)
int melody[] = {mg};

// note durations: 4 = quarter note, 8 = eighth note, etc.:
int beats[] = {8};

//int MAX_COUNT = sizeof(melody) / 2; // Melody length, for looping.
int MAX_COUNT = sizeof(melody) / sizeof(int); // Melody length, for looping.

// Set overall tempo
long tempo = 20000;
// Set length of pause between notes
int pause = 1000;
// Loop variable to increase Rest length
int rest_count = 100; //<-BLETCHEROUS HACK; See NOTES

// Initialize core variables
int tone_ = 0;
int beat = 0;
long duration = 0;

Kroni (author)2016-03-21

Can someone please explain to me how to do this with 4 single colored max7219 modules? Or how to modify this code... I would really appreciate that.

AlexanderM35 (author)2015-10-13

you suck

djuwert (author)2015-09-12

It works fine but no Sound!

jollifactory (author)djuwert2015-09-13

Just to check -

Did you connect the speaker to digital pin 9?

What type of speaker are you using?

djuwert (author)jollifactory2015-09-14

Yes i did. It is 8Ohm Minispeaker. The Speaker sounds for Test on the Pins to Led-Driver. But on Pin9 is nothing to hear.

jollifactory (author)djuwert2015-09-14

I verified the wiring circuit to be working with my sketch provided here. I am not sure what is wrong with your circuit.

Which Arduino board are you using and did you modify the sketch downloaded here? Did you connect the 100 ohms resistor between pin 9 and the speaker?

djuwert (author)jollifactory2015-09-14

Yes, the 100R Resistor is used. I dont modified the Programm and i use an Arduino Nano Board. The Sound is the only Thing missing.

jollifactory (author)djuwert2015-09-14

For your connection, are you using our bare interface PCB board at

If you are wiring it yourself, you may have to check your connections again.

If you are familiar with Arduino programming, you may change the sketch to output the sound through pin 8 instead and connect your speaker to D8.

luizfna (author)2015-06-18

I have two led matrix module with just one MAX7219 and just one color. Is it possible to build it with this instructions?

jollifactory (author)luizfna2015-06-18

It is not possible to drive 2 single color 8x8 LED Matrix with just one MAX7219 IC. You need one MAX7219 IC for each single color LED Matrix. So you need 4 of these MAX7219 ICs to drive 2 Bi-color 8x8 LED Matrices for this Tetris project.

You may purchase the LED Matrix DIY kit from with generic MAX7219 ICs included.

Fauzan Hussain (author)2015-03-09

awesome idea and coding.
almost done building it but i have a little bit problem here, Ihave 4 max 7219 ics.
can you give me schematic of display driver to make one myself?

Sorry. Just found out I missed your request.

Though not exactly a schematic of the display driver, the block diagram in the link below should help you to make one yourself provided you have the right Bi-color LED Matrix:

jollifactory (author)2014-06-06

This instructable was uploaded on 5 Jun 2014 and I found it was mentioned in an article at atmelcorporation's site 'Celebrating Tetris with Arduino

'. I am surprised to learn that Tetris was programmed by Alexey Pajitnov and the game was released on June 6, 1984 which coincidentally is exactly 30 years ago if I had uploaded it one day later. You may visit to read the article.

Patrick S (author)2014-06-05

So clean looking! That is an awesome platform.

nodcah (author)2014-06-05

Nice 'ible! It seems like something I could play for an hour straight and be okay with it because I built it XD.

About This Instructable




More by jollifactory:IKEA Frame Hack > sLOMO (Slow Motion) FrameJolliCube Audio/Music VisualizerJolliCube (8x8x8 LED Cube) with MD_Cubo library
Add instructable to: