Arduino WiFi Tetris Clock




Introduction: Arduino WiFi Tetris Clock

About: Hey everyone! My name is Brian and thanks for checking my Instructables. I'm a software developer by trade but I've recently gotten into Arduino development after discovering the esp8266 chip, a WiFi enable…

It’s iconic falling blocks are instantly recognizable to almost anyone, regardless of their interest in video games. But instead of using the blocks to clear lines, we are going to use them to tell time!
This project draws out the digits of a clock using the classic Tetris shapes on a LED Matrix display.

测量大约19cm x 9.5cm,这是非常明亮的物理上很大的展示,因此结果是令人难以置信的眼睛捕捉。

Another twist with this project is, unlike traditional Arduino clock projects, it does not use a RTC module for keeping time, instead the time for the clock is set from the internet. One big advantage of this is that you only need to set your timezone and the clock will automatically display the correct time, it will even adjust for daylight savings.



  • P3 64X32 RGB LED矩阵 -Aliexpress*
  • ESP32开发板 - 亲自我使用ESP32 Dev Kit Mini(Aliexpress* /Amazon*)
  • 5V Power Supply - 4 Amp or larger should do the trick -Aliexpress*
  • 女性杜邦电缆20厘米女性
  • Female Barrel Jack to screw terminal adaptor - Depends on what head is on your power supply
  • 3D printed stands for the LED Matrix - Or something to keep it upright!

* = Affiliate Link

Step 1: The Video


Step 2: LED Matrix Panels

I love these displays! The are a fantastic way of quickly building a really striking arudino project. The intended purpose for these displays is to chained together to make up huge screens as seen at concerts etc, but they can be controlled individually using a microcontroller. The displays come in a lot of different configurations, but I used a 64x32 P3 Matrix for this project.

A display with a resolution of 64 x 32 means it will have 64 LEDs across
and 32 LEDs down. This project is coded to work on 64 x 32 displays, but it could be adapted for other ones if needed.

The "P3" part indicates that the display has a pitch of 3mm. Displays with larger pitches will be physically bigger.

These displays can be driven with lots of different microcontrollers, people commonly use them with Raspberry Pis, but for this project we are going to use an ESP32. An ESP32 is an inexpensive, Arduino compatible, microcontroller with built in WiFi.

The stands are 3d printed and you can find them onthingiverse. They were an existing design I remixed using Tinkercad.


I have made a PCB that makes using these displays really easy! These are not necessary, but they do make them much easier to use.

The original one makes use of PxMatrix library and the new I2S Matrix makes use if the HuB75 DMA library. There is a version of the code for both of them. For more information on the differences between the two libraries, check outthis link.

If you are interested in buying one, I sell them on my tindie store.

If you are based in the UK, Colin Hickey also sells them on his store

Step 4: Wiring Without the Shields

First thing we need to do is connect the power supply up to the wires that came with the display. For this I useda couple of screw terminals and piece of perfboard to make a small board for connecting the power supply to the wires, I was happy with how it turned out!

Adafruit in their learn guides recommend connecting the wire directly to the barrel jack connector as pictured above, but I couldn't get this to make a solid connection (physically), but who am I to question what Adafruit suggest! If you do go down this route make sure to use some insulating tape or heatskrink to give it some strength.

The next thing we need to do is wire up the ESP32 to the matrix panel. The connector that has the arrows moving away from it is "P-In" and the ESP32 will be connected to that, but before we connect that, we need to connect some of the P-in connectors to the P-out connector (the one that the arrows are moving towards). You need to connect the following:

P-in -> P-out
R2 -> R1
G1 -> R2
G2 - > G1
B1 -> G2
B2 -> B1

For the ESP32 you will need to connect the following:

P-in -> ESP32
A - > 19
B -> 23
C - > 18
D -> 5
E -> 15
STB/LAT -> 22
P_OE -> 2
CLK -> 14
R1 -> 13

如果您使用的是Adafruit Feather Huzzah 32,请使用PIN 21用于P_OE,因为它没有2个引脚。


If you are not already setup for programming an ESP32, you will need to do the following

First you will need to download the Arduino IDE from the Arduino website and install it -

接下来,您将need to setup the Arduino IDE to be used with an ESP32. Open the Arduino IDE, go to文件- >首选项并将URL粘贴到附加电路管理器URL中,然后单击“确定”。

Back on the main screen of the Arduino IDE,Tools->Board->Boards Manager当此屏幕打开搜索“ESP32”并安装它时,这可能需要几分钟,具体取决于您的Internet连接。


Step 6: Code Setup

The code for this project is available on Github. To install it:

  • 去吧project's github page.
  • Click the Clone or Download button on the right side of the page and then Download Zip.
  • Extract the zip file.
  • Inside the extracted folder open up the "ESP32 or TinyPICO" folder, then the EzTimeTetrisClockESP32 folder and open the EzTimeTetrisClockESP32.ino file.


  • Tetris Animation by Tobias Blum - handles the tetris style animating of the clock
  • PxMatrix by 2Dom - for controlling the matrix display.
  • EzTime by ropg - used to get the time from the internet.
  • AdafruitGFX by Adafruit - the base library that PxMatrix is built upon.

Details of which versions of the libraries are needed and where to get them are contained up near the top of the sketch.

After installing these libraries you should click the “verify” button (shaped like a tick) on the EzTimeTetrisClockESP32 sketch to make sure that everything compiles fine.

NOTE: If you are using the I2S matrix shield the code for the project在这儿并将要求您安装HUB75 I2S DMA library.


Just below that set your timezone in the format “Europe/Dublin”, a link with full list of possible time zones is a comment in the sketch.

And finally if you are using a different ESP32 board than the TinyPICO you will need to change the wiring. Search for “Generic” in the sketch and uncomment the two lines that you find, and comment out the adjacent lines that contain a “TinyPICO” comment.

当完成配置,upload the code to your ESP32 and you should see it animating in all it’s blocky glory!

Other Adjustments:

There are several adjustments you can make to the clock to so it works exactly as you would like it.
If you would prefer a clock with a 24 hour format, set the十二小时to false.

Theforcerefresh.option controls how many of the digits get drawn every minute. If it is set to真的,整个时钟将被清除,它将再次绘制所有数字。如果设置为false, it will clear only the digits it needs to e.g. if the time was currently “10:29” and it needed to update, only the “2” and the “9” would be replaced, the “10” would remain on screen.

最后,您可以通过改变触发触发的值来调整TETRIS块落下的速度animationTimer. By default in the sketch it’s set to100000, which is 100,000 microseconds, or 0.1 of a second. Reducing this number will make the blocks falling faster. Changing the value to50000将导致动画是快速的两倍。

Once you’ve made those changes, upload the code again and you’ll have the clock working just the way you like. All that’s left to do is to waste away the time watching the blocks fall!

Step 8: Thanks for Reading!


Clocks Speed Challenge

Judges Prize in the
Clocks Speed Challenge

2 People Made This Project!


  • Home Decor Challenge

    Home Decor Challenge
  • Box Challenge

    Box Challenge
  • Toys & Games Contest

    Toys & Games Contest





I tried doing an esp8266 version but it was crashing for me.


Reply 2 days ago

谢谢for the reply.



One of the problems I had with my build was that at night the display is too bright for my bedroom. I modified one of the legs to hold a light dependent resistor and added a simple comparator with hysteresis to dim the display at night.


Reply 11 days ago

Hi! Very nice idea! Could you please share the diagram to understand how did you include the LDR in the original design? I would say, electrically... Mechanically it is clear in the pictures... Thanks



Schematic and PCB of my variant





9 days ago

Please identify which pins are interconnected across the In and Out of the panel.
I will most likely use a different panel.



There is a wiring diagram in the pictures section and the wiring table in the text. Is there something else I can provide?



This is such an awesome build. Thanks for sharing.





Question17 days ago

P3 64X32 RGB LED矩阵 -Aliexpress
several client told that this led panels can't work with ESP8266 and
ESP32 controller, please use raspberry PI controller."



Answer 16 days ago

I can't guarantee that any matrix panel will definitely work, as they have changed them in the past, but I have bought a panel from that link within the last 3 months and it has worked. That message has been there for about 2 years :)