2016/02/09

Keyboard, Assembled!

This post details the final assembly of the keyboard and some details about how it almost didn't work out. I was going to include an explanation of the keyboard layout in a little more detail, but this post got a lot longer than I was expecting, so I'll write about that separately.

The arcade buttons for the keyboard arrived. I ordered them from XGaming because they had a much better price than other sites that I had found, and they were willing to offer a lifetime warranty on their products, which impressed me. They are standard concave arcade buttons, designed to fit into a 28mm or 1-1/8" hole. When I ordered them, they were specified to come with an SPDT (3-terminal) microswitch, and only came in black. What I did not realize is that each 20-pack of buttons came with 18 black buttons and 2 white 1- and 2-player buttons.

Pictures from xgaming.com

At first, I had planned to use two colors of buttons to pattern the keyboard after the piano keyboard, with white and black buttons, but when the site offered only black buttons, I decided that I would try to paint or mark certain buttons instead, so that I didn't have to buy more expensive buttons from elsewhere to get a different color. When I discovered that the player buttons were included, at first I was annoyed because I didn't want the printed buttons and therefore couldn't use them, but then it occurred to me that I could remove the buttons from the housings and use the white housings with black buttons to make markers without printed buttons. As it turned out, I had exactly the right number of white buttons to mark out all of the C buttons with white housings, which appear from the front as white rings around the buttons.

Each white ring marks a C.

There was another problem that wasn't so conveniently solved, though. You may have noticed that I specifically mentioned SPDT switches. For those of you who aren't familiar with the basic function of electronic logic, here's a brief explanation.

You are probably familiar with the concept of computers "running on ones and zeros" or functioning using binary, but you may not entirely understand what that means. Digital electronics use binary logic, which compares inputs that are either 'true' or 'false'. Different types of comparisons can be chained together to process the inputs and produce a useful output, whether that output is turning a light on and off or making a sound or displaying a video game. Here, the output is compressed air being let out in the right place. In any case, the important part is how the signals are compared, and most (if not all) digital electronics function by comparing voltage. An input is compared to a reference (or ground), which is considered to be at 0 volts, and another reference called V+ or Vcc, which is often at 3.3v or 5v depending on the chip. If the voltage between the input and the ground is approximately zero, the input is treated as 'false' or a 0, also referred to as 'low'. If the voltage is closer to V+, the input is treated as 'true' or 1, also known as 'high'. This means that you can't necessarily just connect a switch to turn an input on or off, because if you connect the input pin directly to high, there's nothing that would cause it to change to low once you disconnect it; you have to specifically connect the pin to ground. Otherwise, it just floats around somewhere between high and low and may result in unexpected behavior.

A standard switch as most people think of it is an SPST (single-pole, single-throw) switch, which means that it has two positions and either connects or disconnects a pair of terminals (connection points). In other words, it's either on or off, 'go' or 'stop' along a single path. An SPDT (single-pole, double-throw) switch is more like a switch in a railroad system; it also has two positions, but it has three terminals and connects one 'common' terminal to only one of the other terminals at a time. SPDT switches can be used easily for digital inputs because you can connect the common terminal to an input pin on a chip and connect the other two pins to high and low levels. When the switch is in one position, it will connect to low, and when you flip it, it will connect to high. This allows you to avoid dealing with pull-down resistors and such, which generally just drive up your part count and mess up your PCB routing.

[And now, back to our regularly scheduled programming.]

Left: the expected SPDT switches. Right: wrong.
As I mentioned, I was expecting to receive SPDT switches when I ordered the buttons, because the product photos and dimension drawings showed them, but when I received my order of buttons, most of the switches that came with them were SPST. I sent X-Gaming a support ticket, and they were kind enough to replace them, but I was informed that the 3-terminal switches had been discontinued, so unfortunately I will not be able to order more from them in the future. For the moment, though, I should be set.

1 comment:

  1. Casino Finder (Google Play) Reviews & Demos - Go
    Check how can i find air jordan 18 retro men red Casino 스포츠 토토 중계 Finder (Google Play). A look at 스크릴 some of the best gambling sites in the world. 파워볼 밸런스 사이트 벳무브 They offer 카드 게임 종류 a full game library,

    ReplyDelete