Overview

A Gamepad with Cherry MX Switches

In this tutorial, we'll build a custom PCB for Cherry MX switches and the Adafruit Feather 32u4 Bluefruit LE to make a custom gamepad. We'll design and 3D print an enclosure and custom keycaps. This project is great for casual gaming, or creating custom controllers for various applications.

Cherry MX Switches

The Cherry MX switches are found in most gaming keyboards and offer a really satisfying click. Instead of remaking a full sized keyboard or standard keypad, I thought it’d be really cool to make a gamepad. There are lots of options for mechanical keyboards, but I don’t think I’ve seen a gamepad with Cherry MX switches. It’s not exactly the most practical use of cherry MX switches, but I think it makes a fun project :-)

Mechanical Keyboards

This project was inspired by Pseudorandom 04: Mechanical Keyboards. Check out Collin's video for a deep dive into the many nuances of mechanical keyboards and a little bit of history.

Prerequisite Guides

We recommend walking through the following tutorial to get familiar with the components used in this project.

Tools & Supplies

The following tools and supplies will assist you in completing this project.

Software

Adafruit Feather 32u4 Bluefruit LE Arduino Libraries

Be sure to follow the guide below to install the board and libraries. When you've successfully install the Bluefruit Arduino libraries, come back here and continue the tutorial.

Uploading Sketch to Adafruit Feather BLE

To load the sketch make sure the libraries above are installed, and the Arduino is connected to the computer through a USB cable.  Under the Tools -> Board menu make sure the Adafruit Feather 32u4 is selected, and under the Tools -> Port menu the serial port for the Adafruit Feather is selected.  

Then press the upload button or click the Sketch -> Upload item to send the code to the Arduino.  Woo-hoo the sketch should be running.

Customizing Arduino Sketch

You can modify values in the code to make different keyboard characters or set GPIO pins.

On line 108, you can change which GPIO pins will connect to the Cherry MX switches.

On line 109, the array lists which keyboard characters correspond with the GPIO. The keycode.h file contains all of the available keyboard characters. 

Connecting to Adafruit Bluefruit Device

Before you can use the HID keyboard, you will need to 'pair' it to your phone or PC. The pairing process establishes a  connection between the two devices, meaning that as soon as your phone or PC sees the Bluefruit LE module again it will automatically connect.
The exact procedures for pairing the keyboard will varying from one platform to another.

The Bluefruit Keyboard will appear in an available list in the Bluetooth device settings. Just select connect/pair.

Circuit Diagram

Wired Connections

The circuit diagram above shows how the components can be wired together. If you don't want to create the custom PCB, you can optionally wire the switches to the GPIO pins on the Adafruit Feather. This won't be 100% exact in the actual circuit but it's a very close approximation.

  • Slide switch to EN pin on Adafruit Feather 32u4 Bluefruit LE
  • Slide switch to GND pin on Adafruit Feather32u4 Bluefruit LE
  • Pin 5 from Adafruit Feather32u4 Bluefruit LE to Switch 1
  • Pin 6 from Adafruit Feather32u4 Bluefruit LE to Switch 2
  • Pin 9 from Adafruit Feather32u4 Bluefruit LE to Switch 3
  • Pin 10 from Adafruit Feather32u4 Bluefruit LE to Switch 4
  • Pin 11 from Adafruit Feather32u4 Bluefruit LE to Switch 5
  • Pin 12 from Adafruit Feather32u4 Bluefruit LE to Switch 6

Battery Power

The circuit will be powered by a 3.7V 350mAh Lithium ion battery via JST connection. The battery plugs directly into the Adafruit Feather 32u4 Bluefruit LE, which also has a built-in charging circuit over microUSB.

3D Printing

3D Printing Enclosures

I drew up an enclosure in Autodesk Fusion 360 and designed some custom keycaps so that I can print them in different colors. I 3D printed the enclosure using the Sigma 3D Printer from BCN3D. But, If you don’t have access to a 3D printer, you could use a service like 3D Hubs to make it for you. I used PLA material to 3D print the parts, and they didn’t require any support material.

Slice Settings

Depending on your 3D printer, you may need to adjust the slice settings. We tested the enclosure  on a Sigma BCN3D. They do not require any support material and are oriented to print "as is".

  • Nozzle: 0.4mm
  • Extrusion Multiplier: 1.0
  • Extrusion Width: 0.48mm
  • Layer Height: 0.2mm
  • Nozzle Temperature: 220c

Enclosure & Keycap Design Tutorial

For an indepth tutorial on how to design the enclosure and keycaps, you can watch my layer by layer tutorial.

Custom PCB

Circuit Board Design

You can design a custom PCB for Cherry MX switches in Eagle CAD. I used the express version, which is free to download on the Cadsoft website.

Eagle CAD Tutorial

You can learn how to use eagle cad by watching my tutorial on YouTube. In the tutorial, I walk through the interface and design a custom PCB step by step. I used the Adafruit Library for Eagle to make an Adafruit Feather compatible board. I also used a Cherry MX Library for getting the footprint for the switches.

Resources

Here are some links to some other tutorial and eagle cad libraries I used to build this project.

CNC Milling a PCB

I used the Othermill Pro CNC machine make the board. FR-1 single sided material has a thin layer of copper which is ideal for making traces on PCBs. But If you don’t have a access to a CNC machine, you could use service like Oshpark to fabricate your design which actually produces much higher quality PCB. But the Othermill Pro makes nice prototypes in a fraction of the time.

Assembly

Install Headers on Feather

Let's start this build by installing headers onto the pins of the Adafruit Feather. The Feather should have shipped with two sets of headers. They come with extra pins, so you'll need to trim so they fit into the pins. Once installed, you can secure it to a breadboard. This will make the soldering the headers much easier.

Solder Headers on Adafruit Feather

Once the header pins are in place, solder each pin to create solid connections.

Remove Header Joiners from Headers

In order to create the proper clearances for mounting to the enclosure, you'll need to remove the plastic "joiners" from the two headers. I used a pair of flush diagonal cutters to lift the plastic away from the pins.

Be careful not to cut the pins while removing the plastic joiners! 

Install Feather to PCB

Once the plastic joiners are removed from the headers, you should be able to install the Adafruit Feather into the Cherry MX PCB. The microUSB port should be facing the edge of the PCB. The two PCB's should be flush with each other.

Secure PCB to Vise

Now it's time to solder the pins from the Adafruit Feather to the Cherry MX PCB. I recommend using a Panavise Jr. to secure the PCB while you solder.

Solder Feather to PCB

With the Cherry MX PCB secured, you can solder the pins on the four corners to secure the Adafruit Feather in place, then solder the pins from the switches.

Trim Pins on Feather 

You'll need to trim the excess pins from the Adafruit Feather. I recommend using flush diagonal cutters. Pro Tip: Place the tip of your finger over the pin before cutting – this will prevent the pin from becoming a projectile.

Install Cherry MX Switch to PCB

With the Adafruit Feather soldered to the Cherry MX PCB, it's time to install the Cherry MX switches. I suggest installing just one. I recommend using mounting tack to temporarily hold it in place while you solder.

Solder Switches to PCB

Once a single switch is in place, solder the pins to the Cherry MX PCB. Then, repeat this process for the other switches. DO NOT install / solder the switch that is closest to the JST port on the Adafruit Feather. If we do, it will become difficult to connect the lipo battery.

Check Point

Before we can solder the last Cherry MX switch, we'll need to connect the male JST connector from the battery to the female JST connector on the Adafruit Feather – If we connect it now, the circuit will automatically power on. So, before connecting the battery, we'll need to wire in a Slide Switch to power the circuit off.

Prep Slide Switch

Set the Cherry MX PCB aside and grab the slide switch and two pieces of wire. They can be about 100mm (4inches) in length.

Strip and Tin Wires

Use wire strippers to remove about 10mm of insulation from the tips of each wire. Then, secure them to a pair of helping third hands. Once secured, you can tin the exposed wires by applying a bit of solder – This will make it easier to connect the wires to the lead of the slide switch. Tinning wires also prevent stranded wires from fraying.

Solder Wires to Slide Switch

We'll only need two of the three leads from the slide switch, so we can remove one (either the far left or right, but not the middle!) Secure the slide switch to the helping third hands and tin the two remaining leads. Then, solder the wires to the leads on the slide switch.

Connect Slide Switch to Feather

Now we can connect the wires from the slide switch to the Adafruit Feather. Secure the PCB to the panavise jr. Then, solder one wire form the switch to the EN labeled pin (enable) and the other to the GND (ground) pin on the Adafruit Feather. Doesn't matter which wire goes where, as long as they have a solid connection.

 

OK, now that we have our slide switch wired to the Adafruit Feather, we can connect the battery. Flipping the switch switch will allow you to power the circuit on and off.

Install Last Switch to PCB

Now it's safe to install the last switch to the PCB. Again, use mounting tack to keep the switch in place while you solder the final connections.

Solder Last Switch to PCB

Solder the two pins from the remaining Cherry MX switch to the PCB.

Final Circuit

HUZZAH! Now our circuit is complete :-) In the next page, we'll finalize the build and mount the completed circuit to the 3D printed case. Zoom!

Final Build

Install PCB into Case

OK, now it's time to mount our Cherry MX PCB to the enclosure – It's in two pieces, so we'll insert the PCB to the bottom part. There's several standoffs with little nubs that will snap into the mounting holes on the PCB. You may need to insert the PCB at an angle to properly fit the PCB. Press the PCB down into the nubs from the standoffs fit into the mounting holes.

Mount Switch to Case

Insert the slide switch in the little holder on the bottom center of the enclosure. Insert it at an angle so the actuator pokes through the opening and press it down until the housing of the switch is secured to the holder.

Mount Battery to Case

I suggest using a piece of foam tape or mounting tack to secure the battery to the enclosure. There's an empty spot for the battery, right next to the slide switch.

Install Cover

Now we can place the cover over the circuit. The cut outs on the cover will line up with the Cherry MX switches.

Snap Case Close

The two piece enclosure is designed to snap fit together. The bottom case has a lip with a grove where the cover will grab onto. Press the to pieces together until they "click" into place.

Install Keycaps

Lastly, we can install a 3D print keycap (or regular keycap) into each of the Cherry MX switches. The 3D printed keycaps must be inserted correctly with the stem lined with the actuator.

Final Build

And now we have a custom gamepad with Cherry MX switches! Experiment with different keycaps. I used mine to play games, but you could use it to control various applications. 

Share You Creation!

Did you build one? Take a photo, post and share it with us! You can tag us on Instagram or @ us on Twitter. We'd love to share it on the Adafruit blog and our 3D Hangouts show

This guide was first published on Dec 21, 2016. It was last updated on Dec 21, 2016.