Add a Little Two Analog Axis Thumb Joystick to Your Existing Joystick.

45,866

62

50

Published

Introduction: Add a Little Two Analog Axis Thumb Joystick to Your Existing Joystick.

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

  1. Sparkfun Pro Micro (or some other board with an ATmega32U4, check eBay).
    https://www.sparkfun.com/products/12587
  2. Thumb slide joystick (search eBay for "PSP 1000 Joystick").
    Sparkfun also has them:
    https://www.sparkfun.com/products/9426
  3. 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
#define THUMBSTICK_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 :)

11 People Made This Project!

Recommendations

  • Clocks Contest

    Clocks Contest
  • Water Contest

    Water Contest
  • Creative Misuse Contest

    Creative Misuse Contest

50 Discussions

Updated Hookup Guide link: https://learn.sparkfun.com/tutorials/pro-micro--fi...

Make sure to install the drivers from there.
I also used the Arduino addon from the hookup guide, not the one in this instructable (the one you unzip to arduino/hardware).
So instead of selecting the "Sparkfun Pro Micro 5V/16MHZ" board, I picked "Sparkfun Pro Micro".
My own Sketch is basically the provided thumbstick.ino, but modified thanks to ThanitK's comment.

I included the "Joystick" library from https://www.instructables.com/id/Arduino-Leonardo... in my Sketch, called "Joystick.begin()" in setup() and in the loop function, where the original Sketch calls "Thumbstick.setState(&thumbSt)", I call "Joystick.setXAxis()" and "Joystick.setYAxis()"

Looks really interesting, have ordered parts to try this myself.

Question: Is it possible to add two thumbsticks onto one Pro Micro board? I see additional A0 and A1 inputs on the diagram. Thanks!

Thank you for the tutorial - it's inspired me to try this out.

I read that this won't work on the 1.6.9 IDE. Would anyone be able to point me in the direction of a tutorial that works on that version, or point out the changes necessary to get it working? I'd like to learn from looking at a working example and build up my knowledge from there.

Thanks again.

1 reply

Well, I got it working by switching to 1.0.5-r2. :)

Now I just need to calibrate it properly - I'm getting the looping that other commenters have reported.

All works fine! Though this puzzles me, Everytime I restart my computer I need to upload the sketch again. (and then calibrate) Is that just the way these things go? Or is it some win 10 thing?

I see you are using connectors for the wires, can you advise me on what connectors to use, or if there are headers for this board?

1 reply

Hi Dave, I just soldered wires directly to the arduino micro, after thorough testing of course. For more temporary connectors, these work well: ( http://tinyurl.com/z434axu )

I am a little confused, what is the best USB power supply for that the Sparkfun Pro Micro?

Same error as Sponge...

C:\Program Files\Arduino\hardware\arduino\avr\cores\arduino/USBAPI.h:31:2: error: 'ring_buffer' does not name a type
ring_buffer *_cdc_rx_buffer;

Currently running 1.6.5

1 reply

It wont work running higher versions of the IDE.

Hi, I got it to work with Arduino IDE 1.0.5. But, The joystick is looping. For example: if I push up on the thumbstick the + will move upward. As I continue to move the thumbstick up to it's full extent, the + loops to the bottom, so now I'm going 'down' while the stick is pointing up.

I have the same problem with the Y axis. I have a feeling that the problem is in the .ino file, but I can't be sure. Any help would be appreciated... Thanks :)

All right, got myself a clone called leonardo pro micro, it's seen as an arduino leonardo. Wouldn't upload unless you install arduino leonardo drivers and select the board as an arduino leonardo. Other than that, works like a charm.

I have no driverspark subfolder? Did you use the latest Arduino software or the old version linked here?

The old version, alternatively you can do a manual install through the device manager and let windows rummage through the files by itself.

Got it working, thanks for the help! I'll post pictures tomorrow once I find some double sided tape to stick it on.

Manual install isn't working - I somehow have the device recognised as a Arduino Micro and if I try to install drivers for the Leonardo it fails every time. No idea how I can stop the PC recognising it as the wrong device.