+15,00,000 products in offer

7,000 packages per day

+3,00,000 clients from 150 countries

Quick Buy Favourites
Cart

DIY brick-stacking game using a LED matrix

Date of publication: 28-08-2026 🕒 5 min read

Hardware you need:

1. Introduction

Stacking games are simple and fun to make. In this project, we’ll build one entirely from scratch using an Arduino and a 4-in-1 LED matrix display. The idea is quite straightforward: a block moves back and forth across the screen, and you need to drop it on top of the stack.

The higher you get, the faster it moves. Miss the stack, and the game is over.

The project uses an Arduino Uno, a push button, and a single 4-in-1 LED matrix module driven by the MAX7219 chip. The “brains” of the game are handled entirely in code, and the display is updated in real-time for smooth animation.

2. The 4-in-1 LED matrix

The display we use is made up of four 8×8 LED matrix modules placed vertically. That means instead of a single 8×8 grid, you get a tall 8×32 playing field – perfect for stacking.

Each 8×8 section is driven by a MAX7219 chip, a dedicated LED driver that makes it easy to control a large number of LEDs with just a few Arduino pins. In our case, all four modules are daisy-chained together, meaning we send data into the first module, and it passes along the rest to the others.

Internally, the code treats the display as a grid of pixels where each LED can be turned on or off individually. The library we’re using, MD_MAX72XX, takes care of all the hard work of mapping coordinates to the correct LED in the chain.

One thing to keep in mind: many of these modules are wired in a way that rotates the display 90 degrees compared to how we want to view it.

The ROTATE_DISPLAY flag in the code handles this, ensuring that the stacking gameplay runs vertically instead of horizontally.

Four MAX7219 LED matrix modules stacked vertically on a yellow base, held upright by a hand.

3. Assembly/wiring

Arduino Uno connected to a MAX7219 LED matrix module with jumper wires.

The wiring is minimal. The LED matrix connects to the Arduino via three pins: data, clock, and chip select. The push button is connected to a digital pin with the internal pull-up resistor enabled.

Once powered, the game starts with a single moving block at the bottom of the screen. The block moves left and right automatically. Press the button, and the block stops, becoming part of the stack. The next block appears above it, moving a little faster.

Arduino board wired to a vertical four-module LED matrix display mounted on a yellow base.

4. Code

The core logic revolves around three main ideas:

Block movement: A timer moves the block left or right across the screen. When it hits the edge, it reverses direction.

Stack detection: When you press the button, the game checks which LEDs are directly below the block. Only the parts that are supported remain lit; the rest are lost.

Game speed: Each successful placement speeds up the block, making it harder to time your moves as you get higher.

The display is updated constantly with the current stack and the moving block. The “updateDisplay()” function handles drawing the game state, while “dropBlock()” checks the placement and updates the stack data.

There’s even a test mode you can enable via the serial monitor. This mode lights up one row at a time, making it easy to check if your display is wired and oriented correctly.

Download the code here: LINK

5. How to play the game

Press the reset button or cycle the power to start. The first block appears at the bottom. Press the push button at the right moment to stack it.

The challenge is to line up each new block perfectly with the one below. Any part that overhangs is lost, making the next block narrower.

Continue stacking higher and higher, but be quick – the game speeds up and precision becomes crucial.

If your stack becomes too thin or you miss completely, the game ends with a flashing display.

Press the button again to start fresh and try to beat your previous score.

LED matrix display showing a red stacking-game pattern while a hand operates the push button.

LED matrix display with red LEDs lit along the bottom row as a finger presses the button on the yellow base.

LED matrix display showing a red upward arrow during gameplay, with a finger pressing the control button.

Transfer Multisort Elektronik (TME) is one of the world’s largest global distributors of electronic components, electrotechnical parts, workshop equipment, and industrial automation. The catalog includes over 1,500,000 products from 1,300 leading manufacturers. TME’s modern logistics centers in Łódź and Rzgów (Poland), with a combined area of over 40,000 m², ship nearly 6,000 packages daily to customers in more than 150 countries.

TME also invests in the development of knowledge and skills of young engineers and electronics enthusiasts through the TME Education project, and supports the tech community by organizing the TechMasterEvent series, promoting innovation and experience exchange.

READ ALSO