Retro Game Controller

In this guide, we'll learn how to wire up a Mini Analog Joystick to the Adafruit Arcade Bonnet for Raspberry Pi. Most of the arcade buttons plug into the Arcade Bonnet with quick connect wires – Making it much easier to put together a retro arcade controller or cabinet.

Adafruit Arcade Bonnet

This cute little bonnet is designed for quickly adding arcade buttons to your Raspberry Pi. It has six JST connectors that are compatible with our arcade button quick connect wires, so no soldering required. There's also dedicated pins for wiring up an analog joystick and an 8-way switch joystick.

Prerequisite Guide

I suggest walking through the following guides linked below to get familiar with the components. If your new to soldering and electronics, these guides will help you get started!

Parts & Components

A nice handful of parts and components used to build this project. Always a good idea to have more on hand in case something is damaged or burns out!

1 x Raspberry Pi 3
Model B ARMv8 with 1G RAM
1 x Adafruit Arcade Bonnet
Raspberry Pi Hat with JST Connectors
1 x Mini Analog Joystick
10K Potentiometers
8 x Mini LED Arcade Buttons
24mm Blue, red, yellow, white or green
1 x Quick Connect Wire
Arcade/Button – Set of 10 pairs
6 x M3x55 M3 Standoffs
Female Thread Brass Standoff Spacer 55mm High
12 x M3 machine screws
Phillips Flat Head Machine Screw A2 SS - M3 x .5 x 6MM

Cool Tools!

These things really do help make building the project smoothly. You don't need them all of them, but I recommend them.

1 x Wire Strippers
Hakko Professsional Quality 20-30 AWG Wire Strippers - CSP-30-1
1 x Wire Cutters
Flush diagonal cutters - CHP170
1 x Soldering Iron
Adjustable 30W 110V soldering iron - XY-258 110V
1 x Panavise
Panavise Jr. - PV-201
1 x Helping Third Hands
Helping Third Hand Magnifier W/Magnifying Glass Tool - MZ101
1 x 30AWG Wire
Silicone Cover Stranded-Core Wire - 30AWG in Various Colors
1 x Solder Wire
Solder Spool - 1/4 lb SAC305 RoHS lead-free / 0.031" rosin-core - 0.25 lb / 100 g
1 x Heat Shrink Tubing
Multi-Colored Heat Shrink Pack - 3/32" + 1/8" + 3/16" Diameters
1 x Mounting Putty Tack
Loctite Fun-Tak Mounting Putty 2-Ounce

Circuit Diagram

Use the diagram above to reference the wired connections. The length of wires are not exact, this is just a visual representation of the circuit. The Adafruit Arcade Bonnet has six JST connectors for quick-connect wires. To add more buttons and a mini analog joystick, we'll need to solder the wire connections.

Mini Joystick Potentiometers

This joystick uses 2x 10k potentiometers to emulate X&Y axes. They are wired just like two regular potentiometers! The terminals in the center is wired to signal while the left and right are wired to ground and +3V. The Bonnet will convert the analog signal to digital signal for you

Extra Buttons

For the Start and Select buttons, I'm wiring two buttons to the Left and Right pins on the 4-way stick section. Each button connects to an available ground pin, located on either side of the Adafruit Arcade Bonnet.

Note that within Retropie you can re-assign buttons to whatever you like, so it doesn't matter that the Bonnet silkscreen says "left/right" - in the software just set those buttons to Start/Select

Software installation for the Arcade Bonnet requires an internet connection. That’s a frequent topic already covered in other Pi getting-started guides, so we’ll assume here that your Pi is already booted and networked, running Raspbian or a gaming-ready OS like RetroPie.

You may find this easiest if ssh is enabled on the Pi, and then log in with a terminal app. This lets you copy-and-paste the commands that follow, as they’re very exact about spelling.

Support for the buttons and the audio amplifier are installed separately. If you don’t need the bonnet’s speaker support, you can just skip that step and use the regular headphone jack or HDMI audio in that case.

Buttons and Joysticks

Enter the following two lines to install support for the six button connectors and the 4WAY and ANALOG joystick connectors:

curl https://raw.githubusercontent.com/adafruit/Raspberry-Pi-Installer-Scripts/master/arcade-bonnet.sh >arcade-bonnet.sh
sudo bash arcade-bonnet.sh

When run, this script will offer a couple of options:

  • Disable overscan? If you answer “Y” this removes the black border around the screen (common on HDMI monitors). Takes effect on next boot.
  • Install gpio-halt utility? Linux-based systems like the Raspberry Pi don’t like it when you just switch off power…there’s a specific shutdown process, else the SD card may get corrupted. The gpio-halt tool lets you add one more button between ground and any unused GPIO pin (not one of the six button sockets) to initiate an orderly shutdown. Gaming OSes like RetroPie already include a shutdown command among their menu options, so you may not need this.

When the script finishes you’ll be asked whether to reboot. Answer “N” if you plan on installing audio support, and follow the next section (“Audio Amplifier,” below).

If you need to change the key assignments: edit the file /boot/arcadeBonnet.py say with sudo nano /boot/arcadeBonnet.py

Near the top of the code you’ll see this table:

'#' lines are human comments and do nothing for the code. The first six actual elements in the table correspond to the six button inputs (labeled “1A” through “1F” on the Bonnet). Then two “0” values (these do nothing, but need to be there, don’t delete them) and another 8 elements corresponding to the 4-way and analog joystick/d-pad inputs.

Audio Amplifier

If you’d rather use the heaphone jack or HDMI audio output, this step can be skipped. Otherwise, to enable Arcade Bonnet speaker output, it’s one line:

curl -sS https://raw.githubusercontent.com/adafruit/Raspberry-Pi-Installer-Scripts/master/i2samp.sh | bash

There are no install options; it simply does its one thing. Confirm installation when prompted and reboot when done. Then re-run the script again after rebooting to test the speaker output. After the speaker test reboot once more to activate the speaker volume control

Audio will then be channeled through the Arcade Bonnet amp.

If you’re curious about what the script is doing behind the scenes, this guide lays out in detail each step performed.

Advanced Usage - Other Inputs

Additional button inputs are possible using the GPIO pin header and our retrogame utility.

This guide shows how to install and configure retrogame.

This requires configuring retrogame to only read the extra GPIO inputs! The six main buttons and joystick are already handled by the previously-installed Arcade Bonnet software; retrogame is a separate thing and they’ll interfere if accessing the same pins.

Try to use the 6 button inputs on the Bonnet. Much easier. retrogame is guru-level stuff.

Game Controller Enclosure

The case was designed to be 3D printed but it can also be laser cut or CNC milled out of acrylic. A total of six panels joint together and secured with standoffs and machine screws. The back and left panels feature cut outs for the various ports on the Raspberry Pi.

Case Design

I 3D modeled the enclosure in Autodesk Fusion 360 and designed the panels for 3D printers with dual extrusion tool heads. Each panel has separate pieces that form two-color graphics. 

Dual Extrusion

We used an Ultimaker 3 and Sigma BCN3D 3D printers to produce the parts. They both achieve dual extrusion differently, but render similar results.

Other machines can be used, such as the flashforge creator proPrusa i3 MK2 with Multi Material upgrade kit or the Palette+ from Mosaic Manufactur

Joystick Wires

Each potentiometer requires three wired connects, power, ground and signal. With a total of six wires, power and ground can be shared among the two pots. Measure the wire so that it's long enough to each the arcade bonnet – about 1.5 inches (38mm) is suffice. 

Heat Shrink

Pieces of heat shrink tubing can be used for keeping the wires nice and tidy. This stuff is great for wire management and really easy to use. Cut off a small piece and slip it over multiple wires. Apply heat to shrink the tubing in place. The smallest diameter heat shrink will work best for 30AWG wires.

Prep Wires

Using wire strippers, remove a bit of insulation from each tip. You can tin the wires by applying a small amount of solder – This helps prevent the strands of wire from fraying when connecting them to the pins on the arcade bonnet. I suggest using a pair of helping third hands to keep the wires in place while soldering.

Prep Joystick

Before we connect our wires to the pots on the joystick, it's a good idea to tin them with some solder. To make this easier, I found a panavise very helpful – Place the body of the joystick in between the jaws and tightly secure it in place. 

Connect Wires to Joystick

With the wires and terminals now tinned with solder, we're ready to make our connections. Since I'm sharing ground and power between the two pots, I soldered two wires to the ground and power terminals on one of the pots, first. The most left terminal is ground, right is power and the middle is signal. 

Connecting Wires to Joystick

With the first pot wired, now we can connect the remaining wires to the second pot on the joystick. Reposition the joystick on the panavise and secure it so the second pots are facing up. Tin the terminals and solder the second power and ground wires. Make sure the connections are consistent with the first pot. Left is ground, right is power and middle for signal.

Connecting Joystick to Arcade Bonnet

Next, we're work on connecting the Joystick to the Arcade Bonnet. Before we do so, it's a good idea to straighten out the wires and adjust the wire lengths if necessary.  Since this project will have lots of wires, it's a good idea to keep them consistent.

Analog Joystick Wiring

Taking a look at the Arcade Bonnet, we can see the dedicated pins for hooking up an analog joystick. You should see the label "analog" and four pins, 3V, X, Y and G. It's a good idea to map out our wires and see where the connections will go. The power wire will go to the 3V pin. Ground goes to the G pin. The signal wire from the two pots go to either X or Y – These are the two axis' that make up our directional left, right, up and down controls. 

Wire Joystick to Arcade Bonnet

Now that we've planned out our wiring, we can connect the analog joystick to the arcade bonnet. Securing the PCB to the pana vise makes wiring the connections easier. I suggest tinning the pins with a bit of solder first and then insert the wires to the pins while the solder is molten. 

Wired Analog Joystick and Arcade Bonnet

And now we have our joystick wired to the Arcade Bonnet! Double check your work and thoroughly inspect your wiring. If you're using different colored wires, that will help tell the connections apart. In retrospect, I wish I had used different colored wires for the signals =] 

Tack Header to Arcade Bonnet

In order to connect the Arcade Bonnet to our Raspberry Pi, we'll need to install the included 2x20 female header. To do this, I like using mounting tack to temporarily secure the header in place. Insert the header with the pins going from the bottom of the PCB like shown in the photo. Orientation doesn't matter that much, as long as it's placed through the bottom.

Solder Headers to Arcade Bonnet

Now it's time to solder up the 40 pins! Secure the PCB to the panavise, fire up the soldering iron, crank up the fume exactor and turn up the music – Whatever you find helpful. Tin the tip of the soldering iron with a bit of solder. Place the tip of the iron over a pin, apply solder wire to the joint. Allow the solder to "soak" into the pin to make a secured connection. Repeat for all 40 pins.

Arcade Bonnet Headers

Once you've completed soldering the headers, thoroughly inspect your work. Add more solder if necessary. Remove the mounting tack from the sides once you are complacent with your work.

Wiring More Buttons

This controller will have six arcade buttons for gameplay, plus Start and Select buttons, making a total of eight arcade buttons. The Arcade Bonnet features only six JST connectors for quickly connecting arcade buttons. For anything more, we'll have to manually solder them.

Prep Button Wires

For connecting the Start and Select arcade buttons, I'm using the quick-connect wires because it's easy to hook them up to the arcade buttons. However, since we don't have enough JST connectors on the Arcade Bonnet, we'll have to cut off the connectors from our two wires and connect them like we did for the analog joystick. Prep the wires by stripping and tinning the tips of each. 

Extra Button Pins

With our wires prepped and ready to connect, take a look at the Arcade Bonnet and map out where the wires will go. Each button will need to connect to a common ground. There are a total of six available ground pins, three on each side of the PCB. Each button will need to connect to one of the pins located in the 4way stick section. You have the option to wire them into any of the four pins. 

Solder Wires to Bonnet

Now that we planned out our wiring, we can solder them into the Arcade Bonnet. I connected mine to the L and R labeled pins. These are typically used for a 4-way joystick but we can re-use them for any number of controls. Solder two of the wires to either of the ground pins. I found the ones on the right side to work well.

Arcade Bonnet Wired

And now we have our extra button wires connected to the Arcade Bonnet! It will be easy to hook them up to our arcade buttons now – Which is necessary for assembling the enclosure.

Install M3 Standoffs

To start assembling the enclosure, we'll need to install six M3 standoffs (55mm tall) into the bottom cover. Start by inserting an M3 screw into a one of the screw holes on either corner of bottom cover. While holding the screw in place, flip the bottom over and insert a standoff onto the screw thread. Then, fasten the standoff by twisting until it's fully tightened. Repeat this process for all six screw holes. 

Standoffs for Raspberry Pi

To secure the Raspberry Pi to the bottom cover, we'll need to install four M2.5 standoffs. The nylon screw and standoff set has a variety of sizes. I recommend using the shortest standoffs, which are 6mm tall. You'll need to use the longest M2.5 screws, 10mm, to install the standoffs to the bottom cover. We'll need a total of four standoffs, four screws and four nuts.

Installing Pi Standoffs

Start by inserting an M2.5 screw through the bottom of the "bottom" cover. While holding the screw in place, grab one of the M2.5 standoffs and insert into the screw thread. Twist the standoff until it's fully tightened. Repeat this process for the remaining mounting holes. Once complete, install the Raspberry Pi by resting it over the standoffs. Line up the mounting holes so the screws protrude through.

Secure Raspberry Pi

With the Raspberry Pi now resting on the screws and standoffs, we can secure the PCB by adding some hex nuts to each of the protruding screw threads. They're a little hard to get to (big fingers being the main factor) so you may find a pair of tweezers or pliers helpful to assist you. You'll need to fasten the hex nuts onto the screw threads to secure the Raspberry Pi. 

Install Side Panels

Now it's time to install the side panels. Start by laying out the side panels and mapping out where they need to go. The left panel has cutouts for the USB and ethernet port on the Raspberry Pi. The back panel has various cutouts for the HDMI port, audio jack and micro USB port for power. The front panel has two cutouts for our Start and Select arcade buttons. Each panel has two tabs that are inserted into the tabbed slots on the bottom cover. Make sure the panels are facing the correct orientation when installing.

Install Front Panel Buttons

With the panels now installed, we can install the arcade buttons to the front panel. Insert the button through the front side and secure using the included screw cap. Tighten the screw caps to secure the buttons to the front panel.

Quick Connects

Now it's time to pull our our quick-connect wires and get them ready to... connect! I recommend connecting them to the Arcade Bonnet first, and then hook them up to the various arcade buttons. It'll make it easier to manage the wiring when doing it in this order. Either way, if we want to rearrange our wiring, it's easy to do so.

Quick Connect Arcade Bonnet

Go ahead and plug in six quick connect wires to the various JST connectors on the Arcade Bonnet.

Install Buttons to Cover

Now we can install the six arcade button to the top cover of the enclosure. Twist the into the hole cutout or simply press them firmly through to install them. Flip the cover over and insert the screw caps to each button. Fasten to fully tighten and secure the arcade buttons to the top cover.

Install Joystick

Before we go ahead and connect the arcade buttons to the Arcade Bonnet, it's a good idea to secure the analog Joystick to the top cover. The mini analog joystick includes a mounting cover and some machine screws. Start by fitting the cover over the body of the joystick. Line up the mounting holes – The rubber gasket can freely rotate, so make sure the notches are aligned up with the mounting holes. Place the mounting cap over the cover and fasten the machine screws. The screws will go through the top of the mounting cap, cover and the body of the joystick. 

Connect Buttons

With the Joystick now secured to the cover, we can now start connecting the arcade buttons. It doesn't matter which wire goes to which button since we can configure the software to our preferred controls. I basically connected them based on how well I could neatly order them. Admittedly, it took a few tries to get the wires from being a tangled rats nest. With this many buttons, it's easy to neglect wire management.  

Connect Front Panel Buttons

Now's a good time to hook up the Start and Select buttons in the front panel. Make sure each button has a ground connection. The wiring is a little inconsistent since we wired two of them to the 4way joystick pins and grounds on the side of the PCB.

Install Arcade Bonnet to Raspberry Pi

With all of our controls wired to the Arcade Bonnet, we can now install it to the Raspberry Pi. Carefully place the bonnet over the Raspberry Pi headers, making sure the pins are properly aligned. Press down on the PCB to fully seat the female header to the header pins. 

Close It Up

How's those wiring looking? Hard to avoid a rats nest, I know. But it's not that important! I'm sure with more patience and time, one could trim down the wires and use more heat shrink to make them nice and tidy. Either way, it's time to close up the enclosure. You'll have to fold the wires a bit to get the cover to close. The top cover is similar to the bottom, as it has slots to allow the tabs from the panels to be inserted. Make sure the tabs from the panels are fully inserted through the slots in the top cover.

Don't forget to install the microSD card! You should already have the software setup and tested before closing shut the cover.

Secure Cover

Six more M3 machine screws are needed to secure the top cover to the six standoffs. I found some of the standoffs are a little off, so I repositioned them with my fingers, held it in place, inserted a screw and fastened in place until fully tightened. The ones in the middle are tricky to get to, so you may need to use a pointy tool to properly align it. 

Assembled Case

And now we have our case fully assembled! If you ever need to rewire the buttons, it should be pretty straight forward to do so. Just remove the six screws from the top and pop off the cover to get to the guts. The Raspberry Pi 3 features on-board WiFi, so it should be relatively easy to install ROMs and configure the controls without having to take out the microSD card.

This guide was first published on Jul 26, 2017. It was last updated on Mar 08, 2024.