When a keyboard or gamepad just won't do. Building a custom control panel.


Still with me?  If so, then hopefully you have your own Raspberry Pi/RetroPie home arcade or console system up and running.  If you are only running console emulations, like Nintendo or Sega, using a gamepad similar to these system may meet your needs just fine.  But, if like me, you are focused on classic, coin-operated arcade games, it won't be long until the gamepad or keyboard is no longer cutting it.  Plus, my ultimate goal is to build my own upright full cabinet, like the arcades from the 70's and '80's. 



Keyboards and gamepads just aren't going to cut it in this case.  Instead it is going to be necessary to design, build and configure an arcade-style control panel that will interface and work with RetroPie and my most highly desired arcade games.  If it also works with console-based emulators, that will be a bonus.

But before we go whole hog, there is still a lot to learn and a lot of decisions to make.  So, I decided I'd start small, by building a prototype control panel to see what I needed to learn and what I might or might not want on the full arcade cabinet.  And boy, did I learn a lot!

My goal for the prototype was to stay around $200 total, excluding the Pi/Canakit since I was going to drop the one I used in previous posts, already containing the games I wanted, into the new system.  I wanted it to be portable (so I could show it off at work since my co-workers got me started in this mess to begin with) and it would not include an integrated monitor, but instead hook up to any display with an HDMI input.  

Before I even put pencil to paper, I spent some time thinking about what I wanted in the prototype, and eventually the full arcade cabinet.  Again, with an emphasis on arcade games, I knew I wanted a two-player setup.  But how many buttons per player?  I play-tested a lot of games and looked at a lot of images of original cabinets on the web.  In most cases, four buttons were adequate.  There were a few later games, mostly fighter games (not my primary favorites, but some people might like them and I already had them installed), so I bumped up the count to six buttons per player.  There are examples out there of "mega-panels" that folks have built with 10 or more buttons per player, steering wheels, accelerator pedals, light guns, etc.  But I wanted more of a "classic" arcade machine and had a fixed space to in which to fit the eventual cabinet.  Six buttons and a joystick per player seemed like a good place to start with the prototype.

However, since the focus was going to be on arcade games, there needed to be a button for a credit/coin insert and one and two player start buttons.  Finally, there needed to be a "hotkey" admin button for the EmulationStation (see previous post for more info on the hotkey).  For symmetry, I also decided on separate coin buttons for players one and two and a separate hotkey on each player's side.  All told, that means I'd need two joysticks and a total of 18 buttons.  In addition, I'd need an encoder to translate the button/joystick microswitch actions to USB for feeding into the RetroPie.  I also thought it'd be cool if the buttons lit up.  I'd seen some really cool videos of unique ways to use control lighting that I might like in the full cabinet.  Not a requirement, but might be nice.

After a bit of research and some Amazon searching, I came across this kit:
It had everything I needed in one tidy package.  Joysticks, plenty of illuminated buttons, one and two player coin and start buttons, one encoder for each player and all the necessary cables and connectors.  Perfect!  Cost ~ $75.

Next was deciding on the material to use and overall size of the prototype. Again, I wanted it to be self-contained as possible (except for display), wide enough for two players to use simultaneously without bumping elbows, yet light enough and small enough to take with me anywhere. Oh, and I wanted a way to access the internal Pi and other controls without taking the dang thing apart, so I'd need a door or fold down panel of some sort.

If you read previous posts, you know my woodworking skills are pretty much limited to the toolbox I built in 7th grade shop class and a few basic household projects, so I needed a material that was easy to work with.  Again, research showed that a lot of home arcade cabinets are constructed out of medium-density fiberboard (MDF).  I opted to go with 1/2" MDF to build the panel and control box.  It was strong enough for my needs, yet didn't weigh too much.  It's also pretty easy to work with and doesn't require a lot of prep before priming and painting.  Also, based on my skills and tools, I planned on simple butt joints between the sides.  Remember, this is just a prototype.  I wanted it to look OK, but didn't want to spend days working on miter joints, etc. Expert woodworking was not my goal here!  It was really out of my reach anyway.  The power tools at my disposal for building this were:
  • Circular Saw
  • Jig saw
  • Dremel Rotary Tool
  • Drill
That's it!  Other than some hand tools, that's all I would use.  So, just how big did it need to be?  Not only did I not know how far apart player 1 and player 2 controls should be, I didn't know what a good distance between buttons for a single player should be nor what the space should be between the joystick and buttons.  But Google to the rescue once again.  There are tons of sample templates easily located.  I selected one that looks like the following:
Not only did it have the dimensions, but when printed on a standard LaserJet, was actual size, so I could use it as a template for marking the drill locations on the actual panel.  Yes, this has eight buttons and I only planned on six, so I simply eliminated the two rightmost buttons.  Once two of these were printed out, I could place them side by side to determine the minimum distance between players one and two.  I also wanted my coin, start and hotkey buttons located at the top, above the player controls.  When it was all said and done, I decided on control panel dimensions of 24" x 10". 

The last decision before starting the build was the height of the box.  I'd done some scale sketches and decided I wanted the front panel to hinge down for internal access (wrong decision, but not the last).  The controls themselves didn't need more than a couple of inches, but I wanted room to get my hands in there and access the controls if need be.  I finally settled on a external overall height of 6".  This would give me 5" of internal working space.

So, finally it was off to the local hardware store.  A 2'x4'x1/2" MDF panel gave me ample material to build what I needed.  Cost ~$9.00 (did I mention MDF is also pretty cheap?).  Add in another $15 for quarts of primer and flat black paint and another $20 in miscellaneous screws, brackets, wire management, etc. and I was out of the hardware store with everything I needed for under $50.00.

Project cost to date:  ~$125.00 (still well under my $200 budget)

Building the Box

I was just smart enough to think to photograph my process through the build.  This wasn't with an eventual blog in mind, but more for my own documentation to note things when it was time to build the full cabinet.  But it works out well that I can drop them in here!

First, I simply cut all the various panels to size with a circular saw.  The only panel I did not pre-cut was the front, hinged panel.  I know my woodworking limitations well enough to know that my panels would not be perfect and it was not likely to be perfectly square, so I'd wait until the rest of the box was built then trace out the front panel to assure it would fit.

Here you can see a couple of other panels, along with the control board with templates simply taped down.  The USB encoder is over the player 1 template and the Pi over player 2.  Eventually, both encoders would be screwed into the underside of the control panel and the Pi would be placed on the bottom of the box.

A small nail was used to mark/create small pilot holes for drilling by simply going right through the center mark on the template.  I liked using these templates so much (and will eventually use on my full cabinet), I printed out a whole stack of them so I simply tossed each one after use.



I then used spade bits to drill out the necessary holes.  If I remember correctly (oops, didn't document), I used a 1" spade bit for the buttons and 1/2" for the joysticks.  But info included with the controls tell you the hole size needed.  I did not use a template, but did layout the positions for the hotkeys and players 1 & 2 coin and start buttons across the top.



Hint: If you can't buy grey primer, ask them to tint it for you.  They might resist a bit, but the black paint goes over the grey primer much better than the standard white.

Next, I wanted to install the controls, wire and test them before assembling the rest of the box.  I knew that space to work on wiring and controls was going to be limited after it was all put together, so if I needed to make adjustments, I wanted it to be before everything was screwed together.


 Here the joysticks are mounted along with the two USB encoder devices that all buttons and the joysticks will connect to.  Each encoder connects to the Pi with separate USB cables.
Finally, it's all wired up and powered.  But one important note about wiring the buttons.  The spade connectors for the LED lights observe polarity.  There is a + and - for each button.  I read a lot of complaints in the reviews on Amazon that not only were these not marked on the buttons, but which terminal was which was inconsistent from button to button.  If the polarity is reversed, the buttons simply don't light up.  And once you push on the spade connector, they can be really tough to remove.  But thank you Amazon reviews, I was prepared for this going in.  So, I simply powered up the encoder via USB from my laptop.  Then for each button/wire combination, I could simply touch the spade connector to the button LED terminals to determine which lead went to which terminal.  And I can confirm that it was inconsistent from button to button.  But it did not cause a problem since I tested each one before pushing on the spade connector.  I've not had a bit of problems with the lights (or the microswitches for that matter).  It's just something to be aware of and test accordingly.


So, everything is connected and lit as expected.  I actually set this on a couple of cardboard boxes, connected to the Pi, mapped the buttons and tried playing a few games to assure everything worked as I expected.  All that was really left was to expose my woodworking skills and assemble the rest of the box, mount the Pi and build the front door.  What could go wrong?


So, I managed to get all the sides and back attached without major problems.  Far from perfect, but pretty good for me!  The angle brackets you see were to help me during assembly and to try to keep things somewhat square.  Once screwed together, the brackets really aren't needed, but I just left them there.  The Pi is mounted on the lower left.  The two plastic thingies on the right are to hold the HDMI cable and Pi power supply when the unit is stored or transported.  As I said, I wanted it to be pretty self-contained and if I didn't keep the HDMI cable and power supply inside the system, I'm sure I'd misplace them or take the box to a friend's house only to find I was missing them!



As I mentioned in an earlier post, the Pi can run pretty hot at times and can even throw an over-temperature warning.  So, I did a number of things to help avoid this. First I used some PCB offsets I had laying around from disassembling an old PC (a complete different project) to raise the Pi off the bottom.  I then cut some slits under the Pi and added some non-skid feet to the bottom.  Other than my fine woodworking skills in cutting lousy slots with a jigsaw (it's on the bottom, so who will see it?), have you discovered my major design flaw yet?


So, here is the front panel with a cutout to access the Pi's power, HDMI and audio ports. The front panel is attached to the base with a simple piano hinge.  But notice how it is sitting on the edge of the counter in this picture?  That's because when sitting on a flat surface, the front panel will only open about 30͒° before the bottom edge of the panel hits the surface!  The only way to fully drop down the front panel is to hang the box over the edge of a surface to allow clearance so it will drop down.  Oh well, not a fatal flaw.  It was a "learning opportunity"!


When placed on an edge (!), you can see everything all finally put together, with the HDMI and power cables stored inside.
A couple of final touches... carrying handles and simple latches to keep the front panel closed (not that it would fall very far open on its own... unless on the edge of a table.  Yeah, having a hard time letting that one go).  You can also see the fine workmanship, even with simple butt joints.  Nothing is lined up perfectly.  Fine for a prototype, but it does have me concerned about the full cabinet, where I'll be dealing with beveled edges, miters and a bunch of funky angles.  But that's for later!
And finally, the completed prototype in action.  Kinda' hard to see, but I also applied some small vinyl lettering above and below each button.  I've played it with a bunch of different games, both arcade and console to get a feel for what I want (or don't want) in the full arcade cabinet.

Before I wrap this post up with lessons learned, I want to throw something in here about button mapping.  This can be very confusing and will come into play with the lessons learned and the full cabinet build, but RetroPie and EmulationStation gives you a lot of fine-grained control in mapping.  But this fine-grained control can also lead to a lot of confusion.  I'm not going to get into the details here about how various parts of the system (USB encoders, RetroPie, EmulationStation, Retroarch) work to map controls to an action within a particular game.  For now, know that there are three levels where buttons can be mapped (four if you have an encoder that allows customization... in this prototype, mine did not):

System Level - You can define buttons that apply across all emulators and all games.  This is the "master default" and what you are configuring when you first define a new controller in EmulationStation.

Emulator Level - This sets the control mapping for all games within a particular emulator.  It overrides the system level if it exists.  Otherwise, the emulator will default to use the system level configuration.

ROM (Game) Level - This sets the mapping for an individual game.  If an individual game has a controller config, it will be used only for that game.  If it does not exist, it will use the emulator defaults if one exists.  Finally, it will default to the system level if there is neither a game or emulator controller config.  

RetroPie has pre-defined defaults for most emulators, but these can be updated if needed, or individual games can be tweaked.  If the three fire buttons for Missile Command are in the wrong order, you can easily remap which button fires which base.  All configs can also be edited using a text editor from the command line.  Confusing? Yes, but there is a lot of information out there.  My prototype was pretty simple, but current plans for the full cabinet will take this to a totally new level!

Lessons Learned

After playing with the prototype for a while, there are a number of things I want to consider for the full cabinet.

I definitely want to add a trackball and rotary spinner to the full arcade.  Some games like Centipede, Missile Command and Golden Tee simply don't play well (or at all) with a joystick.  And driving games or others like Tempest require, or play much better with, a rotary spinner.  I don't want to add a full steering wheel, so a spinner on the control board should suffice.

Joysticks.  The joysticks I used in the prototype are 8-way joysticks.  Not only do they register the cardinal directions (up, down, left and right), but also the diagonals if the joystick is moved in such a way as two adjacent switches are contacted, they send the diagonal.  While this is perfectly fine for nearly all consoles and the more recent arcade games, some of the older classics utilized only 4-way (or even 2-way) joysticks.  Games like Pac-Man and Donkey Kong are very difficult to play well with an 8-way stick.  If you don't hit the cardinal direction just perfect, Pac-Man or Mario simply fails to respond as expected, stops moving and eventually dies, while you swear at the game, asking poor Mario why he refused to climb that damn ladder!  You can get joysticks with restrictor plates that allow you to switch a joystick from 8 to 4 way, thereby blocking contact with the corners when set to 4-way.  Most require you to physically move this plate by hand, meaning that every time you go from an 8-way game to a 4-way game, you'd have to open the cabinet up and manually move the restrictor plates.  I want joysticks that I can programmatically or electronically switched between 4 and 8 way (yes, they do make these).

Button LED lighting.  I like the illuminated buttons on the control panel.  No, maybe not historically accurate, but it looks great!  Ultimately, I'd like to programmatically light up the buttons used for a particular game.  If there are six buttons for a player, then only the needed buttons would light up for the selected game.  When no game is active, the buttons could play an "attract" pattern.  Yes, this is also possible, albeit a bit complicated.

Pi Power Down Button.  I want a master power switch that will power down the entire arcade cabinet.  But the Pi needs to be powered down gracefully before the killing the master power (see earlier post on powering down the Pi).  So, I want a push button on the exterior of the cabinet that lets me gracefully power down the Pi before shutting off the master power.

Speakers:  At this point, I'm not sure if I'm going with a TV or larger computer monitor for the display.  But in either case, it will be enclosed within the cabinet, so getting adequate sound is going to require external speakers.  Given the spotty nature of the Pi's on-board audio jack, this may take some work.  In addition, these speakers will need an external or programmatic volume control.  The sound level varies widely between games and there needs to be a way to adjust volume between games.

External USB ports (connected to the Pi).  By building in a couple of external USB ports that are connected to the Pi, it would add the option to simply plug in a console controller and use that in situations where it might work better than the control panel.  It would also give the option to have Players 3 and 4 for appropriate games without building a mega-panel.

Display.  There is a lot to consider here.  Beyond the audio issue, the display needs to power on when it receives a signal (have HDMI-CEC) since the display power button will not be accessible without opening the cabinet and a remote control IR signal will likely be blocked by the display bezel.

Woodworking Skills and Tools.  The skills speak for themselves.  I may need to bribe a friend with better skills than I to assist in the build.  And I'm going to need some additional tools.  A table saw and router at a minimum.

I think that does it for the basics and the prototype build.  Woodworking skills aside, I think I'm ready to start designing and planning the full cabinet build!  Until then... thanks for hanging in there.

Next: Planning the Arcade Cabinet Part I

3 comments:

  1. How did you program the RGB buttons and the 2/4 way joystick per game ? I just started researching and this is the first I've seen of this. Very cool btw.

    ReplyDelete
    Replies
    1. It's all handled via some software called RGBCommander. It manages both the button lights/colors and also the setting of the 4/8-way joystick... all from a configuration file. I have a separate page that goes into a bit more detail on this: https://retroarcadebuild.blogspot.com/p/rgbcommander-wiring-and-custom.html

      Many of my games were already predefined in the config file that came as part of the free software. Those that weren't present (or if I want to do something like change the button colors), it was pretty easy to do once I understood how the config file worked.

      Let me know if you run into any other questions!

      Delete
    2. I missed that page! Thank you!

      Delete

RGBCommander Update (and possible fix)

If you have recently been working on your own arcade and ran across posts referencing a utility for RetroPie called RGBCommander that can co...