Post Pic

Keyboard Encoders 101: Class is in session

The most technical part of building your own arcade is getting your controls hooked up to your computer. This easiest way to do this is to use a keyboard encoder.
What is a keyboard encoder?
An encoder is basically a circuit with a microchip that will scan its inputs for some type of trigger, in the case [...]

The most technical part of building your own arcade is getting your controls hooked up to your computer. This easiest way to do this is to use a keyboard encoder.

What is a keyboard encoder?

The i-PAC2 from Ultimarc

The i-PAC2 from Ultimarc

An encoder is basically a circuit with a microchip that will scan its inputs for some type of trigger, in the case of our controls the micro switch on the buttons or joysticks, for an on or off state. When the encoder sees an on trigger it will output it to the computer which is seen as a simple keyboard stroke. In the way we will be using it, with emulators and games, it provides an easy way to interface your controls that you have bought by simply going into the configuration of the program and setting the controls to the keys you want. Most of the encoders you find will use the standard keyboard plug, or USB to interface with the computer.

Sound simple enough right? You push a button, it sends it to the encoder, the encoder reads the key you pushed and sends the computer as a keystroke. Well it really is that simple, but there is one thing you really need to worry about.

Ghosting and Blocking

Wait? You said I only had one thing to worry about? Well ghosting and blocking are basically the same thing. To better explain this you have to understand how an encoder works. The most common encoder you can find is in the keyboard that usually comes in with your computer. You know that cheap corded standard 104 key one. The PCB that you find inside works on a matrix. This matrix is made up of a two sets of inputs on the board that when pressed at the same time are interpreted as the keystroke. So when you press the key “S” its see one off of each side of that matrix being pressed. Take a look at the example below. Here we are using a 5×5 matrix to explain ghosting and blocking.

X
1
2
3
4
5
1
A
B
C
D
E
2
F
G
H
I
J
Y
3
K
L
M
N
O
4
P
Q
R
S
T
5
U
V
W
X
Y

So to send the keystroke “A” you have to connect the X1/Y1 in the matrix. Cool. That works fine and dandy as long as your sending one stroke at a time. Now lets say you want to send three at the same time. Lets use A, B, and G for example. When all of those are pressed at the same time your holding down X1,X2,Y1, and Y2. “A” being X1/Y1, “B” being X2/Y1, and “G” being X2/Y2. Well at the same time the encoder is going to see X2/Y2 which is “F”. This is your ghost. A key that you didn’t intend to press but was triggered anyways. Blocking works on this same concept. Instead of adding a key, its not letting one show up. This happens when your pressing a key from one set of matrices and then try to press another key that is being used in the matrix already and gets blocked by the encoder already seeing the  first key being pressed. Ghosting and Blocking are only going to be a problem if you decide to build your own encoder as most commercial encoders already have circuits built to combat against these common problems. They also make gaming keyboard with the same features so that you can press as many keys as you want without any ghosting or blocking of keys.

Now that you know what an encoder is lets take a look at some of your options. At the same time I will list the pro’s and con’s of each, while also pointing out some other information that will be helpful including building your own encoder.

Easy is never your cheapest route

The easiest way is to buy an encoder. Depending where you live you can get an encoder from $30-$100 depending on its features and how many inputs it has. Not only will it save you so much time, they are also more reliable than building your own. As mentioned above most of the encoders that you find will have the ghosting problem taken care of. If your project is on a budget, then this is something you should be a must buy. Why? Reliability is the biggest factor. You want to be able to hook your controls up and not have to worry about them again. Only worry you should have is beating your friend, and not the famous excuse us gamers use when we have no clue how we lost “Somethings wrong with my controller! The buttons not working right!”

I’m going to recommend two keyboard encoders for you. First being the X-Arcade BYOA (Build Your Own Arcade) kit. Lets take a look at its features:

  • Supports 28 Inputs In Any Combination (2 Joysticks + 20 Buttons)
  • Speedstep™ Design Supports 28 Simultaneous Input Presses With Absolutely No Delay
  • Award Winning Electronics Featured In Video Game/Technology Publications Worldwide
  • Fully Programmable Input Assignments In Hardware (PC Only) For Re-Assigning Buttons/Joysticks To Any Input On Keyboard.
  • Programmed Modes Include Memory Storage To Maintain Settings When Unit Is Off
  • 4 Different Memory Mode Settings In Hardware For Saving Button/Joystick Layouts For Various Emulators Or Settings
  • Direct Plug-In For Connectors: No Screwdriver Required
  • Included LED Display Shows On/Off Test Function And Assists In Programming Modes
  • Includes PS/2 Keyboard Pass-Thru Input
  • No Separate Power Required, No Ghosting, No Scanning, No Delays
  • External Connection Via PS/2 Port or USB Port
  • No Limit On USB Simultaneously-Pressed Switches: Full Native On-Board USB Support
  • Compatible With Any Game System (Game Adapters Sold Separately)
  • No Software Or Drivers Needed
  • No Soldering Requied (Easy Installation For Anyone!)
  • Can Be Used With Any Third Party USB or PS/2 Trackball/Spinner
  • Fully Compatible With Any OS, (Mac, Linux, Unix, PC, etc)
  • Fully Seamless Operation And Configuration With MAME/Emulation Software
  • Default Support Provided Both By MAME and Gametap (X-Arcade PCB Support In Both Applications)

The big ones here are the 28 inputs all of which have no delays or ghosting. I would of loved to have tested this unit myself but when I tried it was on backorder. I bought my joysticks & buttons from X-Arcade and love the fact that they offer a lifetime warranty on their products. The encoder is the same one that they use in their award winning TankStick so you know that its made from the best quality on the market.

The second one I’m going to tell you about is the i-PAC from Ultimarc. The company that I actually bought my encoder from. They offer many different models of their encoders. So depending on how many controls you plan on hooking up they probably have something that will work with it. Which is the biggest limit in the X-Arcade BYOA kit. They only offer one model. I went with the i-PAC2 from Ultimarc. Lets look at its features:

  • Fully programmable key code set. Stored even after power off unlike some other interfaces which lose all data when powered off.
  • Dual interface USB or Keyboard – just swap the cable.
  • All joystick/button connections easily made via screw tag strip. Connections marked on the board.
  • Chunky 5mm screw connectors .
  • Self-Test LED gives an instant check of all your wiring. Can indicate which, if any, input has a problem.
  • All button inputs referenced to ground – no need to re-wire separate grounds to each button.
  • Lead plugs into keyboard socket on PC or USB port.
  • Can be programmed using special utilities (for DOS, Windows, Linux, MAC) or without special software, using an interactive method.
  • Using host software, an unlimited number of keycode configurations can be stored and downloaded on-the-fly. Retained on power off.
  • No separate power needed.
  • Does not use a matrix – no ghost keys.
  • Does not use a scanning method which causes a variable delay. Each input has it’s own dedicated connection into the on-board CPU .
  • Fast running interrupt-driven software gives much better response than a standard keyboard controller. Key debounce uses a state method for each key. No delays between keys depressed at the same time. (essential for fighting games).
  • 2 operation modes. Either uses standard MAME keys or you can program your own character set.
  • Shift functions. Holding “Start1″ and pressing other buttons sends a range of codes for MAME functions such as “escape”, “Coin 1″, “tab”, “enter”. This means no extra buttons are needed on the cabinet. In programmable mode any input can be the shift key and all keys can be programmed with a shifted code.
  • Special note for Windows MAME users! Shift key functions mean you can select and start games from the Windows interface without using the keyboard or mouse.
  • Connector for ordinary keyboard which can be used together with the controls if required. No switch-over delays mean you could even play a game using the control panel and keyboard at the same time.
  • Supports selective up/down key repeat in PS/2 mode (all keys repeat in USB mode) to give easy scrolling through lists with minimal CPU overhead and interface “clutter”.
  • No special drivers needed. USB drivers are generic Windows. On many motherboards USB will work in DOS.
  • Fully compatible with all Apple Macs which have USB ports.
  • Supports the Apple Mac “command” key and the Windows “GUI” keys.
  • I-PAC4 and I-PAC2 boards and J-PAC can be paired in any combination to increase the total number of inputs.
  • Keycode programming is integrated directly into many popular front ends for seamless launch of emulator or other applications which require different code sets.

The i-PAC2 offers 32 inputs, 4 more than the BYOA from X-Arcade. No ghosting and no delays. Its default programming is setup right out the box to the controls in MAME. Which makes it setup super easy. Just connect the wires from your micro switches to the encoder and its ready to play MAME. These encoder have been trusted by a number of people with great results. Its for you to decide which one is best for your project.

Pros: Easy Setup. No Ghosting. Easy connections for your micro switches. Reliability.

Cons: Cost money.

What are my other options?

Well luckily for you we are going to go into making your own encoder. Before we get into that lets talk about why you would want to build your own. The only reason you would want to build your own is to save money. But I promise you that the hassle is not worth the few bucks you will be saving. Now let me run another scenario your way. You weren’t cheap and actually bought an encoder but you used all of your inputs but you want to add another joystick or couple of buttons. I wouldn’t suggest building your own encoder for hooking up all your controls, but if you need a few more buttons but can’t justify buying another encoder with 28 inputs when you only need 4 of them then building your own is right up your alley.

The easiest way to get an encoder is from an old keyboard. Most of the times you can find an old keyboard that came with your computer that has one you can use. If you don’t have one then you can usually buy one for a couple bucks off craigslist or garage sale. Odds are you got one. If your anything like me then you don’t throw things like these away. Lets take a look at the Dell keyboard I will be using.

Standard 104-key Keyboard from Dell

Standard 104-key Keyboard from Dell

Cheap standard keyboard that comes with most computers now a days. Take the screws out the back and open it up and you will see this:

Inside the keyboard. Encoder in the top right.

Inside the keyboard. Encoder in the top right.

The part you are most concerned with is the PCB board in the top right. When you unscrew it from the keyboard you will see that it is holding down 3 pieces of clear film with circuits printed out on them. Two of them are separated with another clear sheet with no printing, but holes where the keys can be pressed. So basically when you press a key, it pushes the rubber pad down on the three sheets, thus connecting the two printed sheets where the hole is. The board see the connection and sends the keystroke. Lets take a better look at the PCB and the clear sheets with the circuits:

18x8 matrix and encoder

18x8 matrix and encoder

In this picture you can see I flipped one of the sheets vertically so that it doesn’t lay on top of the other one where you cant see it. The sheet at the top with the encoder has 26 markings, and the bottom has 10. The two at the ends are grounds so lets leave them out of this for a while. The 8 on the bottom that line up with the 26 form a matrix that you need to understand. By taking those 8 away from the top you can conclude that this particular encoder has an 18×8 matrix for a total of 144 inputs. Each key is pressed by completing the circuit between one of the 8 and the other 18. Remember our 5×5 example above? Same thing just a bigger matrix.

This is where ghosting and blocking come in. The idea way to use an encoder like this is not to reuse any of the two matrices at the same time. So by looking at the picture above you could solder 8 wires to the one side of the matrix and only pair them with one of from the other 18 and never have to worry about ghosting or blocking what so ever. Perfect if you only need a few more inputs for your cabinet. That’s not its limits though. Say for example you didn’t want to build a cabinet, just controls to play your favorite games at your computer. You can use more than 8 of the inputs, but any buttons that may be pressed at the same time shouldn’t ghost or block another keystroke through the encoder. Simply put say you use the 8 inputs up for a joystick and 4 buttons. Then decide that you want to add a “Start” button. Well its okay to use an input from one side of the matrix you’ve already used, just make sure that its a key that isnt going to be pushed at the same time as another one. Thus having a chance to block or ghost another key.

The next step is to find out what each combo in the matrix translates to as a keystroke. For this we could open up a note pad and start connecting the matrices and see what they output. We’ll what about the keys that don’t send strokes like ESC, F1-12, Home, Insert, ect. ect.? Luckily there is a great utility that can help you with that. Its called KeyHook. When you run it, it will look like a simple box until you press a key. At which point it tells you which key is being pressed. So by simply using a simple piece of wire you can quickly map out what your matrix is from your PCB.

Now at this point its as easy as soldering wires to the encoder and wiring them up to the micro switches on your controls. Before you solder to the encoder you need to scrape the coating off the board. I used a simple flat head screwdriver to do this. Take a look at the picture below to see the difference between them.

Right side ready to solder

Right side ready to solder

I hope that you have found this information helpful in some way in your journey of building controls for your cabinet. If you have any questions, got lost somewhere, still have no clue of whats going on above don’t be afraid to drop a comment or stop by the forums. We’re here to help you.

4 Responses

07.02.09

Seriously that was awesome can you explain how to solder properly?

Soldering onto that is very difficult. I went through 4 keyboard before giving up and purchasing an Ultimarc Encoder.

Thanks for posting about this, I would love to read more about this topic.

07.02.09

Your CommentsHi.

We are looking for somehow hocking up a button that will tell the programmed key on a keyboard to do several key strokes.

We no that the Logitech G15 keyboard is able to do this by setting up a G key to do several key strokes ( we need 11 strokes )

We also have a keywiz purchased from you that will by the push of a button do a keystroke but it wont allow us to program G keys.

Do you have any idea how to program a keywiz to do this or any one who would.

Or any other device that could be used for this application.

We are going to need at least 9 of these to start with so we need something that we can trial to see if it will work before buying 9 sets of equipment we don’t need.

Thanks David

07.02.09

hi im looking to for keywiz or some that dos the key pad numbers to any know how do that

Leave Your Response

* Name, Email, Comment are Required



Play-Asia.com - Buy Video Games for Consoles and PC - From Japan, Korea and other Regions

Polls

What would you like to see more of?

View Results

Loading ... Loading ...