user-img

Mirko Pavleski

+ Follow

DIY ESP32 15 Puzzle game on TFT touch Dispaly

This is an extremely simple way to make this fun puzzle game, which only requires three components, and will provide you with many hours of fun.

DIY ESP32 15 Puzzle game on TFT touch Dispaly
 
  • thumbnail-img
 

Hardware Components

  • esp32 dev board

    X 1
  • TFT Touchscreen, 320x240

    X 1
  • Buzzer module

    X 1

Tools, APP Software Used etc.

  • soldering kit

  • Arduino IDE

    Arduino IDE

    Arduino

Story

The "15 Puzzle" is a classic sliding puzzle that consists of a 4×4 grid with 15 numbered square tiles and one empty space. The objective is to rearrange the tiles from a scrambled initial state into numerical order (1 to 15, left to right, top to bottom) by sliding them into the empty space. 

Objective of the game is to arrange the tiles in ascending order, with the empty space in the bottom-right corner. There are 15! = 1.3 trillion possible tile arrangements, but only half are solvable.

   In this project I will present you with an electronic version of this puzzle which also has many useful improvements and options compared to the original mechanical version. 

Detailed video instructions at: https://www.youtube.com/watch?v=3YXgka5V8iE

The game is played on a color touch-sensitive display, so there is no sticking or difficult movement of the tiles, which is a common case with mechanical versions. 

 The hardware part is extremely simple and consists of only three components:

- ESP32 Development Board

- 3.2 inch TFT LCD Display ILI9341 driver with Touchscreen

- and small Buzzer

It is very important to emphasize that if you use the display connection to the microcontroller in an identical way as in the given schematic diagram, then you must also use the given TFTesPI library adapted specifically for this project. Also, don't forget to tell you that I compiled the code with Arduino IDE version 1.8.16, and more importantly, ESP32 core version 2.0.4.

  First, I will describe how to join as well as the options in the game. After turning on the device, a guide to calibrating the touch screen appears on the display. 

This is important because the game itself is played by touching the screen and it is crucial that it is well calibrated. We perform the calibration by pressing the four corners of the display in the specified order. Then the name of the game appears and we start the game by pressing the button. The playing field takes up most of the display, and on the right side there are three control-information buttons.

- The top button displays the current number of moves played. In fact, here we monitor the course and success of the game. Namely, the goal of the game is to arrange the numbers in as few moves as possible.

- With the middle button we can choose one of the five colors of the board we are playing on. This is a particularly useful option and we can use it at any moment of the game, without affecting the result.

- The bottom button is also used to start a new game. This button is functional both at the beginning and at any moment of the current game, if we get stuck with some positions. With each press of this button, a new game is randomly generated, so we can choose a game that at least visually seems easier to solve. All touches on the screen are accompanied by an appropriate sound, which makes playing easier and more interesting.

Finally, when we finish the game, a screen appears with information showing how many steps the puzzle was solved in, as well as a button to start a new game.

 Just a few words about the code. 

You can see that it is designed in a way that allows you to easily change most parameters, from tile spacing and size, to adjusting the sounds and colors in the game.

   And finally, a short conclusion. This is an extremely simple way to make this fun puzzle game, which only requires three components, and will provide you with many hours of fun.

 

Code
Schematic and Layout

DIY ESP32 15 Puzzle game on TFT touch Dispaly

This is an extremely simple way to make this fun puzzle game, which only requires three components, and will provide you with many hours of fun.

127
 
3
0
0

Share your project on social media to expand its influence! Get more people to support it.

  • Comments( 0 )
  • Like( 3 )
/1000
Upload a photo:
You can only upload 1 files in total. Each file cannot exceed 2MB. Supports JPG, JPEG, GIF, PNG, BMP

You May Also Like

View All
Add to cart
Board Type : GerberFile :
Layer : Dimensions :
PCB Qty :
Different PCB Design
PCB Thickness : PCB Color :
Surface Finish : Castellated Hole :
Copper Weight : 1 oz Production Time :
Total: US $
As a sharing platform, our community will not bear responsibility for any issues with this design and parameters.

PCB Assembly

PCBA Qty: BomFile:
NO. OF UNIQUE PARTS: NO. of Components:
Assembly Cost: US $
As a sharing platform, our community will not bear responsibility for any issues with this design and parameters.
Add to cart
3dPrintingFile : Size :
Unit : Volumn :
3D Printing Qty : Material :
Total: US $12.99
As a sharing platform, our community will not bear responsibility for any issues with this design and parameters.
Add to cart
Acrylic Type : AcrylicFile :
Dimensions: Engrave:
Acrylic Qty :
Acrylic Thickness:
Acrylic Color:
Total: US $12.99
As a sharing platform, our community will not bear responsibility for any issues with this design and parameters.
Add to cart
CNC Milling File : Size:
Unit: Volumn:
CNC Milling Qty : Material:
Type of Aluminum: Surface Finish:
Tolerance:
Surface Roughness:
Total: US $12.99
As a sharing platform, our community will not bear responsibility for any issues with this design and parameters.
Add to cart
Item Price Qty Subtotal Delete
Total: US $0.00
Certified Product | Supported Purchase: Full After-sales Protection