Introduction: Arduino Controlled Arcade
In this instructable I will show you how I build my arcade-like structure that is controlled using Arduino and a external laptop.
It will have a few options being left out for you to fill in: the arcade design needs a monitor, which decides how big you need to build the entire frame.
Step 1: Requirements
You will need:
Wires : You will need both male and female ends due to the joystick unit. Male to male together with female to female will work, but male to female will also work. I recommend a lot of different colored ones.
Joystick breakout board DR811
Breadboard 170 pins (A small one) You do not need to solder in this course, but you can refine my design with it.
Microswitch Button 12x12mm (Any color cap)
10k Ohm resistor.
(Old) Monitor. Preferably square.
Wood (or something else you'd build a frame with)
The white frames on the photo are optimial, something like this is handy for your cable management.
Step 2: Setting Up the Arduino Wiring.
The joystick is very basic and wired up like the image showing it. The Key slot has to be put into a number of your pin. In my images both the joystick and button are showed they are put into slot 2. We will not be using the joystick's key (this is for pressing the joystick's button). So I put this into 3 (for if you want to ever do something with that).
The joystick's X and Y will be analog inputs. A0 and A1. Further you have to apply 5v and ground to the Joystick.
The button is a smaller version of https://www.arduino.cc/en/Tutorial/Button
In this course, I have used a smaller breadboard as shown on the image. This will grant you a very small button breadboard you don't need to solder. Be sure to really press the microswitch button into the breadboard, it needs some pressure to cling into it.
The button uses the 3.3v.
Step 3: Scripting Arduino
The script transforms analog and digital together, as this was a bit complex to do on an arduino Uno. On a Arduino Leonardo, it's way easier. Two of my programmer friends | Aroop Roelofs and Robert Popijus have helped me made this possible.
To explain this script : it begins with defining a set of variables.
You will need a baud rate of 9600, this way the arduino can accuratly keep sending inputs to Unity Game engine.
The joystick works with a centerpoint of 512 units (you can imagine these as pixels). We need a X+, a X-, a Y+ and a Y- value. This is why we define 256 on the two axis variables. This way the joystick centers in the exact middle of 512, and a value between -1 and 1 can be returned.
The bottom side below "the actual code" generates a certain combination of words as a single String, which is send to Unity engine.
It wil look like : Xvalue_Yvalue_FiringYes/No
The button will say ft (fire true) to say that the player is firing. Otherwise it will keep saying ff (fire false)
So if you bank the joystick a little bit to the right and press the firing button, the system sends something like 0.53_0_ft
The bottom part is the working engine for this mechanism.
The script can alternatively, be downloaded here https://drive.google.com/open?id=12RjnIP056mBtwwTHkfV98_uyEsxx_I85
Step 4: Building the Arcade Frame
This is a big step and can be different for you than how I did it.
You need to build a wooden frame around the monitor you want to use for the arcade.
Start off with drawing your frame, and get accurate measurements. Measure around your monitor to get the best results. You need to make a askew angled front for your arduino to be placed. I used a little 8 to 9 centimeters sticking out the monitor.
I began with the bottom and then added some side panels on the first picture. I worked with MDF, it's easy wood to build with.
Add the back of your arcade, with MDF you can use screws to keep everything together. I did not use glue, so I can deassemble this frame if I want to upgrade, or repair something later on.
After you added the back, you need to make a platform for your monitor to stand on. Your monitor should stand a bit higher than the bottom of the entire arcade : the bottom is for your arduino construction.
On the top panel, I cut out some cooling-ribs for air to flow, as my monitor is a bit old and it might run hot.
Make some reasonbly big holes in the back, so your monitor's HMDI/VGA and power cable can stick out.
Step 5: Adding Arduino
Your Arduino should be put into the front room that sticks out of your arcade. You need to build two platforms for the joystick and button-breadboard to sit on. I used two beams of wood and sawed them the same angle the front panel goes down. This way your joystick and button will stick out the same way as the entire front panel will do.
The front panel is fairly simple, drill some holes so your joystick and button can stick out. You need a few holes.
A hole for your joystick, one for your button, and a hole for your Arduino's USB cable to stick out. You can leave this last hole and make a battery on your arduino if you'd like. You can also add the last hole on one of the side panels.
The button itself is very low and will not stick outside your front panel. Find a cilinder-object, a lipstick cap. These are usually a fine side for a finger-button. With superglue I filled the cap and glued the top-cap of the button on the stamped paper-filling. Next you can click it back on your breadboard's button.
You can tape both controller units on your block platforms like I did with my breadboard. I found some very thing nails myself and hammered these on the tiny holes that come with the joystick unit. if you ducttape the breadboard on all sides, it will be unable to move combined with the cap-button sticking out of your front panel.
When you feel its done, connect your arduino to the USB cable, add your front panel and screw it all together.
Step 6: Download the Game and Play!
I've made a game you can play right away.
It is downloadable at https://drive.google.com/open?id=1KOdLxV-Pn2jji3O0...
Connect the Arduino USB to your Laptop or PC, and connect the HDMI. When the game window pops up, select "Display 2" which is usually your connected monitor. If use a older monitor and have a newer computer, you might need a VGA to HMDI converter like on the picture.
Play and enjoy!