Table of Contents

Tetris Remake with motion controls

Name: Gradinariu Rares-Ioan
Grupa: Fils 1221A

Introduction

My project entails a motion-controlled Tetris game, leveraging an Arduino UNO R3 and other electronic components. My aim is to bring an innovative approach to a classic game and provide an enhanced interactive gaming experience for the user.

My idea stemmed from the desire to introduce a game-changing twist to Tetris and utilize motion control to add an extra dimension of interaction to the game. My inspiration for this project were two distinct gadgets, the fabled Nintendo Power Glove, and the tiny retro-like handheld, Playdate.

I believe that this project can prove valuable for others seeking to improve their programming and electronic engineering skills!

General Overview

My project uses an open-source Tetris game clone code for Arduino, to which I added several changes. The visual part of this project is handled by two MAX7219 LED matrix modules (I2C). The software treats the display like a matrix, and each loop updates the piece's position accordingly to the user inputs and game rules. The Innovative part comes from the input methods. To make it more immersive, the player interacts with a Rotary Encoder. To rotate the piece, the player must rotate the lever upwards, and to speed it up, rotate it downwards as you would pull down the piece. The left and right movement is handled by an MPU6050 3-Axis Accelerometer and Gyroscope Module. The software part for it works directly with its address to assure the smallest input delay(No libraries). In addition, the player can choose to use the classic two-button combo to play the game if he desires it and wants to feel nostalgic. Naturally, the beloved Tetris song, “Korobeiniki”, is also played here, thanks to a passive buzzer.

Hardware Design

My hardware design includes the following:

Software Design

The program for my game was developed using the Arduino IDE. I utilized the following libraries and third-party sources:

The game code is based on the project by Badrinath Murugesan, also known as Electro Oxe. The musical composition for the game was created by Robson Couto.

Within my code, I implemented various algorithms and structures, including:

Motion controls are handled by two distinct functions, calibrate() and tilt_to_button().

  1. calibrate() takes 100 readings at the start of each game to compute the center-reference position. Calibration completion is signaled by a distinct beep, allowing the player to begin moving the console.
  2. tilt_to_button() reads the X and Y coordinates and returns 0 for left, 1 for center, and 2 for right, taking into account a small dead zone to prevent incorrect inputs.

The source code and implemented functions are available in the project files. Links to the open-source projects used in this project are provided in the Bibliography section.

Conclusions

My Arduino project has been an incredible journey filled with nostalgia, creativity, and countless hours of tinkering. I am proud to announce that amidst all the wires, circuits, and a sprinkle of magic, I have successfully recreated my very own version of the legendary DMG 01 Game Boy!

Download

Tetris with motion control - Source Code gradinariu_rares_ioan_1221ea_tetris.txt

My 3D models for the case tetris_case_top_bottom_final_repaired_.rar

Development Journal

I started planning my new project. I want to create a handheld game console that uses motion controls to play games. Started Researching the hardware components and started looking for some ideas online.

I decided to make a Tetris Remake and ordered all the necessary components for my project. I ordered an Arduino UNO R3, a MAX7219 LED matrix module, an MPU6050 accelerometer and gyroscope module, an encoder module, two buttons, and a passive buzzer. I also ordered some wires, resistors, and two mini breadboards for prototyping.

I received all of my components today and spent time organizing them and reading the datasheets. I also started wiring up the components on a breadboard and testing their functionality.

I started coding the software for my handheld console. Encounter some issues with the gyro, more research is needed.

Continued with software development, Implemented some functionality for the Rotary encoder. Made some progress with the gyro functions

I made some significant progress with the software today. I implemented a menu system to start and reset the game, added audio feedback using the passive buzzer, and improved the overall performance of the code. I still need to fine-tune the motion controls and adjust the delay and speed settings. Ended up not using any library for the Gyro as I was getting false positive information. Not reliable for my use-case scenario

Finished the code and tested the game. It works pretty well and is super fun to play. I also had, some friends test it and received positive feedback.

I started working on the 3D model for the case of my handheld console. I'm using Tinkercad to design the case and trying to make it resemble a GameBoy DBG-01. It's challenging to fit all the components inside while keeping the case small.

3D models are ready. I used Autodesk Netfabb, to solve any structural issues and improve the overall quality. I need to print out the design to make a fit test

Printing the case out of PLA. Even though the quality of the print wont be that good, hopefully I can make it work xD

Test fitting the components. The overall quality of the case is good, but given more time and resources, better quality could be achieved. Overall, happy with how it turned out.

Started assembling the project. I make a dedicated PCB with the controls and leave enough space to add a 9V battery later. In order to prevent shorts I add hot glue over connections, thus also securing them in place. The project is coming along pretty well. Most of the pieces fit well together. I group bundles of wires that are close together and bundle them up. Essentially making my own custom connectors (Primitive in appearance but functional. This makes it easier to remove the Arduino if needed).

The project is nearly done.

The project is done. Everything works as expected. Due to the low quality of the PLA used, The screw stand posts broke. So in order to secure the project, electrical tape was used. It looks decent enough.

Bibliografie/Resurse

Export to PDF