This project was for 'Creative Electronics', a Beng Electronics Engineering module at University of Málaga, School of Telecommunications (https://www.uma.es/etsi-de-telecomunicacion/).
Our project consists of the simulation of an arcade machine from the 80s. We have chosen a game that is quite popular nowadays, commonly known as 'stacker'.
The goal of the game is to create a tower that reaches the top. We start by establishing the base of the tower and then we will have blocks moving from one side to the other. The game will be waiting for us to press the button to stack the block on top of the tower formed so far. So if you align it perfectly there will be no problem, but if you don't do it the block will be cut out making it even more difficult.
Step 1: Step 1: Software
To develop our game we had to install the Neopixel libraries, to control the screen, LiquidCrystal (from AdaFruit), wire and TimerOne.
The basic functions are:
Adafruit_NeoPixel matriz = Adafruit_NeoPixel(256, LED_PIN, NEO_GRB + NEO_KHZ800);
- matriz.begin(): Initializes the array
- matriz.clear(): sets all leds to 0. You need a show() to update the array.
- matriz.show(): turns on the leds that have been configured and turns off those that are at 0.
- matriz.setPixelColor( number of the position, R,G,B): configures the box of the assigned color. (R,G,B go from 0 to 255. With 0 being off).
- matriz.setBrightness( BRIGHTNESS ): configures the brightness. A value of 20 is normally sufficient.
You can download the code here.
If you have any questions, leave them in the comments and I will be happy to answer them.
Step 2: Step 2: Hardware - Connection
Here is the connection needed to use the neopixel matrix safely.
In the case of the speaker, it will be sufficient to connect it between any PWM output and ground. In the case of MEGA these outputs are from pin number 2 to 13.
As each button will work by means of interruptions, they will have to be connected to pins 2,3,18,19, which are of the 6 interruptions available on the MEGA board. We will reserve pins 20 and 21 for the LCD screen
For the LCD display we have a microcontroller that requires the VCC, GND, SDA and SCL connections. The last two are located on pins 20 and 21 respectively.
Step 3: Step 3: Hardware - Box
For the elaboration of our box we decided to make it with wood, since we had the resources and tools to do it, however, you can use the material you want, like 3D printing.
First and strategically, we designed the box with large dimensions, with the aim of providing a greater visual impression and have space if we want to expand at some point the box, or we want to add more features.
In this way, we decided to create a structure for the box with wooden slats, compacted together with a nail and silicone gun. The shape we gave to the slatted structure is as follows:
In this way we create our box and give it a structure with holes, these holes are covered with wood sheets, we join them to the structure in the same way, with silicone and a nail gun.
These sheets must be permeable since they will be painted later, and they must have the measurements of the holes left in the box. In the same way, we have divided the back of the box into two parts so that the upper part can be detached from the structure in order to handle the electronic components inside.
On the other hand, the front part of the box has 3 holes to put the cables of the matrix and the control panel is installed, to which the pertinent holes are made for the installation of the components.
The holes in the control panel have been made with a 14 gauge bit, so they are easy to make if you have the tools, as are the holes on the front for the installation of the die.
We also make another incision on the front for the lcd screen and another on the lower back for the connector that will give power to the power supply:
On the other hand, wealso provide the box with a speaker so we make some small incisions on the side and glue the speaker to the box with silicone.
Once the speaker is glued and the holes and installation of the front panel are completed, we proceed to paint the box. In our model we have not painted the front panel but the design is free.
To paint the box we have bought two cans of spray paint, black and silver to make the top line and logo.
Initially we painted the whole box black and then we retouched it with the silver paint, such as the logo, which we obtained from a sheet of paper cutting out the image we wanted to achieve by printing it from the computer.
For the stripe we use tape on the sides to get the paint to only paint the sides we want. Finally, the box would fit the shape:
Step 4: Step 4: Drilled Plate.
The necessary components for the correct operation of the set are included in a drilled plate. The components are the capacitor and resistor mentioned above, as well as the ground and power connections between the power supply, Arduino and the neopixel matrix.