Portable 2 Player Arcade Console With RPi and Teensy

by lb_20 in Circuits > Raspberry Pi

16559 Views, 169 Favorites, 0 Comments

Portable 2 Player Arcade Console With RPi and Teensy

15302474_10154818956503223_1911218598_o.jpg
15225437_10154818956538223_494778231_o.jpg

Hi guys!

In this Instructable I'll be walking you through a "portable" 2 player arcade console build (designed from scratch). The idea is that it is mostly self-contained, with power, HDMI and USB plugs on the body of the console for ease of use- simply plug and play with the built-in arcade controls, or add your own via the 2 USB ports! This design uses Raspberry Pi running RetroPie (Emulation Station and Retroarch), which is very well documented on the web. So this instructable will focus more on the circuitry, controllers and the design of the console. Hope you all enjoy!

Gather Your Parts and Materials

16, 9:20 am.jpg
16, 9:20 am.jpg
16, 9:20 am.jpg

You will be needing many different parts and materials to complete this build. Here's what you'll need:

Arcade Controllers:

I got mine from http://www.diyarcade.com.au/, you can make up your own kit with just the parts that you need which is great. Here's what I bought:

Player 1 Joystick: Black Zippy Joystick - Long Shaft (2/4/8 Way)

Player 1 Buttons: 6 * Standard Red

Player 1 Start Button: Standard

Player 1 Button (White)

Player 1 Credit Button: Black Standard Button

Player 2 Joystick: Black Zippy Joystick - Long Shaft (2/4/8 Way)

Player 2 Buttons: 6 * Standard Blue

Player 2 Start Button: Standard

Player 2 Button (White)

Player 2 Credit Button: Black Standard Button

Speaker Grills: 2 * Standard Speaker Grills

48 * female spade Connectors To fit the microswitch connector width e.g. https://www.jaycar.com.au/mini-female-spade-blue-p...

Microcontrollers/ microprocessors and associated parts:

2 * Teensy 3.1 http://core-electronics.com.au/teensy-3-2.html/?a...

1 * Raspberry Pi 3B http://core-electronics.com.au/teensy-3-2.html/?a...

1 * SD card for RPi http://core-electronics.com.au/16gb-microsd-card-...

2 * Micro USB cables (for connecting the Teensy's to the RPi) http://core-electronics.com.au/usb-cable-a-microb...

1 * HDMI cable (for connecting RPi to the external connector on the body of the console) http://core-electronics.com.au/hdmi-cable-6.html/...

Speakers and Lights (Optional):

1 * USB powered speakers (I used the Logitech Z120)

1 * 5 m RGB LED strip (You'll only need about 1 m, I got mine from eBay or you can get yours from http://core-electronics.com.au/led-rgb-strip-bare-...

Console Body and External Connectors:

4 * Rubber feet mounts: http://au.rs-online.com/web/p/fixed-height-mounts....

1 * Panel mount DC power socket 2.1mm: http://au.rs-online.com/web/p/dc-power-sockets/044...

1 * HDMI panel mount connector: http://au.element14.com/neutrik/nahdmi-w-b/adaptor...

1 * dual USB A female port panel mount connector https://www.ocp.com/usb-port-cables/

Power Circuit Components:

1 * LM2596T-12/NOPB

1 * LM2596T-5/NOPB

2 * 680 uF capacitors

2 * 220 uF capacitors

2 * 33 uH inductors

2 * 1N5824 Schottky diodes

6 * 11N65C3 N-channel MOSFETs

JST connectors http://core-electronics.com.au/jst-connector-kit-2...

Teensy Controller Circuits:

4 * 14 pin female headers

6 * 4 pin screw terminals (small) (for button/ joystick connections)

2 * 2 pin screw terminals (large) (for power connections) http://core-electronics.com.au/screw-terminals-2-...

24 * 10 kOhm resistors

Veroboard

A bunch of wire

JST connectors http://core-electronics.com.au/jst-connector-kit-2...

Tools/Equipment:

Laser cutter

Hot glue gun

3M Double sided tape

Drill

Soldering Iron

Solder

Nuts and bolts for connectors

Acrylic glue

Screw driver

Allen key set

Electrical tape

Design the Console Body

Arcade Solidworks Model.JPG
Arcade Solidworks Model Top View.JPG
Arcade Solidworks Model Bottom View.JPG
Arcade Solidworks Model Back View.JPG
Arcade Solidworks Model Front View.JPG

Based on the dimensions of all the parts, I designed up a nice console body to get laser cut. I chose a 4.5 mm thick matte black acrylic which looks fantastic, but scratches easy so be careful!

Attached are the Solidworks parts and the full assembly with most of the parts included.

Note that the dimensions for the speaker holes should be adjusted to the size of your speakers. I used an arbitrary size for the holes and selected the speakers afterwards.

Also, depending on the type of joysticks you buy, you may have to adjust the size of the joystick holes to ensure you have full range of motion of the joystick shaft.

The button holes should be standard.

The connector holes sizing will come directly from the type of connector you choose to buy (USB, HDMI, power). The rubber feet mounting holes also need to sized appropriately depending on the size you choose.

Laser Cut the Console Body Pieces

Take the Console Body parts from the Solidworks files in the previous step and get them laser cut! The majority of the parts are cut from 4.5 mm matte black acrylic, but the viewing window is cut from 6 mm clear acrylic.

You should have a total of 8 matte black parts and 1 clear part.

Fit the External Connectors to the Console

16, 10:23 pm.jpg
16, 10:23 pm.jpg
16, 10:23 pm.jpg

In this step you'll be fitting the panel mount USB connector, along with the power and HDMI connectors and the rubber feet.

The panel mount USB connector should simply click in place without the need for screws to attach it. The HDMI and power connectors will require a couple of screws each- countersunk for the HDMI and just a standard head for the power. You'll also need a couple of nuts to feed onto the free end to hold the parts in place. Make sure you select screws which are long enough to go through the connector and the acrylic!

Screw in the rubber feet from the inside of the console body too.

Fit the Arcade Controls Into the Console

16, 9:20 am.jpg
16, 9:20 am.jpg
16, 9:20 am.jpg
16, 9:20 am.jpg
16, 10:23 pm.jpg
16, 10:23 pm.jpg

In this step you will be fitting all of the buttons, joysticks and speaker grills to the console body.

For the buttons, simply unscrew the nut, place the button through the hole in the top face of the console and screw the nut back on the underside. Make sure it's tight enough so that the buttons can't rotate.

The joysticks were a bit tricky to mount without making the top face of the console look messy. Since detailed drawings of the joysticks weren't available, I wasn't able to design the top face of the console with attachment holes for the joysticks. I had originally planned on positioning the joysticks shafts as centrally as possible in the hole and then drilling some mounting holes. Ultimately, I decided against this since I found some ridiculously strong 3M double sided tape. I placed a generous amount of tape on the top face of the joystick plate, positioned the joysticks as central to the hole as I could and stuck the joysticks to the underside of the top face of the console. Prior to doing this, make sure you unscrew the joystick knob so you can take out the plastic plate that should sit on the top face of the console. This plate will cover the large hole you feed the joystick shaft through. Once the joystick has been secured in place, you can replace the plastic plate and screw the joystick knob back on.

As with the joysticks, I didn't have detailed drawings for the speaker grills. I could have drilled the mounting holes out, since they are covered by the speaker grill and wouldn't look nasty like the joysticks mounting holes, but decided against it. Since the double sided tape worked so well for the joysticks, I decided to use the same adhesion method for the speaker grills. I placed small sections of double sided tape along the bottom face of the speaker grill, aligned as centrally as possible with the hole in the top face of the console body and stuck the grills down.

Wire Up the Arcade Controllers

16, 9:20 am.jpg
16, 10:23 pm.jpg
16, 10:23 pm.jpg

This step is quite time consuming so brace yourselves before getting started.

With the buttons and joysticks in place, you will need to measure out two wires to connect to each microswitch. One wire will run from the COM pin of the microswitch and the other wire will run from the NC 3 (NO) pin.

The COM pins of all of the microswitches need to be daisy chained together, with the free end connecting to a 3.3V rail from the Teensy controller board.

Depending on how you write your code for the Teensy controllers, you can use a high or low logic to detect a button press. Since I connected the 3.3V wire to the COM and have the other wire running between the NC 3 (NO) pin and the Teensy, when the buttons are pressed, the Teensy will detect a high logic and the button press will be processed with the controller code. I will talk about how to connect the buttons to the Teensy's in the next step.

Each of these wires can either be directly soldered to the COM or NC 3 (NO) pins of the microswitch, or a spade connector can be crimped to the wire and slotted onto the pin. I used spade connectors to allow for easy connection and disconnection.

Solder Up the Teensy Controller Board

16, 11:23 am.jpg
16, 11:23 am.jpg
16, 11:24 am.jpg

In this step you need to wire up the Teensy's so that you can connect the wires from the joysticks and buttons via some screw terminals. There are more permanent ways to wire these in e.g. using some connectors, but for prototyping purposes and ease of connection and disconnection I decided to go with screw terminals. Feel free to connect the wires from the buttons and joysticks in whatever way you want to.

For each of the microswitches attached to a button or joystick, you'll be feeding the free wire (i.e the wire that's not daisy chained for the 3.3V) into the screw terminal which will connect to a pin on the Teensy. Since we are reading high logic, we have 10k ohm pull down resistors on each of the Teensy pins as shown in the attached picture. Solder each of these resistors in and any connecting jumper wires you require, depending on how you've laid out your board.

It's probably easiest to solder some pin headers into a veroboard which you can dock the Teensy's into. Also solder in the screw terminals to connect to the relevant pins of the Teensy's. The picture attached shows 6 of the large screw terminals soldered onto the board and connected to 3.3V. It is not necessary to have so many screw terminals- you can get away with a 2 pin terminal for 3.3V if you're daisy chaining.

Connect the Arcade Buttons and Joysticks to the Teensy Boards

In this step you will simply connect your arcade controls to the Teensy boards. Feed the free ends of the daisy chained wires into the 3.3 V screw terminal on the Teensy controller board. Next, you will need to feed the wires coming from each of the buttons into their respective positions on the Teensy controller board via the screw terminals. For each controller, I used the following pins connected to the following buttons:

X = Pin 1

Y = Pin 2

R = Pin 3

A = Pin 4

B = Pin 5

L = Pin 6

START = Pin 7

COIN = Pin 8

Joy DOWN = Pin 9

Joy LEFT = Pin 10

Joy UP = Pin 11

Joy RIGHT = Pin 12

Set Up the Teensy Controller Code

Set_Up_USB_Controlller.JPG
Controller_Test.jpg

In this step you will be configuring the Teensy's as controllers connected to the arcade buttons and joysticks. Each Teensy acts as a single USB HID controller. This is achieved through use of the attached Arduino code which will make each of the Teensy's look like a USB controller device when plugged into a computer such as the Raspberry Pi. Upload the attached code to each Teensy. When you compile the code, you need to select one of the options which includes the word "Joystick" from the "Tools > USB Type" dropdown menu in the Arduino IDE. This code is based on example Teensy code found here: https://www.pjrc.com/teensy/td_joystick.html


Once you have uploaded the code and you have all your arcade buttons and joysticks connected, you should be able to run the 'set up USB game controllers' software in windows (attached images) and check that your buttons are all being detected correctly and have been mapped in the same way as the Arduino code states.

Set Up the Raspberry Pi

16, 10:10 am.jpg

When I bought my Raspberry Pi I also bought a NOOBS SD card which meant that I could get the Pi set up with Raspbian really easily.

The first step towards playing arcade games on the Pi is to install Retroarch and Emulation Station. Emulation station provides the user interface where you can load ROMs from various gaming platforms and launch your games. Retroarch is the emulator which can actually run the games. Manual installation instructions can be found here: https://github.com/RetroPie/RetroPie-Setup or alternatively, you can download a full image to flash to your SD card.

Once you have installed emulation station and Retroarch, you will be prompted to configure your gamepads (arcade controllers). See the attached image for how I have configured my controllers. This configuration is for both emulation station and Retroarch. Once configured, you should be able to navigate the emulation station menu using the arcade controls. You can now set the Pi up so when it boots, it doesn't open the GUI for raspbian, but rather opens emulation station straight away. Instructions for doing this are located here: https://github.com/RetroPie/RetroPie-Setup/wiki/F...


Now that you've got the Pi running and have tested it with the arcade controls, move on to the next step to solder up the power board and make the arcade self contained.

Solder Up the Power Board

16, 9:20 am.jpg
16, 9:20 am.jpg
16, 5:00 pm.jpg
16, 9:20 am.jpg
16, 9:20 am.jpg
16, 9:20 am.jpg

Take the circuit diagram provided and solder away. The MOSFET part of the circuit is optional, since that's what drives the optional LED strips. I was a bit pressed for space on the power board with the MOSFETS as they were an afterthought, so make sure you leave adequate space for these if you choose to add the LED strips as they can take up a fair bit of room.

The board takes an input voltage up to 40 V and the two LM2596 step down voltage regulators put out 12 V and 5 V.

On my board I have JST connectors for:
VIN: 2 pin connector
5 V out to speakers: 2 pin connector
5 V out to RPi: 2 pin connector
LED strip power: 4 pin connector (*2)
MOSFET gate: 3 pin connector (*2)

Test That Your Power Circuit Works With the Pi

16, 9:20 am.jpg
16, 9:20 am.jpg
16, 9:20 am.jpg
16, 9:20 am.jpg

Before you connect up the Raspberry Pi to your new power board, connect the power source (I use a 19V laptop charger with a barrel connector) and probe the circuit with a multimeter. You want to make sure that your dc dc converters are working properly before you connect any peripheral devices. You should have 12 V and 5 V available from this board. Once you've checked that these are working you can plug in the Raspberry Pi, LED strips and speakers to the power.

Assemble the Console Body

16, 10:23 pm.jpg
16, 10:23 pm.jpg
16, 10:23 pm.jpg
16, 10:23 pm.jpg
16, 10:23 pm.jpg
15823926_10154938523003223_1071957396_o.jpg
16, 10:23 pm.jpg
16, 10:23 pm.jpg
16, 10:23 pm.jpg

The assembly is the interesting step which gets a bit fiddly. You can glue the acrylic pieces together with acrylic glue but on the matte black there is a good chance that the glue will run and streak the surface which is obviously undesirable. I decided to use hot glue instead, you can be as messy as you like, since you'll be gluing on the inner faces of the console.

The first thing you'll be doing is preparing the bottom face to be attached to the side walls. This will not be a permanent fixture, so hold off on hot gluing the side walls to the base. Use hot glue to secure the nuts in place on the side walls of the console body as shown in the pictures. To do this, you need to position the nuts in the T-slots and screw in the bolts, then you can apply the hot glue. Be generous in how much glue you use on the inside. This will allow you to access the inner parts of the arcade console.

Assemble the side faces with the top face upside down. Hold the pieces in tight while you apply hot glue to the side walls. Then, glue the top face to the side walls. You shouldn't glue the bottom face to the side walls of the console. You want to make the bottom panel removable, just in case you need to make any changes to the hardware. Also remember to glue in the centre supporting piece.

For the viewing panel, you will be using acrylic glue to glue the clear acrylic to the matte black removable panel. This part is visible, so I opted to use acrylic glue here instead of hot glue, since I didn't want it to look messy. Once glued, use nuts and bolts to secure the panel to the console top face as shown. On the underside (where the nuts are located), take some hot glue and carefully run it around the outside of the nuts to hold them in place. This will allow you to remove the viewing panel easily if you need to quickly access the power circuit or the RPi. The viewing panel will show off your nice power circuit board and the RPi!

To finish the assembly, position the bottom face of the console body and screw it in.

Mount the LED Strips (optional)

16, 10:23 pm.jpg
16, 10:23 pm.jpg
16, 10:23 pm.jpg
16, 10:23 pm.jpg
16, 10:23 pm.jpg
16, 10:23 pm.jpg

Choose a nice place on the inside (or outside) of the arcade console to mount your LED strips. I chose the inside, since I wanted the lights to shine through gaps in the acrylic and the viewing window. Also because for wiring up to power and the MOSFETs, it was easier to have the strips mounted inside, close to the power board. When you're happy with a spot for the LEDs, peel off the tape to expose the adhesive surface. Then simply stick the LED strips to your desired surface. I had to secure mine with a bit of extra hot glue.

Also add a 4 pin JST connector to the wires running off each of the LED strips.

Set Up the Teensy Code for LEDs (optional)

16, 10:23 pm.jpg

In this step I add some extra lines to the Teensy code from earlier. This code will make the RGB LEDs flash different colours depending on the combination of microswitches that are activated by a single player at any given time.

If you choose not to add in the LED strips, you can skip this step. If you want this added feature, simply upload the attached Arduino code to each Teensy.

Basically, the code is looking for the main arcade control buttons (the red and blue rows) to go high and then activating a single colour of the strip based on the button press. For example:

Button A or X pressed: Red LEDs activated

Button B or Y pressed: Green LEDs activated

Button L or R pressed: Blue LEDs activated

Any combination of button presses results in many different colours being achieved.

You will also need to solder some 3 pin connectors to the Teensy Controller board which will be used to drive the gate of the MOSFETs for controlling the LED strips. You can place these 3 pin connectors on any of the free pins for each Teensy (see attached image where I have hooked the JST connector up to pins 14, 15 and 16).

Wire Up the Speakers (optional)

Depending on the speakers you choose to use, when you remove the speakers from their case, you will most likely have to snip some wires in the process. In this step you'll wire up the speakers so that they can plug into the power board for a 5 V power supply and also re-wire the AUX cable if you had to cut that too.

You will be keeping the existing control board which contains an LED for power status and a pot to control the volume. Simply measure the desired lengths of cable for the AUX and power leads and re-solder the wires together or replace the existing connector on the control board.

Design Speaker Mounts

Speaker Mount.JPG
Speaker Mount Front View.JPG

Now that you have extracted your speakers, it's time to measure them up and design a mount to get laser cut. My speakers had a octagonal shape with four mounting holes, so I based the mount design off this shape.

It was difficult to measure the location of the holes so they are very roughly positioned. I didn't end up using these for mounting as a result.

Laser Cut the Speaker Mounts

Take the design from the previous step and get the mounts laser cut. I ended up cutting 4 of the same design out of 6mm clear acrylic and double stacking the mounts for each speaker to get the desired height for mounting in the arcade console.

Mount the Speakers

16, 9:20 am.jpg
16, 10:22 pm.jpg
16, 10:23 pm.jpg
16, 10:23 pm.jpg
16, 10:23 pm.jpg
16, 10:23 pm.jpg

With the laser cut mounts, take some hot glue to first glue two mounting plates together (stacked on top of each other). Then, take some hot glue and secure the speakers into the mounts. Use the mounting holes as an extra place to run the glue into the mount and speakers.

Next, position the speakers in their mounts a central as possible to the speaker holes cut out in the top console panel and hot glue them in place.

If you want to have the volume control knob on the top face of the console, also drill a hole in the acrylic at your desired position to poke the potentiometer shaft through. Once you're happy with the position, add the potentiometer knob to the shaft and spin it to the desired "off" location. Finally, hot glue the speakers control board to the underside of the consoles top face. You may have to bend the LED out of the way.

Obtain Some ROMs

16, 9:17 am.jpg
16, 9:17 am.jpg

Since you have configured emulation station to run on booting the RPi, you will need to know how to get out of the application to access raspbian so that you can access the file explorer to load in and organise your ROMs. To do this, you'll need to quit Emulation station in the main menu. When you quit, you will be taken to the terminal interface. You then need to type in 'sudo startx' which will open the GUI for the Pi.

Once here you can access the file explorer and add in your ROMs. There are several ways to obtain ROMs (a simple google search will show you many sites to obtain free ROMs). Please note that it is illegal to download ROMs you don't own. The legal way to obtain games is to rip them from your physical copy of the game. You must own a physical copy of the game if you are to download its digital version to play on your arcade.

Since you will be mostly playing arcade games (unless you have USB controllers to plug in), most of your games will be located in the MAME folder. Information about loading games into this folder can be found here: https://github.com/retropie/retropie-setup/wiki/M... and you may need additional BIOS for some games to run. This information is detailed in the provided link.

Configure Your Arcade Controllers for Certain Games

16, 9:17 am.jpg

You should now be all set up to play some arcade games! Simply navigate to their location in emulation station and start playing.

You may have to configure your controllers, if the buttons aren't mapped correctly. I noticed this with street fighter, where the punch and kick controls were all mixed up. For some reason the controls in the emulation station menu don't get mapped across correctly for certain games.

A way around this is to reconfigure the controls. This process is explained at the following link: https://github.com/RetroPie/RetroPie-Setup/wiki/R... I followed the instructions for core input remapping (see attached image) which worked just as I needed. The link, however discusses several other methods for configuring controllers.

Play Some Games!

15204131_10154818956483223_437808071_o.jpg
16, 9:17 am.jpg
16, 9:20 am.jpg
16, 9:20 am.jpg

Some games might not work with the default emulator, but there is a way to configure this also. If you find a game doesn't work using the default, you can change this as detailed by the following link: https://github.com/retropie/retropie-setup/wiki/r...


You can also plug in any other USB controller/s (up to two via the dual panel mount female USB ports on the front of the console) and configure them in emulation station to play games. I've tried this out with a couple of SNES controllers I bought off eBay and it works great.

Hope you are now up and running and have all enjoyed this Instructable, I'm certainly pleased with my final product! A special shout out goes to my boyfriend Craig who helped me out with this build!

Please ask questions if you feel like I have skipped any details, it was a long Instructable to write so I feel like I may have missed some things along the way!