Ian-Albert.com Contact Me
( Home )-( Misc.)-( Build Your Own PC SNES Controller )
Strip illustration

Planning

Time to do some homework. First, check out the emulators you plan to use this controller with. You can use it for more than just SNES9X. Any emulator (or any game, for that matter) which allows you to configure which keyboard keys you use can be used with this controller. Check which keys are reserved in your emulators. Typically, function keys are used by the emulator for special purposes and cannot be programmed as game keys without conflicts. Other problematic keys include the number keys, ctrl, alt, shift, escape, caps lock, num lock, and scroll lock. It might be a good idea not to use the numeric keypad keys, either, since some games won't differentiate between the top-row numbers and the keypad numbers, or between the regular page up and the keypad page up keys. The idea here is to find a list of all unique, non-problematic keys that we can use for our controller. Typically, this will consist of the regular letter keys, the 2nd through 4th-row punctuation keys, the arrow keys, page up, page down, insert, delete, home, and end. Don't get hung up on where the keys are located physically, since they will all be wired to controller buttons.

Next we have to deduce the wiring of the keyboard. You can think of the wiring in a keyboard as two sets of parallel wires which are perpendicular to one another, so they form a crisscross where the two sets of wires intersect. One layer is suspended slightly above the other. If you push down on a wire in a certain place it will touch a wire on the bottom layer under your finger and current could run from the top wire to the bottom wire. By matching an input wire to an output wire, the keyboard's circuit board is able to know which key was pressed without having to have two whole separate wires for each key. If output wire #6 makes a circuit with input wire #3 then that means that the G key has been pressed (for instance). The keyboard's circuit board should have two sets of pins where the two plastic layers connect. These correspond to input pins and output pins (which is input or output doesn't really matter). The actual layout of these wires is much more convoluted than sets of parallel wires, however. Our job now is to figure out what combination of inputs and outputs produce each keystroke.

There are two ways to do this. One is to plug in the keyboard IC board (without any other parts, just the cord) to a computer and use a wire to connect each input pin to each output pin and see what key shows up on your screen. This is a tedious and overly laborious process, in my opinion, since there are many pin combinations that aren't used at all. A somewhat easier method is to fetch the two plastic sheets with the imprinted circuits on them and trace what contacts are used by each key. I found the easiest way to do this is to trace all the button contact points along one circuit path, then the next. Use the keyboard casing and keys to see which key corresponds to which contact point. If you're real lucky, the plastic sheets will have little symbols printed on them saying what each contact point is. Put together a spread sheet of each key on the keyboard and what combination of pins produces the key. The IC board will often have numbers on the input and output pins (usually on the first and last pin, such as 1 and 18). Use the continuity tester to check your work if you're having trouble tracing the lines on the plastic sheets. This whole mapping process isn't much fun, but very necessary.

Next, we need to pick some good key subsets. The SNES controller has 12 buttons (up, down, left, right, A, B, X, Y, L, R, start, and select), and we've got 15 pins to work with on our D-type connector. That means we can't run a separate line and ground for each button, so we'll have to consolidate. You'll need to pick out several keys that have a pin in common. Twelve of the pins must be used for the buttons, leaving only 3 grounds. That means you want to get three sets of at least 4 keys that all have the same input pin. And this needs to be repeated for as many controllers as you want to make (I told you more controllers would mean more work). Remember to only pick keys that do not conflict with your emulator (no function keys, etc.). The following table shows the set of keys I determined I could use with the keyboard I got (a Compaq of some sort).

D PinButton Controller 1 Controller 2 Controller 3 Controller 4
KeyInOutKeyInOutKeyInOutKeyInOut
1Up~`91Numpad 8103T24G26
2DownInsert101Numpad +123Y34H36
3LeftHome121Numpad 9133]44Quote66
4RightPage Up131Numpad 7143[64Numpad 0106
5YE13D15C17B28
6XR23F25V27N38
7BU33J35M37?68
8AI43K45<47Space78
9StartO53L55>57Right108
10SelectP63;65Enter77Left128
11LW83\75X87Numpad -138
12RQ93S85Z97Down148
13(gnd 1-4)
14(gnd 5-12)
15(unused

There are several things to mention about this table. First, you will obviously have to figure out your own pin/key mappings, since they will vary with every keyboard. Sorry I wasn't able to provide the model of the one I used (it's long been scrapped), however I know it was a Compaq of some sort. Next, you'll noticed I used the numeric keypad and some other oddball keys in my mapping. I only designed my controller to work with SNES9X, and those keys did not cause problems. Choose your keys wisely. I planned for four controllers, but only implemented one. If you plan for one or two controllers you'll have a better selection of keys to choose from and won't have to spread them so thin. Lastly, you'll notice that the direction keys on all four controllers use one ground wire, and the other eight buttons use another ground wire. This was on purpose. With this configuration, each controller is interchangable. All this wiring will take place in the main box. Each controller will be wired the same. That is, on every controller when a connection is made between pins 1 and 13 the box will interpret that as the up button being pressed. The alternative is wiring each controller differently and having to make sure you don't plug them in the wrong ports.

You should also think about which D-type pins you want to assign to what buttons and wires. If you squint really, really hard at the connector you'll see little numbers indicating which pin is which. They are numbered from 1 to 15. Remember that the male and female connectors are mirror images of one another, so the pins go right-to-left on one and left-to-right on the other. How you assign your pins is arbitrary, so pick a system that makes sense to you. As you can see in the table above, I put all the direction keys first, then the buttons, then the two ground wires, leaving the last pin unused.

Congratulations, you've finished the hard brain work. The rest is mindless grunt work, so you can relax your noggin.

Next >>

Recent comments
Be the first to leave a comment!
Contact Me