Tic-Tac-Toe

by FilipOndrej in Circuits > Arduino

2627 Views, 15 Favorites, 0 Comments

Tic-Tac-Toe

image_2021-01-30_195805.png
image_2021-01-30_193634.png
Tic-Tac-Toe Assembly Animation

Hello guys, I would like to share with you my last project. Tic-Tac-Toe Game.

This game is for only two people/players. They are trying to place four squares of their color next to each other. These four squares can put in a row, column, or diagonal.

Supplies

Components:

1x Binary switch
1x DC Jack 5,5mm/2,1mm
?x Wires (signal/servo)
1x OLED 128x64 pixel display
7x Neopixel 6 LED strips
7x Pinhead female 3x1

MAIN PCB:

Arduinos:

2x ATMEGA 328P-AU
2x Quartz crystals
2x Capacitors 100n 0805
2x Capacitors 22p 0805
2x Resistor 1k 1206
2x Chip LED green 0604

ICSPs:

2x Pinhead male 6x1
2x Resistor 1k 1206
2x Chip LED red 0604

LED Array:

3x Pinhead male 7x1
2x Capacitor 1000uF
7x Resistor 220R 1206

Communication:

4x Transistor BC547
8x Resistor 220R 1206

Supply:

1x PCB Terminal block


BUTTON PCB:

4x TACT Microswitches
4x Resistor 10k 1206
1x Pinhead male 6x1

Desciption of the Game

image_2021-01-30_200015.png
Screenshot (11).png
Screenshot (9).png

The display consists of a 7x6 Neopixel LED strip array. The upper row is only for the player to move his square and choose which column they put the square in. Colored squares are falling on top of each other.

The movement of squares in the upper row works by three buttons, placed in the game panel (left, down, right). The down button allows the player to put his square in the column. The fourth button ("new game") is for resetting the whole game/LED strip array to start a new game.

The program communicates with players via an OLED 128x64 pixel display. The display shows the player's turn or player outcome, who won.

Simulation of a Circuit

TinkerCad-TicTacToe.PNG

First of all, we have to simulate a circuit before we create a PCB.

All seven columns are connected parallel because it is faster to load information to a LED strip (array).

All of the Neopixel LED strips are connected to an Arduino pin. The connection is through a 220R resistor. Next to the LED strip outputs is a 1000uF capacitor for the smoother wavelengths.

There are three buttons connected to an Arduino digital pin. The fourth button is for a reset of a game which is connected to an Arduino reset pin. (Not all of the components are included in a simulation.)

PCB Design

Screenshot (12).png
TicTacToe-Schematic.PNG
TicTacToe-Board.PNG
TicTacToe-Buttons-Schematic.PNG
TicTacToe-Buttons-Board.PNG

The whole PCB is designed in Autodesk Eagle 9.1.6

A 5V adapter powers the game.

I added an OLED 128x64 pixel display for a better user interface. Libraries for the display (Adafruit_GFX.h and Adafruit_SSD1306.h) were not compatible with the LED strip library. (Adafruit_NeoPixel.h)

I solved this by adding another Arduino. The main Arduino (with a game and LED strip program) communicates with another Arduino via binary numbers through the 4 transistors.

Program

The program is constantly reloading the LED strip array to move the squares.

The program is always checking if someone has four squares next to each other or diagonally (if someone wins). Right after that, it will send information to another Arduino.

Construction

image_2021-01-30_212926.png

All of the parts were designed in Autodesk Inventor Professional 2020.

The whole construction is printed on a 3D printer. The LED strip array is covered by a white glass pane for better lightning.

I hope you enjoyed my project. Write me down if you have any questions.