Introduction: On the Go Controller

Do you like playing games on your smart phone? Are you tired of gaming with clunky touchscreen controls? Hate forgetting to charge your Bluetooth controller? Need a use for that on the go cable you bought but never use?

Why not make your own on the go controller?

I'm sure I'm pretty late to the game (pun intended) but I've recently discovered my old smartphone was capable of playing retro games via emulation. Growing up, I was a huge fan of the Game Boy systems and have fond memories of playing for hours and straining my eyes on long car rides desperately trying to find a save point before my battery died or the sun was too far beyond the horizon to see my screen. Now I can play on my phone and give into nostalgia but with a nice back-lit screen. Thanks technology!

Disclaimer: Game emulation is a touchy subject and skirts the line of piracy in some cases. Please educate yourselves and play responsibly!

Background:

I decided to pursue this project after making a shortcut keyboard. While learning the arduino keyboard library and coming up with shortcuts I bound some of the test buttons to WASD. It immediately began working with my PC games and that got the wheels turning. Around that same time I ran out of space on my phone for audio books and looked into how to use a USB flash drive with my phone since my model doesn't allow microSD cards. That's when I learned about OTG. OTG utilizes the charge from your phones battery to power the device connected to it. This includes keyboards, mice, and flash drives to name a few. The phone can power 5v devices and guess what the arduino micro requires to operate? It was a match made in heaven.

Supplies

Arduino Micro

Prototype Board

12 x 6mm buttons (I used classic breadboard tactile momentary switches)

Soldering Iron and Solder

3D Printer

On the go (OTG) cable; I made my own

Micro USB charging cable

Step 1: Design

I wanted my controller to be portable and offer all the buttons I would need to play games up to the Super Nintendo era. This meant that I would need 12 buttons. Four for the direction pad (d-pad) and eight for the A, B, X, Y, Start, Select, Left Trigger, and Right Trigger. I also had an additional requirement that I wanted it to be symmetrical so I could play it one handed using either hand. That additional requirement might sound strange but to give some context I have to mention that recently I regularly find myself holding a sleeping baby and only have use of one hand during my limited gaming time.

With the requirements defined I set out to design my controller in CAD. I personally use OnShape but I know many people have success with Fusion360 as well. I'd like to give a quick shout out to the other people on this site that design their own creations. It's hard work! The design I came up with was super simple but still took many hours for me to be satisfied. Even as I'm typing this out I'm noticing many improvements I would like to make.

( I plan to but the .stl files on Thingiverse when time permits. The files will be there so I can update them without having to constantly upload files here. )

Step 2: Print Your Creation!

I have an Ender 3 printer that I've only had for a few months. It's a great printer to get started with if you want to get into 3D printing. I didn't realize how out of whack it was until I measured my parts for this project. Up until this project I had only used it to print minis for tabletop gaming. The minis came out great and I didn't care too much about dimensions. It took several calibration cubes and a new roll of filament before I was happy with the results.

Step 3: Preparing Your Prototype Board

Before soldering buttons to a prototype board I tested all of the buttons on a breadboard and tested my arduino code at the same time. I'll go over the code in a later step.

Now is the best time to cut your prototype board to size. Use your printed controller housing as a guide and dry fit the buttons to make sure everything lines up. I just took some wire snips and cut off the excess board then sanded the edges square with some 150 grit sandpaper.

The wiring for the controller is really straightforward since we are using the arduino micro's internal pull up resistors. All buttons go to an input and ground. The buttons I am using are generic 6mm tactile momentary switches.

Soldering the buttons to the arduino was a fun little puzzle to solve. Some of the buttons were under the arduino and I had to run wires out from under it before soldering the arduino to the prototype board. If you look closely on the button side of the board I missed the left and right for the directional pad.

For my specific design I soldered the up and down directional pad buttons (I missed the left and right directional pad buttons) to the prototype board along with some extra long wires then flipped the board over and soldered the arduino. I don't have a diagram because I mostly soldered the buttons one at a time at random (I might upload one if there is enough interest). After the arduino is secured I flipped the board back over to the button side and soldered the rest of the buttons and their wires.

Step 4: Optional: Spruce Up Your Controller Housing

Before final assembly is a good time to sand, fill gaps, and paint your controller housing. I opted to skip this step for my prototype because I wanted to have something to use immediately. When I inevitably improve my design to something more polished I will give it the pain job it deserves.

Step 5: Final Assembly

Now is the time to put all of your buttons and completed prototype board into the housing. I used #4-24 x 1/2 sheet metal screws for my design. They get the job done but don't fit as well as I would like.

Step 6: Program Your Arduino

You may want to do this step earlier when you are still designing the board or after you have soldered everything to the prototype board. I just like having this in its own section.

The code is very simple relative to most arduino programs I've seen. We only need to assign each button a keyboard value and the arduino will loop through to check what buttons are pressed and send that information to our phone.

For those interested, I use the retroArch app to play my retro games. The keys I used are set to the default keyboard layout used for retroArch.

#include <Bounce2.h><br>#include "Keyboard.h"
#define NUM_BUTTONS 12
const uint8_t BUTTON_PINS[NUM_BUTTONS] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13};
// a = 'x'
// b = 'z'
// x = 's'
// y = 'a'
// left shoulder = 'q'
// right shoulder = 'w'
// select = 'rshift'
// start = 'enter'
// up = 'key:up'
// down = 'key:down'
// left = 'key:left'
// right = 'key:right'
const char BUTTON_KEYS[NUM_BUTTONS] = {KEY_RETURN, KEY_DOWN_ARROW, KEY_UP_ARROW, KEY_LEFT_ARROW, KEY_RIGHT_ARROW, KEY_RIGHT_SHIFT, 'z', 'x','s', 'a', 'q', 'w'};
Bounce * buttons = new Bounce[NUM_BUTTONS];
void setup() {
  for (int i = 0; i < NUM_BUTTONS; i++) {
    buttons[i].attach(BUTTON_PINS[i], INPUT_PULLUP);
    buttons[i].interval(25);
  }
  // initialize control over the keyboard:
  Keyboard.begin();
}
void loop() {
  // check if value changed
  for (int i = 0; i < NUM_BUTTONS; i++) {
    buttons[i].update();
    if (buttons[i].fell()) {
      Keyboard.press(BUTTON_KEYS[i]);
    }
    if (buttons[i].rose()) {
      Keyboard.release(BUTTON_KEYS[i]);
    }
  }
}

Step 7: Play Your Games!

Alternatively, this controller can be used with a PC without the OTG cable to send key presses or macros. I also had a friend that said a controller like this could also be useful for drawing tablets although I have never messed with one before.

I hope you found this Instructable helpful. Below is a lessons learned section for those curious about what I learned during the process and what I would have liked to have done differently.

Step 8: Lessons Learned

CAD:

I have never messed with CAD software much in the past and had to learn on the go with this design. Originally I went with a more upright design that would fit into your hands much like a Wii Nunchuk. My limited knowledge of designing with organic shapes was my downfall. Maybe I should take Intructables up on its CAD design class.

Buttons:

The buttons I used were louder than I would like (especially when you were trying to keep someone from waking up). I'd like to find some quieter buttons. Incorporating springs between the buttons and button caps would go a long way to make the build feel more polished. The buttons have too much slack for my taste.

Soldering:

I am a novice at soldering and don't have very steady hands. Soldering all of those tiny wires all over the place took way longer than I had anticipated. If I had to do it all over again I would definitely map out where my wires would path before grabbing the iron. That would mitigate the errors I discovered after affixing the arduino to the prototype board and would have saved me time.

Games Contest

Participated in the
Games Contest