Greetings and welcome to my tutorial on creating a fightstick using Arduino.
This project is a fightstick created primarily for use with PC and PlayStation 3 and was made for my Rapid Prototyping course at the University Of West GA. The only guideline for the project was that it had to include a physical element and use an arduino chip.
When thinking about what I would want to make I realized that my current fightstick was to large and heavy to take to conventions where I may or may not want to use it. So I thought I could use an arduino to create a smaller, lightweight fightstick.
Overall I greatly enjoyed the process and learned quite a few things about how basic wiring and electronics work. I hope anyone following this tutorial will also enjoy it and learn from it.
Step 1: Buying Your Equipment (Buttons)
For my stick I decided that I wanted a traditional 8 button layout for the main face buttons. I also wanted a start and select button.
The buttons are easily found here: http://www.focusattack.com/controls/pushbutton/by-...
30mm are considered the stranded button size while 24mm are the smaller buttons commonly used as start or select buttons. You will likely want to go with the 30mm size, although I used all 24mm for my project.
Also make sure to pay attention to the connector size. Either .110" or .187" should work fine but you will have to buy different wires based on the connector size. For my project I used .110" exclusively.
Step 2: Buying Your Equipment (JoyStick)
One of the most important part of a fightstick is the stick its self. The stick comes in two parts
- The mechanical parts and the stick. I recommend this: http://www.focusattack.com/sanwa-jlf-tp-8yt-joysti... (This link will also provide you with all the wires you will need for the stick)
- The ball or bat top. My preference is balltop found here http://www.focusattack.com/controls/joysticks/joys...
Something of note that I learned while working on this project is that traditional arcade sticks like the one linked above do not use analog input and instead simply use 4 miro-switches (think buttons being pressed by the stick). these miro-switches tell if the stick is being tilted left, right, down or up.
Step 3: Buying Your Equipment (The Arduino and It's Wires)
Next on the shopping list is the arduino that will read your stick and button inputs. For this I used an Arduino Uno (http://www.amazon.com/arduino-org-A000066-Arduino-....) Any model that has 14 inputs and 2 grounds will work but this tutorial will be for an Uno.
Next is wiring for the Arduino. The arduino uno takes a usb B while most any usb you will want to use will use usb A so you will need to wire accordingly. Also for convince you will likely want to be able to access the aduino's usb port indirectly from outside the box.
I recommend one of these two ways to do this:
- Using a long B to A usb you will need:
- Long usb B to A cable. This will be used to connect to the computer or console (http://www.focusattack.com/10-foot-male-a-b-usb-2-...
- B male to b female. This will connect your arduino to a open port you can put on the outside of your box (http://www.newegg.com/Product/Product.aspx?Item=9S...)
- Using a long A to A usb you will need
- Long A to A usb ( http://www.monoprice.com/product?p_id=5445
Mountable B to A feed-through (http://www.focusattack.com/neutrik-nausb-wb-ab-usb...)
Short A to B usb (http://www.focusattack.com/18-inch-male-a-b-usb-2-...)
In my project I went with approach 1 but in the end the only difference will be the size and shape of the hole you will need to make in your box to house the usb port.
Step 4: Buying Your Equipment (The Rest of the Wires)
While looking at the buttons you may have noticed the 2 pronged plug. This is what will connect to the wires that will connect to the arduino. It is important to know that one is used as the actual input wire, with the other used as a grounding line. Both pongs can do either job so you don't have to worry about which one is which. Also take note the number of grounds on your arduino. The uno only has 3, and one will be used by your joystick, so you will need to daisy chain your grounding wire for at least a majority of your 10 buttons.
This is the list of wires you will need:
- At least 10 .110" quick disconnect wires to connect to the inputs of the buttons (http://www.focusattack.com/16pc-22-awg-wire-with-1...)
- .110" Ground Daisy Chain (10) Wire (http://www.focusattack.com/10-connection-22-awg-11...)
- At least 15 Flexible Breadboard Jumper Wires M/M ( http://www.amazon.com/gp/product/B005TZJ0AM?psc=1&...)
Important Note: If your stick does not come with its own wires as the one in my link did you will need to acquire suitable wires for that as well. This includes 4 wires for the 4 micro-switches as well as 1 extra for the grounding wire.
Step 5: (Optional) Build a Prototype.
Now that you have all of the electronic components you may find it beneficial to make a prototype of your box so you can see how the project will come together when you are finished. In my project I found a $3 cardboard box that was somewhat sturdy but easy to cut through. While this step is optional I recommend it as it will show you what your working with as well as how you should you should go about making your box (especially if you don't just copy this tutorial)
Step 6: Splicing Wires.
This next step is to make all of your wires usable. As you may have noticed the ends of the .110" wires are just stubs that will not be able to plug into your arduino. However the m/m jumper wires will plug into your arduino. To solve this problem you will need to splice these wires together.
For this step you will need:
- Soldering iron
- Wire cutters
If you have never spliced wires before you may want to do some more research about it but here are the basic steps for this project:
- Thread the .110" wire through the heat-shrink.
- cut into the rubber of the .110" wire and remove so that the wire is exposed. Twist the rubber while doing so, so that the wire is twirled and not frayed.
- Cut off one end of the m/m jumper wire and repeat what you did in step one
- Carefully twist the .110" and the jumper wire together. The goal here it to create a twist that will stop the wires from pulling apart.
- Use a soldering iron and solder to coat the splice with a smooth coat of solder. This will add more strength to the splice
- Move the heat shrink over the splice and shrink it by waving a lighter under it (be sure to not burn the wires. Do this by constantly moving the lighter)
- Test your wire with a Ohmmeter by touching the ohmmeter's red and black wires to each ends of your wire. If the ohmmeter reads the resistance as less then 1 you're good.
You will need to repeat this process for all 10 buttons' input wires, the daisy chain ground wire, and the joysticks 4 wires + it's ground wire.
You don't need to worry to much about messing up this step if you purchased the links I've provided in this tutorial because not only will you have more wires then you need but also the .110" wires are much longer then they need to be. Because of this if you mess up you can just cut off more wire and try again from step one. The Exception to this are the wires for the joystick and the grounding wire. As such I recommend saving those until you are comfortable with the process.
Step 7: Programming the Arduino
As for the programming side of things this project is actually fairly simple due to an open source project called UnoJoy. Please visit there Getting started page for a great tutorial on how to start using their code.
Things to note about UnoJoy:
- The folder "UnoJoyArduinoSample" contains code for a full controller, including analog sticks. This is not what we want. In their Examples folder there is code for a BasicFightStick. For my project I used this a starting point however it did not fully suit my purposes so I had to add code for the R1/RB, L1/LB,R2/RT, L2/LT, and select buttons. My code can be found below.
- Be sure to note which pin numbers correspond to witch button.
- The unojoy visualizer never worked for me. However this should not be an issue as you can just as easily go into the windows control panel -> hardware and sound -> Devices and Printers window to see if the controller is recognized. Then right click the controller ->game controller settings->proprieties this window will show you exactly what inputs your arduino is sending out.
- During my project I had to flash the arduino in and out of arduino mode many times and never encountered any issues. Because of this don't be afraid to do this as well if you are needing to make modification to my code.
Step 8: Building a Box
Next you will need to buy/create your final housing for your electronics. There are numerous options for this but below is a guide for my approach.
For my project I was looking for a more portable slant at a fightstick. Because of this I decided to build my box out of composite board with a white board face. This material provides a decent balance of strength and weight. To create the box I had 6 boards and 4 molding pieces cut. Due to a miss-cut and inexperience my boards were 10.5" x 13" x 2", however I would recommend:
- a left and right 2" x 8"
- a front and back 2" x 13"
- a top and bottom 13+" x 8+"
- 4 2" tall molding pieces
- Important note: To create a better box I recommend adding the height of the side panels to your top and bottom panels. That way your top and bottom will extend over the edges of the side panels. In example if your left and right board is 2" x 8" x .5" the you would want to make you top and bottom 14" x 8". Likewise if your front and back board were 2" x 13" x .5" you would want to make your top and bottom 13" x 9".
What you will need:
- A Drill.
- A 1" (for 24mm buttons) or ~1.2" (for 30mm) circular drill bit.
- 2 to 6 bolts with nuts to hold your joystick to the board
- 8 wood screws
- Appropriately sized drill bits for the bolts and the wood screws as well as any bolts or screws needed for your USB mount.
- appropriately sized Philips screwdriver
- ~12/16" circular drill bit
- Wood glue
- Duct tape
- Drill holes into the face plate using the circular drill bit for your 24mm(1") or 30mm(~1.2") buttons.
- Drill one more 1" or ~1.2" hole into your face plate. This will be where your stick will come out of.
- Note: The placement of your stick and buttons are your preference however a set up similar to mine is considered standard.
- Drill 2 to 6 appropriately sized holes near your joystick hole to house the bolts needed to hold the stick in place.
- Glue one piece of molding to the 2 end edges of the left and right panel. Wait overnight for glue to dry fully
- Glue the front and bottom to the outside edges of the molding. Allow glue to dry.
- If done correctly you should have a frame with the molding pieces on the inside corners.
- Plan on the front and back panels to over lap the left and right panels at the corners. This will allow for a smoother corner.
- Place the bottom panel over the frame. Drill a hole through the bottom panel in order to start a pilot hole in the 4 molding pegs that lay in the corners. Place a wood screw in the holes and tighten with screwdriver.
- (Optional) To fill in any cracks/increase strength add glue around the inside bottom edges of the box, allow time to dry.
- At this point Your project should resemble picture 2 shown for this step.
- If any holes remain feel free to plug them with duct tape.
- Drill a hole in the middle of the back panel using the ~12/16". This will be used for the usb port you are using.
- Important Note: This is approximate measurement used for USB method 1 in step 3 and is likely not accurate. You will need to do your own measurements to see what size hole you will need.
- Drill holes near you USB hole to house the screws/bolts need to keep the USB mount in place.
- Flip over the frame and repeat step 5 for the front panel.
Step 9: Final Step: Putting It All Together.
After you box has been made you are ready to thread the wires of the buttons through the holes in the top of the top panel. The button should be able to fit snugly in the hole while having no chance of being pushed through.
Secondly stick the joystick from the bottom of the top panel through its hole then use the holes you made for the bolts to hold it in place. Screw in the ball or bat top into the stick then use a Flathead screwdriver to lock the top in using the metal bit at the base of the stick
Next plug in the arduino to your computer. Make sure it has the correct code loaded, and that it is in the Unojoy "joystick" mode. Then plug all of the pins of all of the buttons and the joystick to their appropriate pin hole in the arduino. If your are unsure of the button layout of a fightstick here is the order of buttons read left to right from top left to bottom right
Important Note: My code its mapped so that it will work with X-input control schemes, However the computer will not recognize the controller as a X-input device. In short this means that for PC games the controller will likely have to be remapped. Luckily, as is the case with Ultra Street Fighter IV there is a controller setting suite that will let you remap any button to anything, including menu navigational buttons.
Lastly, screw in the top panel and your ready to play any fighting game on PC or PS3.
Optional: For most other consoles such as Xbox 360, PS4, and Xbox One there are devices that will let you bypass the authentication process allowing you to use any controller (such as the one you just made). One such device is called the Titan One and can be found here. All you will need is an actual controller for said console and a USB cord. Then plug in the Titan One into the console. Plug the real controller into the Titan One and wait for it to read 0. Then unplug the real controller and plug in your new custom made arduino fightstick.