|
Arduino Pro Micro (ATmega32U4 16MHz, 5V) |
x 1 | |
|
Button (standard small Arduino button) |
x 10 | |
|
100 Ohm Resistor |
x 1 | |
|
5mm LED |
x 1 | |
|
90 degree Angle Button |
x 4 | |
|
JOYSTICK |
x 2 |
|
arduino IDEArduino
|
|
|
KiCADKicad
|
|
|
Soldering iron |
Game Controller with Arduino Pro Micro
In this tutorial we’re going to make a DIY game controller similar to an Xbox controller for half the price! Check out the video or scroll past it for the written tutorial!
First, let’s gather all of the materials we’ll need for this project:
The Arduino Pro Micro, which is the smallest Arduino board that has the 32u4 USB chip, which we need to communicate with the computer as a controller.
The Custom Controller PCB, which will hold all of our components together (and looks awesome!).
2 Joysticks, I’m going to use the standard Arduino joysticks but you can also pick up smaller ones and modify the pub design for that.
10 Buttons for the face of the controller: four for the D-Pad, four for the face buttons (A, B, X, and Y), and the menu and back buttons.
4 Angled Buttons for the top of the controller (normally there would be 2 buttons and 2 analog triggers on the top, but we’re just going to use 4 buttons).
A USB Type A-C Cable to connect the Arduino Board to your computer. (You probably already have this.)
A 5mm LED and 100 ohm resistor for a status light. (This is completely optional.)
(The above links are affiliate links, meaning that if you use them, I get a small commission at no extra cost to you. Thanks!)
ALTERNATIVELY, if there are any in stock, you can pick up a kit here:
Why pick up a kit? It's cheaper (because you're only paying for the exact number of materials you need, not bulk packs with extra items) and it helps me keep making tutorials.
Now, let’s use a free software called KiCad to make the schematic and PCB.
This is much easier to show on video as there’s a lot of clicking and dragging stuff around, so I suggest you watch these videos where I’ll show you the step-by-step process of making the schematic and the PCB.
Now that we have our PCB designed, we can go ahead and order our PCB. All you have to do is click ‘Add to Cart’ and you can checkout and get the PCBs manufactured and shipped ASAP.
Keep in mind that the minimum order quantity is 5, so you do have to buy 5 PCBs. I guess you’ll have to make some controllers for your friends as well!
(NOTE: As a PCBWay affiliate I earn a small commission from each order at no extra cost to you. Thanks!)
Now that we’ve got our PCB and all of our components, let’s assemble the controller.
The first thing we have to do is prepare a couple of the components that aren’t quite ready to be dropped into the board.
First, we’ll desolder the joysticks from the PCBs they came on. It’s a bit tricky to avoid melting the plastic in the joystick, but the best process I found is this:
- Pry back the potentiometers from the joystick body and desolder them.
- Cut the bars of the metal casing that go into the PCB so you don’t have to desolder them.
- Desolder the 4 button pins and remove the whole joystick assembly from the PCB.
Next, we have to solder the pin headers onto the Arduino Pro Micro. This is pretty simple, just make sure the pin headers are level, solder the two ends of the pin header in place, and then solder all of the pins in between.
You don’t need to solder on the 2x3 ISP connector pin header, just the two long pin headers on the sides.
Now that all of the components are prepared, we can drop each and every one of them into the PCB and then solder them on.
The only trick is with the buttons, you want to bend the legs of the buttons in a bit so they are the same distance apart as the holes in the PCB. You’ll get a knack for it after one or two.
The rest of it is pretty simple, just make sure you get the components all the way into the PCB and try to get that perfect volcano shape of solder around each pin.
If you want more instruction, check out the video. But be warned, I didn’t follow my own advice on the Arduino Pro Micro, so it ended up a little crooked (with one set of pins not as far into the PCB as the other).
The last thing we need to do is program our controller!
We'll be using the Arduino XInput Libraries (one for the board and one for the code) which will allow us to emulate the functionality of an Xbox controller.
First, you'll need to copy the following URL into the Arduino IDE so it knows where to look for the XInput boards library. Under File>Preferences there's an 'Additional Boards Manager URLs' field:
https://raw.githubusercontent.com/dmadison/ArduinoXInput_Boards/master/package_dmadison_xinput_index.json
Under the Boards Manager you'll want to search for 'XInput' and install the first result. With that installed, you can go to Tools>Board and select XInput AVR Boards>Arduino Micro w/ XInput.
Then you'll want to install this library into the Arduino IDE: https://github.com/dmadison/ArduinoXInput
Check out this video right here for an in-depth walk through or just grab the code below.
Download the code: https://github.com/D4Q2/GameController/blob/main/GameControllerProgram.ino
NOTE: If you didn't watch the video, setting up the Arduino Pro Micro will make you unable to upload code to it normally.
First, you'll have to tick the box 'Show verbose output during compile' to true.
Then when it says it's started uploading, you'll need to manually short between the Reset pin and the Ground pin before it times out. You ONLY have to do this after you've uploaded the program one or more times, so if you just copy and upload the program once, you're fine.
You've finished making a controller with Arduino and now you can play games on your PC with a device you made. Well done!
If you need any help with your project or just want to show it off, join us on Discord: https://discord.gg/jP7hHr65yt
Game Controller with Arduino Pro Micro
*PCBWay community is a sharing platform. We are not responsible for any design issues and parameter issues (board thickness, surface finish, etc.) you choose.
- Comments(1)
- Likes(4)
- Engineer Nov 26,2024
- (DIY) C64iSTANBUL Apr 06,2024
- Daniel Saber C++ Apr 04,2024
- Engineer Mar 06,2024
- 0 USER VOTES
- YOUR VOTE 0.00 0.00
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
More by Daniel Saber C++
-
-
-
kmMiniSchield MIDI I/O - IN/OUT/THROUGH MIDI extension for kmMidiMini
125 0 0 -
DIY Laser Power Meter with Arduino
174 0 2 -
-
-
Box & Bolt, 3D Printed Cardboard Crafting Tools
164 0 2 -