0% found this document useful (0 votes)
31 views13 pages

3D Tetris on 3x3x12 LED Matrix

Uploaded by

baiyabhushan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views13 pages

3D Tetris on 3x3x12 LED Matrix

Uploaded by

baiyabhushan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

3D Tetris on a 3x3x12 LED Matrix

By Max Siebenschläfer in CircuitsElectronics

Introduction: 3D Tetris on a 3x3x12 LED Matrix


Welcome to the 3D Tetris project! This Instructable documents the creation of a 3x3x12 LED matrix
that enables users to play a fully functional 3D Tetris game. The project leverages an ESP32-based
development board (ESPduino) with integrated web server functionality for remote control. You can
also find the project on GitHub.

Project Overview

This project was developed as part of the "Applied Microcontroller Technology" module and
integrates hardware assembly, software programming, and web-based GUI design. Inspired by the
game available at [Link], the system enables interactive gameplay through a wireless web
interface.

Key features include:

1. A custom-built 3x3x12 RGB LED matrix.


2. ESP32 microcontroller for controlling LEDs and hosting a local web server.
3. A responsive web interface for gameplay and real-time interactions.
4. Open-source software written in C, HTML, CSS, and JavaScript.

Features

Hardware

1. ESPduino Controller: Combines the ESP32 Wi-Fi chip with Arduino-compatible GPIO layout.
2. 3x3x12 LED Matrix: Comprised of 108 individually addressable PL9823 RGB LEDs.
3. Custom Housing: 3D-printed for modularity and ease of assembly.
4. Power Supply: Powered via USB-C with an integrated on/off switch.

Software

1. LED Control: Powered by the FastLED library for efficient matrix management.
2. Game Logic: Implements Tetris gameplay mechanics including rotation, collision detection,
and line clearing.
3. Web Interface: HTML/CSS-based GUI hosted via an onboard web server, with multi-language
support.

Gameplay

1. Control Tetrominoes (Tetris blocks) through the GUI.


2. Real-time rendering of blocks on the LED matrix.
3. Score tracking and high-score leaderboard.
4. Adjustable levels and difficulty scaling.
5. High-score table to save and display the top 10 scores.
6. Difficulty selection for custom gameplay experiences.
How It Works

LED Matrix

1. Construction: LEDs are arranged in a 3x3x12 format, connected using PL9823-compatible


drivers.
2. Control: Each LED is addressed individually using a mapped index for 3D coordinates.

Web Interface

1. Languages Supported: English, German, French, Spanish, Italian.


2. Functions:
3. Rotate blocks around X, Y, Z axes.
4. Shift blocks along the XY-plane.
5. Drop blocks into place.
6. Additional Features:
7. Live preview of the next Tetromino.
8. Display of current score and level.
9. High-Score Table: Saves and displays the top 10 scores along with player names. Extra
entries are shown but not stored persistently.
10. Difficulty Selection: Choose between multiple difficulty levels to adjust the gameplay
experience.
Supplies

Components:

1. ESPduino (ESP32-based)
2. Toggle switch
3. USB-C power supply
4. Heat shrink tubing for securing connections
5. Insulated wires for connections
6. 108 PL9823 RGB LEDs
7. Solder wire (preferably lead-free)
8. Insulated wires and welding rods 0.8 for connections
9. 3D-printed alignment guides and 8mm Steel rods
10. 3D-printed components (CAD files provided in NX12 format)
11. Brass inserts with M3 threads (16 in total)
12. M3 screws for assembly (16 in total)
13. Plexiglas sheet for the outer cover
14. Self-tapping screws for the USB-C port

Tools:

1. Soldering station with fine tips

Optional:

1. Counterweight (optional, for added stability)

3D printing:

You should print these parts with an infill of over 15%. Print the case and Plexiglas_holder with brim
and support turned on because otherwise it sometimes starts to lift a bit. You can use PLA to print
all the parts.
Step 1: Assembly Overview
In this section, we will walk you through the step-by-step process of assembling the 3D Tetris
project. The assembly process is divided into the following key stages:

1. Soldering the Circuit: Instructions for connecting the ESPduino, LED matrix, and power
supply.
2. Building the LED Matrix: Detailed steps to construct and test the 3x3x12 LED matrix.
3. Assembling the Case: Guidance on assembling the 3D-printed case and mounting the
components securely.
4. Installation: Configuring the system for first-time use and testing.

Follow these sections in sequence to ensure a smooth and successful assembly process. Each
step is carefully detailed to make replication straightforward and efficient.

Step 2: Soldering the Circuit

Materials Required

1. ESPduino (ESP32-based).
2. Toggle switch.
3. USB-C power supply.
4. Heat shrink tubing for securing connections.
5. Insulated wires for connections.

Wiring Diagram

wiring_diagram

Step-by-Step Guide

1. Connecting the ESPduino

1. Solder the Digital Pin 16 of the ESPduino to the data input of the LED matrix.
2. Connect the 5V and GND lines from the matrix to the ESPduino.

2. Adding a Power Switch

1. Install a toggle switch between the power source and the circuit.
2. Use heat shrink tubing to insulate all connections.

3. Testing the Circuit

1. Upload a simple animation program to the ESPduino.


2. Verify that the entire matrix responds as expected.
3. Check for loose or misaligned connections and fix them if necessary.

Troubleshooting Tips

1. Signal continuity: Verify that the cabel for the Digital Pin 16 is connected to the correct pin
and doesn't have a loose contact
Step 3: Building the LED Matrix

Materials Required

To construct the 3x3x12 LED matrix, you will need the following materials:

1. 108 PL9823 RGB LEDs.


2. Soldering station with fine tips.
3. Solder wire (preferably lead-free).
4. Insulated wires and welding rods for connections.
5. 3D-printed alignment guides and 8mm Steel rods.

Step-by-Step Assembly Guide

1. Testing the LEDs

Before assembly, test each LED to ensure it functions correctly.

1. Use a custom-built tester, connecting each LED to an Arduino and running a test program.
2. Verify that the LEDs light up and change colors correctly.

GitHub(1)

2. Preparing the Matrix Frame

1. Print the alignment guides using the provided 3D models.


2. These guides ensure that all LEDs are positioned accurately for soldering.
3. Insert each LED into the guide, aligning the pins consistently.

GitHub(1)

3. Soldering the LEDs

1. Begin by soldering the power connections:


2. Pin 2 (5V) of each LED should connect to a common power bus.
3. Pin 3 (GND) connects to a ground bus.
4. Use welding rods cut to size for the power and ground rails.
5. Straighten the rods using a drill and vice to ensure clean alignment.
6. Be sure the rods are straight, or your matrix will end up with a bend in it, like you can see in
the picture.

4. Connecting Signal Lines

1. Solder the DIN (digital input) of each LED to the DOUT (digital output) of the previous LED in
the chain.
2. Follow the predefined order to ensure signal continuity.
3. Test connections after completing each layer to catch errors early.
4. GitHub(2)
5. Layer-by-Layer Assembly

1. Build the matrix layer by layer, starting from the bottom.


2. After completing a layer, connect it to the previous one using small jumper wires or rods for
the signal line.
3. Ensure each layer is tested before proceeding to the next.

6. Finalizing the Matrix

1. Once all 12 layers are complete, attach the matrix to its 3D-printed base.
2. Solder the final connections for power, ground, and data lines to the ESPduino.
3. Secure all connections with heat shrink tubing or electrical tape for durability.

GitHub(2)

Troubleshooting Tips

1. Non-functioning LEDs: Double-check connections and test individual LEDs if needed.


2. Signal issues: Ensure proper alignment and avoid crossing wires. Use a multimeter to test
continuity.
3. Structural integrity: Reinforce the matrix with additional supports if necessary to prevent
wobbling.
4. Straighten the rods: Make sure that the rods are properly straightened, so that your Matrix
doesn't get a curved shape.

Tools and References

For further guidance on soldering techniques and matrix assembly, you can consult:

1. The FastLED Library Documentation for programming and troubleshooting LEDs.


2. The video tutorial "Make Your Own SIMPLE 5x5x5 RGB LED Cube" by GreatScott for
inspiration.
Step 4: Assembling the Case

Materials Required

1. 3D-printed components (CAD files provided in NX12 format).


2. Brass inserts with M3 threads (16 in total).
3. M3 screws for assembly.
4. Plexiglas sheet for the outer cover.
5. Self-tapping screws for the USB-C port.
6. Heat-resistant washers (optional, for protecting screw points).
7. Counterweight (optional, for added stability).

Design Overview

The case was designed in NX12 to be compact and easy to 3D print, with minimal contact on the
print bed. It includes:

1. Matrix Holder: Positioned to support the LED matrix during soldering and assembly. Pre-
aligned holes ensure proper orientation of the matrix wires.
2. Main Body: Contains slots for the ESPduino mount, USB-C port, and toggle switch.
3. Plexiglas Cover: Attaches securely to the base with M3 screws.
4. Counterweight Mount: Located at the bottom of the case to prevent tipping.

Step-by-Step Assembly Guide

1. Preparing the Case

1. Print the case components using PLA or a similar material. Ensure all dimensions are
accurate for proper alignment.
2. Insert brass M3-threaded inserts into the designated holes using a soldering iron.
3. 12 inserts are used for securing internal components (e.g., ESPduino mount, Plexiglas cover).
4. 4 additional inserts at the bottom allow for attaching a counterweight.

2. Attaching the Matrix

1. Secure the LED matrix to its holder using M3 screws. Ensure the wires are aligned through the
designated holes in the holder for clean routing.

3. Mounting the ESPduino

1. Attach the ESPduino to its 3D-printed mount and fasten it inside the case.
2. Align the ESPduino’s USB and GPIO ports with the case openings for easy access.

4. Installing the USB-C Port

1. Mount the USB-C port into its designated slot using self-tapping screws.
2. Place heat-resistant washers on the screws to prevent damage to the case.
5. Adding the Toggle Switch

1. Secure the toggle switch in its allocated opening.


2. Connect the switch to the power lines using terminal connectors or soldering. 8

6. Making the Plexiglas cover

1. Adjust the values on the box making side MakerCase. You can see the values in the picture.
Modify the thickness for the kind of plexiglas you are using. Or use the manufacturing files
we provided for 4mm thick plexiglas.
2. Use some clamps and the holder to secure the cover while gluing.
3. 7

7. Finalizing the Case

1. Attach the Plexiglas cover to the main body using M3 screws.


2. Optionally, screw a counterweight into the bottom mounts to enhance stability.

Assembly Order Notes

1. Insert brass inserts before assembling any components.


2. Mount the matrix first, followed by the ESPduino.
3. Install the USB-C port and toggle switch after mounting the main components.
4. Ensure all wires are routed neatly to avoid interference with the case or other parts.

Additional Tips

1. Use thread-locking adhesive on screws to prevent loosening during operation.


2. Test the electrical connections before sealing the case with the Plexiglas cover.
3. For improved aesthetics, sand and paint the 3D-printed parts before assembly.
Step 5: Installation

1. Clone the Repository


2. Open a terminal and run the following command to clone the repository:

git clone [Link]

1. Open the Project in Arduino IDE


2. Navigate to the cloned folder and open the .ino file in the Arduino IDE.
3. Configure the ESP32 Board
4. Go to Tools > Board and select ESP32 Dev Module.
5. Enable PSRAM under Tools > PSRAM.
6. Upload the Sketch
7. Ensure the correct COM port is selected under Tools > Port.
8. Click the Upload button to flash the code onto the ESPduino.
9. Connect to the ESP32's Wi-Fi Network
10. On your computer or mobile device, connect to the Wi-Fi network:
11. SSID: 3D-Tetris
12. Password: 12345678
13. Access the Web Interface
14. Open a web browser and navigate to: [Link]

You can now enjoy 3D Tetris using the interactive web interface!
Step 6: Concluison

Results

The project successfully achieved its primary objectives, delivering:

1. A fully functional 3D Tetris game displayed on a custom 3x3x12 LED matrix.


2. An intuitive and user-friendly web-based control interface.
3. A modular and scalable design, paving the way for future enhancements such as battery
power and improved structural stability.

Check out the GitHub repository to explore the complete code and see the project in action.

This was a challenging but incredibly rewarding experience. I learned so much throughout the
process, from designing hardware to implementing interactive software, and I’m excited to apply
this knowledge to future projects. I hope you enjoy this guide and have fun building your own
version of 3D Tetris! Feel free to share your thoughts or ask questions in the comments—I’d love to
hear your feedback. Thank you for reading!

Future Improvements

While the project meets its initial goals, there are several areas for future enhancement:

1. Reduce Input Latency: Optimize the system to provide smoother and more responsive
gameplay.
2. Enhance Matrix Stability: Reinforce the matrix structure to minimize movement during
transport.
3. Add Battery Support: Implement battery power to make the system portable.
4. Optimize Collision Detection and Rotation Algorithms: Refine the software to eliminate edge-
case errors, ensuring seamless gameplay.

Do Something!

This project is open-source, and contributions are always welcome! Feel free to fork the repository,
suggest improvements, or even create your own version of 3D Tetris. The possibilities are endless!

Acknowledgments

This project was developed by Marvin Heins, Markus Schmidt, and Leonard Holz-Diehl as part of
the "Applied Microcontroller Technology" course. A special thanks to the open-source community
and the developers of the FastLED library for their invaluable tools and inspiration.

You might also like