Let's Make a Game Controller!

125,971

840

97

Introduction: Let's Make a Game Controller!

I love flying games, but it feels like there are never enough buttons on my joystick.

This instructable will show you how to build your own switch panel in no time.

It will work with any game and computer that supports a joystick. I also encourage people to adapt this guide to make foot pedals, joysticks, or other input devices.

What skill level is needed?
This is a great starter project, all the wiring and code is very simple, just repeated for each button.

Out of any project I've done this has had the best ratio of skills needed to reward, so with relatively little effort you will get a great reward.

Step 1: What Will I Need?

Tools

  • Wire snips + thin wire
  • Soldering iron + solder
  • Drill + drill bits
  • Dremel (optional) + safety glasses

Bits

  • A Teensy(or arduino that supports HID)
  • Buttons! Lots of buttons and switches
  • Potentiometers (optional, used for sliders or axis control)
  • LEDs (optional) + equal number 220ohm resistors
  • Perf board
  • Female pin headers (optional, but recommended)
  • Enclosure

Notes:

I used the dremel because I had some square buttons, using just round-base switches is way easier and faster!

The female pin headers are great so you can take the Teensy out and use it for the next project—highly recommended.

You can also use an Arduino instead of the Teensy, just be sure that it supports HID (Human Interface Device), this is a great standard that ensures it'll work easily with any computer.

I found all my buttons and the enclosure at a local hobby electronics shop.

Step 2: Start Laying Out

The quickest way to plan where the switches will go is just draw them on with pencil.

Bonus

I wanted an extra crisp look, so I redrew all my markings on the computer and printed it out.

Then I glued the paper to my case and pasted over it with clear tape, so the oils in my hands don't ruin the paper.

In the end I chose the standard Russian green colour, makes it a bit more fun, and apparently helps reduce eye fatigue for pilots.

Step 3: Manufacture

Next drill out the holes you marked with pencil, or on your printed decal.

(Optional) If some of your buttons are square, you'll have to use a cutting tool.

Test fit everything together, and become eager with anticipation.

Step 4: Electronics

Snip the pin headers to length for each side, then solder them to your board.

Test fit the board and trim if needed. Leave a few pins on each side of the teensy.

The first step of wiring is to attach the ground wire to one of all the button pins, if there are three pins on a button, attach it to the middle one. For the potentiometers attach ground to one of the outside pins, doesn't matter which.

Now is also a good time to glue in the LEDs, if you're using them, and solder the negative pin onto the same ground wire that we used for the buttons. (All round style LEDs have a flat spot that mark the negative side)

Step 5: Wire Buttons

I've included the diagram that comes with each Teensy, it shows each pin number and what they can do.

Button

One side of the button goes to Gnd, the other to a digital pin on the Teensy.

Each button will take up one pin (marked in grey on the diagram), and a few of my 3-position switches will take up two. Keep track of what pin numbers you are using, but it's not necessary to know exactly which button goes to each pin.

LEDs(optional)

With the flat side of the LED attached to ground, the other side will attach to one side of a 220ohm resistor, and the other side of the resistor will attach to a digital pin.

Notes

Some 2-position switches have three pins. With the middle pin attached to ground, choose what side you want to be "on" and attach that to a digital pin on the Teensy.

Step 6: Potentiometers (optional)

It doesn't matter which side gets wired to 3.3v and which to Gnd, but the middle pin must go to an analog input on the Teensy (marked in orange on the diagram from the last step).

Notes

A potentiometer is a variable voltage divider, basically one side gets the whole voltage, the other side gets no voltage, and the pin in the middle gives a reading somewhere between the two.

I used B10K potentiometers.

The B means linear, as in it increases in a straight line when plotted, these are used for digital things. Type A potentiometers are usually used for audio applications and increase exponentially.

10K means 10,000ohm max resistance. This is pretty standard, but because what we're measuring is a ratio most values work fine.

Step 7: Code

First step is to install Arduino if you don't have it and the Teensy plugin for Arduino. It's a quick install and comes with lots of great libraries to play around with.

Now either download and change my code to the number of buttons you have, or try to make your own using the included Teensy examples. If all you have to do is a few buttons, it's super easy.

When you want to upload the sketch, set the board to your Teensy version, and change "USB Type" to "Keyboard + Mouse + Joystick"

Step 8: Testing

Presto!

We now have a joystick input device, but does it work?

If you used some LEDs you can flick some of the switches to turn on the lights, but you might have to change some of the pin numbers in the code to match your controller.

Now either load up a game, or on Windows press "Win + R" to run a command and type in "joy.cpl"

This is Windows' built-in joystick utility, select the "Keyboard/Mouse/Joystick" and press "Properties" now we will see live input from our custom game controller! Exciting stuff.

Step 9: Package It Up

I used some double sided foam tape to hold my board in place, anything works, just be sure the circuit doesn't touch any metal inside your case.

Drill out a hole for your usb connection. Tilting the drill back and forth a bit will help make it wide enough without using a huge bit.

Step 10: Finishing Touches

Because I forgot to get proper LED carriages I quickly printed some little rings to make them look more proper.

I also had some knobs from an old stereo for the potentiometers, but I decided to print off some little knobs that match a cockpit a bit better. Any place that sells potentiometers will also sell the knobs, or make some, or download some from a 3D share hub to print yourself.

One last finishing touch was a carbon-fibre type decal on the side. Not very traditional, but looks cooler than the plain plastic.

Step 11: Rejoice!

It's done. Didn't take too long, did it?

Now load up your favourite video game, bind some keys and get to work flying, ejecting, or firing missiles! Heck even change radio stations or run macros.

Thanks for reading along, and hopefully giving it a go too!

Thoughts:

If I were to take this project a step further, I would probably make my own enclosure. You can use a laser cutter to cut the pieces, holes, and etch the design in painted acrylic, all in one go! That'd be the dream.

Epilog Contest VII

Runner Up in the
Epilog Contest VII

First Time Author Contest

First Prize in the
First Time Author Contest

4 People Made This Project!

Recommendations

  • Toys & Games Contest

    Toys & Games Contest
  • Furniture Contest

    Furniture Contest
  • Colors of the Rainbow Contest

    Colors of the Rainbow Contest

97 Comments

0
Predator FPV
Predator FPV

Question 4 months ago

Hello,
I made one , but I cannot added..?
Regards,
Wojtek

0
Predator FPV
Predator FPV

4 months ago

Hi,

After 5 years...I made one !
This is my version as on additional element of my glider cockpit. Look is may by strange but it works! My own printed box.
I used Teensy 3.2 and your code. Thanks you a lot.
Regards,
Wojtek

IMG_20210129_112234.jpg
0
RacerRex9727
RacerRex9727

7 months ago on Step 11

Thanks for this great writeup. Inspired me to create my own! Is there a limitation on this Teensy library to have 9 axes? Or do I have to rollup and hack my own HID?

0
travershenry
travershenry

Reply 7 months ago

Hey, that's a good question! I definitely have seen examples of people using teensy boards for very many buttons and axes, but they are more involved. If I recall correctly windows has some limitations about the number of axes per device, something like 8. More is possible, but more challenging to get to work reliably as far as I understand.

Could always use two devices for a project as well.

0
minhalraza997
minhalraza997

Question 9 months ago

Hey a question regarding the state of the switches...I made it like yours but say you use a switch for a light or landing gear etc. The problem is you can’t leave it on? Like you have to switch it on then back to off otherwise it keeps registering the input and makes the things in the plane go on off on off on off rapidly

0
travershenry
travershenry

Answer 9 months ago

It sometimes depends on the game, how it can accept input.

If the simulator can accept an input for gear-up AND gear-down, then it is easy to make the switch do one thing in one position and the opposite in the other position. Some games, however, only have a control to toggle the action—to do the opposite of the current state. If this is the case it is often better to use a button to trigger the action as you would with a keyboard key. Alternatively you can make the toggle switch send only one command to the game each time it changes state, but then the position of the switch becomes irrelevant.

Hope that helps, unfortunately it is a limitation of the game sometimes.

0
Zeired
Zeired

Question 11 months ago

So, handful of questions here, especially since I'm an electronics n00b:
1: Is the Perfboard strictly required? It honestly looks a bit superflous. Maybe it's because I'm inexperienced but it felt like you didn't really mention much about it at all and took for granted I'd know what to do with it.
2: If I want an LED light that shows the device is getting power (like a wireless game controller such as the Xbox One controller) is that something done in software or can I wire it right to the 3.3v power pad of the Teensy?

0
travershenry
travershenry

Answer 11 months ago

Hey,
Good question about the perfboard. They come in a few shapes and sizes, some with rows of pads connected—which I remember seemed a bit confusing when I first used one—but they're basically just a more permanent bread board. In this case I used one with no pads connected, put the Teensy pins into the board, soldered the pins I wanted to use, then for each wire I'd put it through a hole next to the pin I wanted to connect it to, then you can solder the two pads together to make the connection. Very easy to understand once you get one in front of you. A lot of people try to get things to work on a breadboard first and then copy the circuit to a perfboard when they know it works, but in this case it's connecting wires to pins 1 to 1 so I skipped the breadboard.

In answer to the LED on indicator, I'd wire it the same exact way as the others get wired, then in the 'setup' of the code, set the pin you wired it to high. That way the light will come on when the microcontroller is working, and not just when it gets power.

Have fun with it!

0
emanlelibuhagiar
emanlelibuhagiar

1 year ago

Nice project! Was wondering if this is still relevant and maybe if there are any things you would change or update today?

0
travershenry
travershenry

Reply 1 year ago

Thanks!
It should still be relevant—a controller made in this way will still work on any computer. There are newer Teensy boards, and there are new Arduino types can be used as HID joysticks, so if you're thinking of building something it may be worth looking at what the newer boards can offer.

0
jsureke
jsureke

Question 1 year ago on Introduction

I'm curious where you got the slant front project box.

0
travershenry
travershenry

Answer 1 year ago

Hey, I bought it from my local electronics shop, but I think if you search for foot pedal enclosure or slanted enclosure you should find some.

0
CadeK
CadeK

Question 2 years ago

This istructable helped me so much in making my helicopter collective for my computer. Eventually I might even venture into a joystick. I have one question though. I used your coding for Arduino and while I'm in game and since I have On/Off switches that are non self centering, I have to push the switch on once to activate, and turning it off doesn't cause another action. For example my engine on will be "Joystick/Keyboard/Mouse Button 1". Is there a way to make it so that when I turn the switch off, the engine will turn off as well? I'll try and post some pictures here soon. I ended up making it out of K'nex that I had from childhood.

0
travershenry
travershenry

Answer 2 years ago

Hey, glad to hear it helped! I'm big into helicopter stuff too, lots of fun, even more with a proper collective.

I think I've done something similar, it just takes a little editing the code.
Basically you would code the position 1 of the switch to send one key press, which you would bind to "Engine On", and then code the position 2 of the switch to send a different key press for "Engine Off".

It depends on what game you're playing, but it's easiest if the game can support two different bindings for on or off.

0
Lucas 1028
Lucas 1028

Reply 2 years ago

Hey there, what exact type of switch did you use for the trim? I noticed they were centred and could go both ways, I have the same issue as CadeK and thought that by using those switches you can bind one way to on and the other to off just like you would bind trim to go one way and then the other. Do you reckon this would work?

0
CadeK
CadeK

Reply 2 years ago

It's Arma 3. I believe that it would support it. What would the code lines look like in arduino for that then? I'm still really green to this haha.

0
Lucas 1028
Lucas 1028

Reply 2 years ago

Hey there CadeK, Have you by chance happened to find a solution to your issue? I wanted to attempt this project for a flight sim and use it as a over head panel but this issue meant I would have to have one switch to turn something on and another to turn it off instead of one for both actions like you had with your engines.
If you managed to make it work could you please let me know?

0
travershenry
travershenry

Reply 2 years ago

Sorry, you'll have to experiment. Unfortunately I don't have my arduino stuff on the computer I'm using these days, so I can't quite say without experimenting a bit myself. :\

If you're interested in this sort of thing, try working with the example files that come with the Arduino program, it's a little bit tricky writing the first few bits of code, but it's such a great skill to develop.

Cheers!

0
Gideont8
Gideont8

Question 2 years ago

I had a spare makey makey board lying around, is there anything wrong with using this board for this project?

0
travershenry
travershenry

Answer 2 years ago

Maybe? I'm not really familiar with the makey makey board, but it looks like it emulates a few keyboard buttons.