An ESP32 microcontroller version of Connect4 game, which is played on a 2.8 inch color TFT touch display.
Connect Four is a two-player connection rack game, in which the players choose a color and then take turns dropping colored tokens into a seven-column, six-row vertically suspended grid. The pieces fall straight down, occupying the lowest available space within the column. The objective of the game is to be the first to form a horizontal, vertical, or diagonal line of four of one's own tokens.
This time I will present you an ESP32 microcontroller version of this game, which is played on a color TFT touch display. You can find the original project on Joern Weise GitHub (https://github.com/M3taKn1ght/Blog-Repo/tree/master/4_Gewinnt), and I slightly modified the code by adding some sounds that made the game even more interesting and realistic.
The device is extremely simple to build and contains only a three components:
- ESP32 dev kit microcontroller board
- 2.8 inch TFT touch Dispaly
- and a Buzzer
You can find many great tutorials on the internet on how to install the ESP32 board on the Arduino, as well as upload the code, so we won't explain that part now.
Note that if you use the schematic given in this project, for the device to work properly, we need to install the modified version of the tft-espi library that is provided.
Now let's see how the device works in reality. First, when turning on, the message for calibrating the touch screen appears.
We need to touch the indicated corners to calibrate. After calibration we need to press the Start bitton to start the game.
The first player plays with red tokens and the second with yellow ones.
When the game is over, the winner's color is shown on the display. Now, by pressing the Start button again starts a new game.
The device is built in a suitable box made of PVC board with a thickness of 5mm and covered with a self-adhesive label