DIY Joystick

Well, failing to find a C64 zipstick/competition pro style joystick for a reasonable price, I’m going to have a bash at making one from arcade parts…. should be fun.

For anyone who might be wondering, here is a photo of a zip stick joystick that I stole from google…

I hope to have my joystick look a little like it when finished!

The stick and buttons just arrived in the post!
The stick is about 4cm from the metal plate to the very bottom, so the box will have to accommodate that. the buttons have a little wiggle to them, maybe a little tape on the inside will make them feel a bit better.
I have a space Arduino (style) pro-micro to use as the brains of the thing, now I just need to buy a nice plastic box to put it in.

First we apply some masking tap to avoid scratching up the nice shiny plastic!
Now, as the edges are rounded, it will make measuring tricky, so here’s a tip, sit the box on a table, and slide a pen across the same table to draw a line near the edge, then use this line to measure from!

Right, now that we made it possible to measure things along the top of the box, forget it, the metal plate from the joystick is just the right size and lines up exactly with the edges of the box, so well just draw around the holes! Same for the nuts for the buttons…

Then we cut out some little holes with an unbranded multi-tool…

Next we warm up the soldering iron…

Anyone who has ever looked will notice that this style joystick is nothing more that simple switches. So I have soldered one side of each switch to GND and gave each of the other sides of the switches their own pin on the arduino pro micro.

The software shouldn’t be too hard from this point…

There are about 125,000 examples of arduino joysticks, so I stole this one

And edited the code a little to allow two buttons.

// Simple gamepad example that demonstraits how to read five Arduino
// digital pins and map them to the Arduino Joystick library.
//
// The digital pins 2 - 7 are grounded when they are pressed.
// Pin 2 = UP
// Pin 3 = RIGHT
// Pin 4 = DOWN
// Pin 5 = LEFT
// Pin 6 = FIRE
// PIN 7 = FIRE
// NOTE: This sketch file is for use with Arduino Leonardo and
// Arduino Micro only.
//
// by Matthew Heironimus
// 2016-11-24
//--------------------------------------------------------------------

#include

Joystick_ Joystick(JOYSTICK_DEFAULT_REPORT_ID,JOYSTICK_TYPE_GAMEPAD,
2, 0, // Button Count, Hat Switch Count
true, true, false, // X and Y, but no Z Axis
false, false, false, // No Rx, Ry, or Rz
false, false, // No rudder or throttle
false, false, false); // No accelerator, brake, or steering

void setup() {
// Initialize Button Pins
pinMode(2, INPUT_PULLUP);
pinMode(3, INPUT_PULLUP);
pinMode(4, INPUT_PULLUP);
pinMode(5, INPUT_PULLUP);
pinMode(6, INPUT_PULLUP);
pinMode(7, INPUT_PULLUP);

// Initialize Joystick Library
Joystick.begin();
Joystick.setXAxisRange(-1, 1);
Joystick.setYAxisRange(-1, 1);
}

// Last state of the buttons
int lastButtonState[6] = {0,0,0,0,0,0};

void loop() {

// Read pin values
for (int index = 0; index < 6; index++)
{
int currentButtonState = !digitalRead(index + 2);
if (currentButtonState != lastButtonState[index])
{
switch (index) {
case 0: // UP
if (currentButtonState == 1) {
Joystick.setYAxis(-1);
} else {
Joystick.setYAxis(0);
}
break;
case 1: // LEFT
if (currentButtonState == 1) {
Joystick.setXAxis(-1);
} else {
Joystick.setXAxis(0);
}
break;
case 2: // DOWN
if (currentButtonState == 1) {
Joystick.setYAxis(1);
} else {
Joystick.setYAxis(0);
}
break;
case 3: // RIGHT
if (currentButtonState == 1) {
Joystick.setXAxis(1);
} else {
Joystick.setXAxis(0);
}
break;
case 4: // FIRE
Joystick.setButton(1, currentButtonState);
break;
case 5: // FIRE
Joystick.setButton(0, currentButtonState);
break;
}
lastButtonState[index] = currentButtonState;
}
}

delay(10);
}

Here is a nice photo of the finished joystick. It works great for old C64 games etc.