After I bought a Thrustmaster Flight Hotas Stick X for Elite Dangerous, I wanted two additional analog axes for lateral/vertical thrust.
After some googling, I stumbled over this nice blog entry: Turning an Arduino Leonardo into a joystick and after reading it, I knew what to do :)
The ATmega32U4 on that board has a USB core build into it, which makes building various USB HID devices very easy.
You only need some basic soldering skills to perform this Instructable, no deeper electronics knowledge is assumed!
This mod gives you a standalone analog joystick with just two axes.
It's so small, you can mount it to a bigger joystick.
I used scotch double sided mounting tape which works really well, to stick it to the throttle stick on my hotas.
Step 1: Hardware
- Sparkfun Pro Micro (or some other board with an ATmega32U4, check eBay).
- Thumb slide joystick (search eBay for "PSP 1000 Joystick").
Sparkfun also has them:
- 4 pieces of wire and a soldering iron.
Just solder the 4 pads of the joystick to GND/VCC/A2/A3 pins of your Pro Micro (see image with pin assignments).
Use double sided mounting tape or Sugru to mount the stick to your joystick.
Step 2: Software
Arduino (tested with v1.0.5).
Download https://github.com/sparkfun/SF32u4_boards/archive... and unzip it into your arduino/hardware folder.
This adds some new items to Tools->Board (follow the sparkfun hookup guide if you have problems).
Make backups of your original HID.cpp and USBAPI.h files inside your arduino/hardware/arduino/cores/arduino folder and replace them with the two files from this Instructable. (Move the backup files out of the original folder or Arduino will complain if they have .cpp or .h as the extension!).
In the file HID.cpp are three lines starting at line 27.
// #define KBAM_ENABLED
// #define JOYSTICK_ENABLED
In my version of the file, #define THUMBSTICK_ENABLED is uncommented which is fine for our two axis joystick.
If you later want to use one of the other settings for a project, just uncomment the line you need (only one at a time!).
Download thumbstick.ino and open it with the Arduino IDE set the board to SparkFun Pro Micro 5V/16MHz and upload the sketch.
Depending on the orientation of the joystick you might have to swap the second and third parameters to the map() functions from "400, -400" to "-400, 400", this inverts the axes.
Now Windows should have a new entry named "USB IO Board" under game controllers.
Elite Dangerous supports multiple joysticks at once but if you want to use it with a game that only supports one joystick, you can bind different joysticks together into a virtual one with UJR and vJoy.
Step 3: Conclusion
The Pro Micro is a really cool little device that makes it super easy to build your own joystick, mouse or keyboard device.
If you want more axes or additional buttons have a look at the example at Turning an Arduino Leonardo into a joystick this gives you a 6 axis, 32 button, 2 hat switch - monster :)