Step 1: Arduino Arcade Lego Games Box
If you have kids, you are likely facing the same issues as we did with the Lego sets you bought for them. They assemble and play with them but after a while the sets transform into a single pile of bricks. The kids grow up and you don't know what to do with this pile.
We decided to recycle the unwanted Lego bricks and created an arcade game.
This step by step guide is a result of several months of work to make the game repeatable and very low cost. Pretty much anyone could repeat this project! The code has been written in such a way that it doesn't have dependencies and will compile on any Arduino board. And of course the games have been intensively tested by our kids :-)
How is this game different from many others that have been published before?
First of all, there are 5 games built into it:
- Memory Game ("Simon-Says"-like, similar to Touch Me game)
- Reaction game (similar to Whack-a-Mole game)
- Contest/Competition game (for 2-4 players)
- Melody Game (Push and Play free mode for toddlers and smaller ones)
- War game (for 2-4 adults)
Secondly, it has a great design (from our perspective) and can be easily repeated.
And thirdly, it is earth-friendly because it allows you to recycle the plastic.
At the end of this guide there is also a step-by-step video in case you prefer the video format.
Step 2: Parts List
If you like this project but don't have a pile of unwanted Lego bricks, the easiest would be to buy Lego Classic 10704 set with 900 pieces inside.
Here is list of items you will need to create this project:
- 1kg (2lb) of Unwanted Lego bricks (or similar bricks from another brand such as Mega Bloks)
- 25 x 25 cm base plate for Lego (or similar from another brand). Lego base has 32 x 32 dots. If you don't have it - the base costs around 3$ incl. postage if you buy online (search term "32 25 blocks")
- 30 x 30 cm transparent plexiglass piece (5 or 6mm thick)
- 4 x Big Arcade-style 60mm push buttons (I recommend Red, Green, Blue, Yellow) (search term for online stores: "60mm arcade button"). They are the most expensive component of this build at around 2$ each.
- 2 x Momentary push button 16mm radius (I recommend White and Black) (search term: "16mm push button")
- Power On/Off rocker switch 27x21mm mounting size (I recommend transparent red with 4 pins) (search term: "rocker switch 16a")
- Arduino Nano
- 1602 LCD display and I2C connection module
- 2 x 4ohm 5W speakers, size 30 x 70 mm (you can use any other small ones but the CAD drawing is done for 30x70mm)
- 8 x 6 cm prototype board or a 830 pin breadboard
- 2x18650 rechargeable batteries (can be recycled from the dead laptop battery)
- Double 18650 battery holder (search term: "holder 2 x 18650")
- TP4056 charge controller and discharge protector
- 5V step-up converter (smallest 500mA will do)
- Small stuff: some wires, Mini-USB cable or diy plug, Micro-USB socket on PCB breakout, M3 bolts/nuts/washers, 4 x top cover screws
- Resistors:
- 6 x 100 ohm
- 1 x 1k
- 3 x 10k
Step 3: Building the Box
This is the easiest part of the project that you can delegate to your kids.
Take the Lego 32x32 point baseplate and lay the walls using the recycled parts. You should have around 9 layers in total. We chose light grey color for the base so that the random-color brick walls are the main focus.
No box will be similar. Be creative when you build the layers. Recycle even small parts - they look cool. Also irregular shapes look nice too. Add windows, windscreens from cars, doors and boxes.
The box must have at least one full-size Lego door. This is needed to install the rocker switch in the wall.
Step 4: Making the Top Cover
The top cover is made from 5 or 6 mm plexiglas (transparent acrylic sheet). Download the CAD drawing, put it on USB stick and just go to the nearest CNC shop - they will mill it for you. CAD drawing also includes the rocker switch mounting plate (see pic).
You will need to do some finishing of the top plate. Do the edge beveling with the sand paper and a wooden block. Also drill the holes to mount the speakers and the 1602 display. The 1602 display also requires a small triangle milled on the side of the LCD window in the acrylic sheet (see photo). I did this at half-depth using the rotary tool (dremel) and a small router bit.
Step 5: Add All Components to the Top Cover
Install the big 4 arcade buttons, 2 game change/select buttons, 2 speakers and a 1602 LCD+I2C module.
Everything is fixed with M3 screws + M3 washers and nuts at the back.
Before you install the arcade buttons - remove the LED light holders. You will need to mod them a little - see next step.
Step 6: Modding the LEDs in the Arcade Buttons
These arcade buttons are designed to operate at 12V. They will work with 5V which is the default voltage for this project but they will be too dim. So I removed the LED sockets from arcade buttons, slid out the LED holders and removed the LEDs with resistors. The 460ohm resistors need to be desoldered and replaced with 100ohm. Once done, I assembled everything back and installed the LEDs with holders into the buttons.
Step 7: (optional) Control Button Labels
You might have noticed the labels on the 2 control buttons. Our first version of the build did not have them but I decided to add them when I repeated the build second time.
Both buttons have multiple functions depending on the state of the game. White button starts the selected game or confirms the selection during some of the games. Black button changes the selected game or exits during the game.
To create round labels you need a thin aluminium sheet (max 1mm thick), a hole-saw drill bit, stepped drill bit and letter punches (see pic). First you cut the circle using hole-saw. Then you enlarge the inner diameter with the stepped bit and then you use letter punches to create labels. To make letters more visible, use a permanent black marker (sharpie).
Step 8: Making the Breakout Board
You have two options here. Either to use the breadboard and wire Arduino with cables though the breadboard or to install a small breakout at the back of the LCD panel.
For the first build we used the breadboard (see pic). For the second build we decided to spend more time to create breakout board. The functionality does not change, but there are less wires and the breakout is hidden underneath the LCD panel.
If you opt to go with the breakout board, take the 8x6 prototype board and cut it like shown on the picture. Bigger part will be used for the breakout and smaller for creating power supply.
Solder Arduino Nano onto this proto board.
Step 9: Wiring the Connections
Prepare some cables and wire your setup, switches and connections to Nano according to the diagram.
Ever since I started to use the Ethernet twisted pair cables - I forgot about the headache where to source the wires for my projects. They are different color and are multicore so they don't break easily. The only thing you need to take care of when working with them is that soldering needs to be very fast so that you don't burn the insulation.
Notice on the second pic how the 100ohm resistors are wired for the connections to speakers.
Few notes on connections:
- Black/White Control Buttons are connected from pins D2/3 directly to Ground because Internal Pull-up resistors are used in Nano.
- A4/5 are connected to the I2C SDA/SCL pins. This is needed for the LCD I2C module.
- Speakers must be connected to D10/11 because these pins are PWM enabled.
- It is recommended to add a small copper line as a Ground rail for easier connection of all Ground wires (there will be around 5 of them).
Step 10: Wiring the Buttons
All Arcade Buttons are connected to a single pin A1 through a series of resistors. A1 is setup as Internal Analog Pull-up. This is one of those little-known features of Arduino that helped us to save on number of wires going out to the buttons.
So the setup goes as follows: from A1 to first button through 1k resistor. From button1 to button2 through 10k. From button2 to button3 through 10k and from button3 to button4 through 10k. Each button on "close" state shorts to the Ground. Since there is already Ground on each button for the LED's, the second pin of each switch is connected to the ground from the LED.
Take a look at the diagram to understand the wiring.
At the point, plugging a Mini-USB cable into the Arduino Nano should allow you to play the game after uploading the sketch. All you need is a power supply to make the game portable.
Step 11: Installing the Batteries
I used two recycled 18650 cells from the dead laptop batteries. These are lower capacity ones (around 600mAh) that I didn't want to use for higher load applications. The device doesn't really use that much power so this should be sufficient to run the game for days.
The batteries are installed in a double 18650 battery holder and there is a connector for easy attachment to the power supply.
Step 12: Installing the USB Socket Extender
The game should be able to recharge and upgrade firmware without the disassembly. So I drilled one of the blocks to hide the Micro-USB connector.
To extend the USB from the brick wall to the Arduino Nano, I took a Mini-USB cable and cut away the USB-A end (the big USB connector) and stripped the wires. In my case, the red/black were power and white/green were D+/- connections.
D+/- need to be soldered onto the Micro-USB breakout. The 5V and ground (red/black) need to go through power supply.
Why was the Micro-USB breakout chosen if the Nano uses Mini-USB?
Simply because Micro-USB is everywhere in our households - it is used to charge phones and other devices. So you will be able to charge the game and upgrade the firmware with your phone cable :-)
Step 13: Making the Power Supply
I took the smaller prototype board and soldered right onto it the TP4056 battery charger and protection module and also the 5V booster.
Input into TP4056 goes from the Micro-USB socket. The battery cable is attached to TP4056 pins marked as B+/-. Pins marked as OUT+/- are going into the rocker switch. From the rocker switch the +/- connections go into the 5V booster module and from booster output the red/black wires from the stripped USB cable are connected.
Have a look at the diagram to understand the wiring.
Step 14: Epoxy the Micro USB Breakout
I used some epoxy to fix the Micro-USB breakout in the Lego brick. After it cures, the socket will be sturdier than the ones found in cell phones so the kids will be able to recharge the game and it won't break.
I recommend to use quick-cure epoxy for this part. If you don't have it, add a little more of the hardener to resin and let it sit for a while.
Step 15: Install the Rocker Switch, Connect the Power Harness
This switch is massive. It's designed for 250V mains voltage. But I still used this model because it looks great and fits perfectly into a standard Lego City door. So I inserted the switch into the mounting plate and then fixed the plate on the brick wall using the 2 screws (walls were pre-drilled).
Also the harness could now be finally installed as well as the Micro-USB breakout that was epoxied into the Lego brick.
Notice how some additional bricks were used to attach the components to the base.
Step 16: Closing the Lid
insert the Mini-USB cable into the Arduino Nano that is fixed to the top cover and close the lid.
I predrilled 4 holes in the walls and used 4 screws to fix the top to the box.
Step 17: The Code
First version of the game has been written by me followed by new 4 versions from my friend Alex who added 4 more games and cleaned up the code to perfection. We also used the work of Reyboz for the sounds - the level of sound produced using this code is amazing comparing to what comes by default using the Tone library of Arduino.
As mentioned, the code has been optimized for months after extensive QA testing by the kids and currently we've uploaded version 4 to GitHub.
Latest version of Source Code: https://github.com/LenkaDesign/Arduino-Arcade-Lego-Games-Box
All you need to do is install 1602 I2C LCD library (available within the Arduino IDE library manager) and then upload our code.
First you upload the button-calibration.ino and make a record on a piece of paper of the values each Arcade Button produces. This script will also erase EEPROM so that top scores are reset.
After that you change in Game-Settings.h the values of the buttons that you calibrated and upload the main Lego-Games-Box.ino file and you can start playing (provided you connected everything according to the schematic that was given above).
Note: if you are making this game for kids, please remove in Game-settings.h the last entry from
String GameTitle[] = {"Memory Game", "Reaction Game", "Tournament Game", "Melody Game", "Nuclear War Game"};
This last entry has rules where each player selects enemies and might be too hostile for the kids.
Step 18: Detailed How-To Video
In case you find it easier to watch the video instead of reading instructions, here's the video version of this build.
Step 19: Rules of the Game
Currently there are 5 games implemented. If you have more ideas on games that could be created using this box - please let us know in the comments. I will briefly go over each game explaining the rules and how to play.
Flip the rocker switch on the side to turn on the Lego Arcade Games Box.
All games are accompanied with the sounds from the Mario nostalgic game. At startup you should hear the startup melody of the Mario game.
Once started, you will see on the LCD display the game which is selected now. To change the game, press on the black button.
When decided which game you'd like to play, just hit on the White button to start.
If you wish to exit the game that is already running - you need to press the black button.
At startup you can turn the sounds off (night mode) by pressing the red button.
Memory Game ("Simon-Says"-like, similar to Touch Me game)
The rules are well known and simple. The game shows you a sequence of notes/lights and you need to repeat it. Each time one more tone/light is added to the sequence. The longer you survive, the better your memory is.
It's excellent for training the short-term memory of kids and adults.
Reaction game (similar to Whack-a-Mole game)
You need to be fast enough to hit each button that lights up. The longer you play the faster the buttons are lighting up. This one is great for training reaction of kids and adults.
Contest/Competition game (for 2-4 players)
You are given 5 rounds. Everyone has to hit his button really fast after the signal is given (Coin tune from Mario). Whoever hits the button first wins the round. The number of wins is calculated at the end of 5 rounds and the winner is announced.
Melody Game (Push and Play free mode for toddlers and smaller ones)
This one is excellent for toddlers - it plays alternating tunes when you press and hold a button.
After initial testing with kids we realized that our smaller one who was 1 year old really wants to play but does not understand HOW. The rules of this games are - NO RULES. You can hit any button and it will be producing sounds.
War game (for 2-4 adults)
My friend Alex, who programmed consequent versions of this games box came up with the idea for this game during the Trump/Kim crisis about who's got the bigger nuclear button. The rules need a separate video for explanation (you can find it here and here) but in a nutshell, you select the number of players at the beginning and during each round each person selects his enemy. Once everyone selected his/her enemy, the missiles start flying. The one who has been selected as an enemy has a few moments to hit the button to send the intersection missile and save his/her country. The rounds continue until there is only one country left.
Step 20: Final Result
We are 3 friends who spent the time to build the game for our kids. We really hope you will like the game so much that you will build your own version using these instructions. If you have any questions or suggestions - please post them in the comments.
License: Attribution-NonCommercial-ShareAlike.