For making such a game, the master used the following
Tools and materials:
-Potentiometer; -Resistor 1 kOhm; -Resistor 10 kOhm – 4 pcs; -Resistor 100 Ohm – 4 pcs; -Two 18650 batteries; -2-pin battery terminals 10 pcs; -Breadboard; -LCD module; -Red, blue, green, yellow big buttons; -white and black buttons; -Switch; -Micro usb connector; -TP4056 Battery charging controller; -Dual battery compartment; -boost module; -Two speakers – 5 W 4 Ohm; -Arduino Nano;
Step one: top and bottom panels
First you need to cut the bottom and top panels. The master does this on a CNC machine, but you can also cut it by hand. The master made the upper and lower panels from 5 mm acrylic. I cut the side walls from MDF.
Files for cutting can be downloaded below.
When assembling the case, you will need to drill holes in the corners of the acrylic and fix the parts with screws.
< a href = "https://usamodelkina.ru/uploads/posts/2020-12/1608735657_1-12.jpg" rel = "prettyPhoto"> Step two : Arduino , display, buttons and speakers
Next, you need to partially assemble the circuit.
Cut off the breadboard 83 x 37 mm. Drill four 3mm mounting holes.
Solder the Arduino to the breadboard with the mini-usb port facing the right side.
16×2 LCD also serves as a base plate for mounting.
You will need to make a notch in the acrylic for the protrusion on the right side of the LCD.
The connection is standard: 5V, GND, SDA (pin A4) and SCL (pin A5).
The LEDs on these buttons are rather in total, they will have large resistors for operation from 12 V. Remove the LEDs and replace the resistors with other 100 ohms.
Connect the buttons as follows: pin A1 – & gt; 1K resistor – & gt; green button – & gt; 10 kΩ – & gt; black button – & gt; 10 kΩ – & gt; yellow button – & gt; 10 kΩ – & gt; blue button – & gt; 10 kΩ – & gt; red button – & gt; 10 kΩ – & gt; white button.
Solder the negative terminal of each button to the corresponding LED cathode.
Connect the red, blue, yellow and green anodes of the LEDs to pins D5 through D8 of the Arduino respectively.
Mark the white Menu/Scroll button and black Enter button. This can be done either by printing stickers or writing on the panel with a permanent fine marker, or in any other convenient way.
This is the easiest part. The master uses two speakers to provide a more polyphonic sound and also to increase the volume if necessary.
To adjust the volume with a potentiometer, the simplest solution would be: D10 – & gt; speaker – & gt; potentiometer – & gt; speaker – & gt; pin D11. This gives a decent amount of sound without distortion. The Game Box has been operating in this mode for many hours, at low and very high volume levels. Pay attention to setting the potentiometer to ~ 150 Ohm for the first start – not too quiet/too loud.
Step Three: Code
Code divided into several parts: functions, sound, LCD, memory game, reaction game and main game.
The following libraries are needed
https://github.com/bhagman/Tone/(V1.0.0) https : //github.com/fmalpartida/New-LiquidCrystal (V1.5.0)
Arduino Built-in EEPROM Library
To calibrate the buttons, you need to uncomment debug_flag (line # 1 global_functions.h) so that the sketch can communicate over the serial port. Then you need to send “c” (for calibration) through the serial port, press the buttons in turn and save the value.
global_functions.hEyals_arcade.inoresponse_game.htone_functions.hlcd_functions.hmemory_game.h Step four: battery and charge
The power system is really simple. The TP4056 charge controller is connected to two 18650 batteries. It, in turn, is connected to an external micro-usb charging port, as well as a 5V DC boost converter for Arduino and LCD. Hot glue the board to the rear panel.
The battery compartment is screwed to the speaker grill on the rear panel with two M3 x 12 screws with a few large washers.
The master did not find a way to program the Arduino without using its regular mini-usb port, so he cut off the mini-usb cable and soldered the power wires to the boost converter, and the I/O pins directly to the port.
Try the most common cable type, which is can be found (eg USB-C, micro-USB or even Lightning).
Step five: finishing
You can leave the side walls as they are, or you can stick the picture, as the master did.
You're done. The menu controls are as follows:
Press the white button to return to the game menu and scroll through the games.
In the menu, double-click the red (child lock) button to enter the settings menu. Scroll with the white button, save with the black button and return to the game menu, red – “increase”, blue – “decrease”.