Add a Little Two Analog Axis Thumb Joystick to Your Existing Joystick.
Intro: 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
- Sparkfun Pro Micro (or some other board with an ATmega32U4, check eBay).
https://www.sparkfun.com/products/12587 - Thumb slide joystick (search eBay for "PSP 1000 Joystick").
Sparkfun also has them:
https://www.sparkfun.com/products/9426 - 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 :)
48 Comments
Yuuseki 6 years ago
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()"
alexkyriak 7 years ago
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!
the100thmonkey 7 years ago
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.
the100thmonkey 7 years ago
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.
RadekJ3 8 years ago
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?
DaveC88 8 years ago
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?
ElliottZ 8 years ago
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 )
DaveC88 8 years ago
I am a little confused, what is the best USB power supply for that the Sparkfun Pro Micro?
leviwilner 8 years ago
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 :)
IgorT4 9 years ago
Will the code work with a plain arduino micro?
IgorT4 9 years ago
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.
Vindicore 8 years ago
Where did you find the Leonardo drivers?
IgorT4 8 years ago
In the arduino software folder, in the driverspark subfolder.
Vindicore 8 years ago
I have no driverspark subfolder? Did you use the latest Arduino software or the old version linked here?
IgorT4 8 years ago
The old version, alternatively you can do a manual install through the device manager and let windows rummage through the files by itself.
Vindicore 8 years ago
Vindicore 8 years ago
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.
IgorT4 9 years ago
Here you go
Vindicore 8 years ago
Having this problem:
Found programmer: Id = "B»"; type =
Software Version = . ; Hardware Version = .
avrdude: error: buffered memory access not supported. Maybe it isn't
a butterfly/AVR109 but a AVR910 device?
I have this Pro Micro: http://www.ebay.co.uk/itm/Arduino-Pro-Micro-Leonardo-compatible-5V-16MHz-ATmega32U4-headers-UK-TESTED-/251960157859?pt=LH_DefaultDomain_3&hash=item3aa9fee6a3
Vindicore 8 years ago
Also I still have a yellow warning in Device manager and the device is called 'Ardiuno Micro', is this right?