Electronic Game - Four in a Row
by PabloPaez07 in Circuits > Arduino
13457 Views, 204 Favorites, 0 Comments
Electronic Game - Four in a Row
Link GitHub with files needed to make
This project was created by Cristhian López Reyes, Luis Miguel Campos García and Juan Pablo Páez Guerrero, students of 'Creative Electronics', a Beng Electronics Engineering module at the University of Málaga, School of Telecommunications.
We would like to introduce you our electronic 4 in a row project which is controlled by Arduino, based on NeoPixel library from the Adafruit company.
As we consider it is a fun and dynamic idea for both adults and children, it was chosen by our team. Best of all, you can build the project on your own, autonomously.
What is more, materials can be changed. All in all, others materials can be chosen in case if 3D printing is not an option.
Supplies
15 Buttons
84 LEDs which are compatible with Neopixel library
Arduino
Cables
Nuts and bolts
Paint
Power supply 15W
Pre-drilled PCB Soldering iron, tin and flux
Transistors NPN
Wood
Sofware
1) Download and install Arduino Software. Download link:: Arduino
2) Adding Neopixels Adafruit library:
- Go to Sketch->include library->manage libraries...
- Search and install Adafruit NeoPixel
3) Download the program file from the following link: link
The file contains explanations about the functions used for the 4 in a row game.
3D Modelling
Three different types of parts will be created, each one with its own functionality.
The files are upload to GitHub
Sheet part : sheet.gcode
Separator part : separator.gcode
housing part : Face1.gcode and Face2.gcode
The sheet is used to add opacity to the light generated by each LED, thus simulating a game piece.
The separator/spacer is used to isolate the light emitted by each LED.
The housing contains two equal parts which are joined by means of male/female connection fittings..
Wooden Parts
First of all, a wooden box has been made in order to place the circuit inside. It could be also made by using other different materials such as 3D printing.
The top side should have as many holes as the number of buttons it contains. E.g., 7 buttons on each side and an additional hole for the wiring
There should be enough space inside the box in order to place the Arduino, the wiring and the power supply.
Two pieces of 28x7, two of 17x9 cm and, finally, another two of 28x9 cm have been cut. There is also another piece where the LEDs are placed as a support
In relation to the aforementioned, it is worth noting that one of the side pieces has 3 holes: for the power supply, for reprogramming the Arduino (if you need to add any improvements to the program without opening the box) and for a reset button, respectively.
Assembly LEDs and Buttons
84 LEDs will be cut individually
6 LEDs will be soldered in a column with a 3 cm spacing between each LED (the wires are 1.7 cm for this LED model). This process will be repeated to obtain 14 columns (7 on each side). It is important to follow the direction of the LEDs which is marked with an arrow on them.
On each side, 7 columns of LEDs will be placed in ascending direction. The columns are soldered by joining the last LED of the previous column with the first LED of the next column (see figure 2).
It is important to note that the direction of the columns on side 1 is from right to left and the direction on side 2 is from right to left. In this way, when the two sides are joined, the columns will match like a mirror.
To complete the assembly of the housing, we first place the laminate, then the spacer and, finally, the LEDs.
Then, we close the cover by joining the two parts together.
After this process, the buttons will be connected in the following way:
To carry out the following steps, it is important to highlight that the red buttons correspond to player number 1 and the yellow buttons to player number 2.
For the button circuit, 2 NPN transistors will be used. These will act as switches to connect/disconnect the ground path of all red or yellow buttons to prevent them from generating signals in non-corresponding shifts.
To do this, the emitters of the transistors are connected to the same ground point (PIN GND of the Arduino). Next, the base of the transistor controlling the red buttons will be connected to digital pin 10 of the Arduino. Finally, the base of the transistor controlling the yellow buttons to digital pin 11.
One of the pins of each button will be connected to the other (red one side and yellow on the other). The last pin of this connection shall be connected to the collector of the transistor corresponding to its colour. The pins which are not connected to the collector of the transistor shall be connected to each other.
This link will be connected to the digital pins:
Buttons Nº 1 -> Pin 3
Buttons Nº 2 -> Pin 4
Buttons Nº 3-> Pin 5
Buttons Nº 4 -> Pin 6
Buttons Nº 5 -> Pin 7
Buttons Nº 6 -> Pin 8
Buttons Nº 7-> Pin 9
Power Suply
A 15W power supply is used to power the LEDs and the Arduino.
Power supply: green-yellow wire -> GND, blue wire-> Neutral, brown wire -> Phase red wire -> V+, black wire -> V-
This power supply provides us with 5 dC that will be connected to the 5V pin of the Arduino. The V- of the supply will be connected to the GND pin of the Arduino. The LED strip will be connected to its corresponding 5V and GND of the Arduino (which are actually the ones provided by the power supply).
Final Assembly
The base of the box will be attached to the housing where the LEDs are located.
The part where the buttons are placed will be attached to the 3D housing by means of 4 screws and nuts.
Magnets are placed inside the base to attach it to the top and form the structure.
Finally, magnets have been used to facilitate access to the inside of the base for easy maintenance of the system.