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).
  2. Thumb slide joystick (search eBay for "PSP 1000 Joystick").
    Sparkfun also has them:
  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

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 :)

<p>Wow! This works great. </p><p>I think I'll add some more buttons to this magnificent stick too :) </p>
<p>Looks really interesting, have ordered parts to try this myself.</p><p> Question: Is it possible to add two thumbsticks onto one Pro Micro board? I see additional A0 and A1 inputs on the diagram. Thanks!</p>
<p>Looks stupid but works like a charm! <br>i just removed the mouse nipple completly (didnt realy work anyway) and replaced it with an psp joystick. </p><p>Thx a ton for the tutorial! </p>
<p>All sorted!</p>
<p>Thank you for the tutorial - it's inspired me to try this out. </p><p>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. </p><p>Thanks again.</p>
<p>Well, I got it working by switching to 1.0.5-r2. :)</p><p>Now I just need to calibrate it properly - I'm getting the looping that other commenters have reported. </p>
<p>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?</p>
<p>Made It!<br>So cool, now i have some spare buttons i can use.</p>
<p>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?</p>
<p>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 )</p>
<p>I am a little confused, what is the best USB power supply for that the Sparkfun Pro Micro?</p>
<p>Same error as Sponge... </p><p>C:\Program Files\Arduino\hardware\arduino\avr\cores\arduino/USBAPI.h:31:2: error: 'ring_buffer' does not name a type<br>ring_buffer *_cdc_rx_buffer;</p><p>Currently running 1.6.5</p>
<p>It wont work running higher versions of the IDE. </p>
<p>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. </p><p>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 :)</p>
<p>Made it!</p><p>Also found that there was spare joining cable inside the throttle which I tugged out, so the HOTAS X now fits around my keyboard!</p><p>Thinking about routing the wire through the throttle but may think about putting on some extra buttons first, if I can think of any use for them!</p>
<p>Will the code work with a plain arduino micro?</p>
<p>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.</p>
<p>Where did you find the Leonardo drivers?</p>
<p>In the arduino software folder, in the driverspark subfolder.</p>
<p>I have no driverspark subfolder? Did you use the latest Arduino software or the old version linked here?</p>
<p>The old version, alternatively you can do a manual install through the device manager and let windows rummage through the files by itself.</p>
Got it working, thanks for the help! I'll post pictures tomorrow once I find some double sided tape to stick it on.
<p>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.</p>
<p>Here you go</p>
<p>Having this problem:</p><p>Found programmer: Id = &quot;B&raquo;&quot;; type =</p><p>Software Version = . ; Hardware Version = .</p><p>avrdude: error: buffered memory access not supported. Maybe it isn't</p><p>a butterfly/AVR109 but a AVR910 device?</p><p>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&amp;hash=item3aa9fee6a3</p>
<p>Also I still have a yellow warning in Device manager and the device is called 'Ardiuno Micro', is this right?</p>
And I have a steady green and red LED along with one regularly flashing red one?
<p>Great tutorial!</p><p>What should the code look like, if I want to have two analog thumbsticks? :)</p>
<p>I'm getting a compile error....</p><p>C:\Program Files\Arduino\hardware\arduino\avr\cores\arduino/USBAPI.h:31:2: error: 'ring_buffer' does not name a type<br> ring_buffer *_cdc_rx_buffer;</p><p>Can someone help me with this? I'm still in the learning process obviously.</p>
<p>I'm getting the same error; did you manage to resolve this?</p><p>&gt;&gt;</p><p>In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:224:0,</p><p> from thumbstick.ino:1:</p><p>C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/USBAPI.h:31:2: error: 'ring_buffer' does not name a type</p><p> ring_buffer *_cdc_rx_buffer;</p><p> ^</p><p>Error compiling.</p>
Same error i had. If you use the Arduino software v1.0.5 it will work. http://arduino.googlecode.com/files/arduino-1.0.5-r2-windows.exe
<p>Ok all rewired and it's totally solid for the most part. The Y axis is <br>now off a little though. When I push up on the stick it doesn't go <br>completely to the top and when I push down it cuts of the bottom and <br>registers up top. Anyone else run into this issue?</p>
Yep, same problem here. Did you fix it at all?
<p>Man i'm really bad at soldering, took me 30 mins to get wires to stick to the psp stick...</p>
<p>So I got it all wired up and running but I ran into a little more trouble. When I go into the controller settings the axises are going a little nuts. There just not stable, I'm heading to the electronics store here in like an hour to get some more desoldering wick. I had soldered on some headers on thinking the connection would be fairly solid but I think that's where my problem is. Going to resolder and report back.</p>
<p>So, I'm having some issues getting everything to compile, but from grimngor's post I think I found the issue. I had a feeling the Arduino IDE was too up to date. I'll do some digging around and see if I can't find 1.0.5 and post back. <br>Hey grimngor you don't happen to have any pics of the inner workings do you? I'd love to see that!</p>
<p>Well Guys it was tough but I made it! I managed to tune the hotas to place the arduino and all wiring internally. In the software side of things I had difficulties with versioning. I wa downloading the correct 1.0.5 Arduino software, but I was getting problems because of the sparkfun tools being downloades for a newer version of Arduino. So In case you have problems, be sure to download the proper one:<br>https://github.com/sparkfun/SF32u4_boards/releases/tag/pre-1.6</p><p>Thanks for all your comments, they were so helpful!</p>
<p>Like the guide.</p><p>But its taken me a long time to get to the stage im at now, was running Arduino: 1.0.6 just like <a href="https://www.instructables.com/member/waigong.lee/" rel="nofollow">waigong.lee</a> was. When i realised what the problem, i managed to upload the sketch.</p><p>But i still cant get it to work. The board dose not come up as a game contraller, so i cant use Vjoy to configure, as it dose not detect it, but comes up as &quot;<strong>SparkFun Pro Micro 5V/16MHz&quot;</strong> under Comm ports on device manager. Is this a driver issue, ive installed the Sparkfun drivers, and then selected them from the list of drives under Sparkfuns when installing the drivers for the device, is this the corect way.</p>
<p><a href="https://learn.sparkfun.com/tutorials/pro-micro--fio-v3-hookup-guide#installing-windows" rel="nofollow">https://learn.sparkfun.com/tutorials/pro-micro--fi...</a></p><p>do a sanity check against those instructions. also mine shows as &quot;HID Keyboard&quot; in devices and printers, but if i open the game controller screen from my main joystick then i can see my pro micro as &quot;USB IO Board&quot;. i've not tried vjoy as elite: dangerous lets you use more than 1 stick, so i didn't have to merge them. but just checking windows can see it in the game controller screen is the first thing to get working.</p>
<p>seeing as i never liked the rocker axis on the throttle i decided to mount the thumbstick where the rocker was. taking the throttle to bits was nice and easy, you don't need to unscrew the base. the rocker then slots out when you unscrew the mounting bracket and potentiometer. </p><p>the good news is the spring is attached to the pot, not the plastic lever, so it will stay centred and not mess with key bindings. the bad news is the gap it leaves is huge. i plugged it with a piece of cardboard cut to shape and more cardboard strips to press it into place with the mounting bracket. to get the curve without using glue i made a wedge shaped bit of cardboard.</p><p>this gave me a nice solid feeling platform to build off. i mounted the thumbstick on the far side, it's almost flush thanks to the shape of the throttle there. i used black sugru to keep the thumbstick in place and to fill in the remaining gap. you need to be careful not to go over the top of the thumbstick as the whole surface is needed for movement. one regular sachet was enough for what you see in the pic. i've not mounted the pro micro yet as i intend to add some more buttons on when i have some more time for hacking.</p><p>great instructable, this has been my first use of an adruino, a soldering iron in about 15 years, my first hack to some hardware i own and my first use of sugru. all in all i'm very pleased how things have gone. so thanks for the guidance and inspiration!</p>
<p>I used the 'replacement' psp joystick but they are crap. I recommend using original psp joystick.</p>
<p>Hi, I get this error when trying to upload the sketch:</p><p>This report would have more information with<br> &quot;Show verbose output during compilation&quot;<br> enabled in File &gt; Preferences.<br>Arduino: 1.0.6 (Windows NT (unknown)), Board: &quot;Arduino Pro or Pro Mini (5V, 16 MHz) w/ ATmega328&quot;<br>thumbstick:1: error: 'ThumbState_t' does not name a type<br>thumbstick.ino: In function 'void setup()':<br>thumbstick:23: error: 'thumbSt' was not declared in this scope<br>thumbstick.ino: In function 'void loop()':<br>thumbstick:38: error: 'thumbSt' was not declared in this scope<br>thumbstick:49: error: 'Thumbstick' was not declared in this scope</p><p>Can you help please?</p>
<p>Sorry, I've got past that problem (I hadn't installed the sparkfun drivers) but now get this when attempting to upload the sketch:</p><p>This report would have more information with<br> &quot;Show verbose output during compilation&quot;<br> enabled in File &gt; Preferences.<br>Arduino: 1.0.6 (Windows NT (unknown)), Board: &quot;SparkFun Pro Micro 5V/16MHz&quot;<br>C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino\CDC.cpp:117: error: prototype for 'void Serial_::begin(long unsigned int)' does not match any in class 'Serial_'<br>C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino\/USBAPI.h:33: error: candidate is: void Serial_::begin(uint16_t)<br>C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino\CDC.cpp:122: error: prototype for 'void Serial_::begin(long unsigned int, byte)' does not match any in class 'Serial_'<br>C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino\/USBAPI.h:33: error: candidate is: void Serial_::begin(uint16_t)<br>C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino\CDC.cpp: In member function 'virtual int Serial_::available()':<br>C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino\CDC.cpp:133: error: 'peek_buffer' was not declared in this scope<br>C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino\CDC.cpp: In member function 'virtual int Serial_::peek()':<br>C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino\CDC.cpp:141: error: 'peek_buffer' was not declared in this scope<br>C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino\CDC.cpp:143: error: 'peek_buffer' was not declared in this scope<br>C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino\CDC.cpp: In member function 'virtual int Serial_::read()':<br>C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino\CDC.cpp:148: error: 'peek_buffer' was not declared in this scope<br>C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino\CDC.cpp: In member function 'virtual size_t Serial_::write(uint8_t)':<br>C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino\CDC.cpp:163: error: no matching function for call to 'Serial_::write(uint8_t*, int)'<br>C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino\CDC.cpp:161: note: candidates are: virtual size_t Serial_::write(uint8_t)<br>C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino\CDC.cpp: At global scope:<br>C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino\CDC.cpp:166: error: prototype for 'size_t Serial_::write(const uint8_t*, size_t)' does not match any in class 'Serial_'<br>C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino\CDC.cpp:161: error: candidate is: virtual size_t Serial_::write(uint8_t)</p>
I'm not sure what changed from 1.0.5 to 1.0.6, can you try it with the 1.0.5 version?<br><br>http://arduino.googlecode.com/files/arduino-1.0.5-r2-windows.exe<br>
<p>Thanks, got it working.</p>
<p>Quick question. Now it has been set up will it just plug and play on any computer or will I have to install the Arduino software (not just drivers) to run it?</p>
<p>This works! I successfully managed to attach the Micro Pro as a second game controller and configure it as a throttle control in DCS. Right now it's just two pots, but I'm looking forward to creating my DIY cockpit in the future.</p>
<p>What headers/cable did you use for this on your example? </p>
http://www.ebay.com/itm/40pcs-20cm-2-54mm-Male-to-Female-Dupont-Wire-Jumper-Cable-for-Arduino-Breadboard-/151520442321?pt=LH_DefaultDomain_0&amp;hash=item23475277d1<br><br>A straight pin header can be soldered to the nub joystick.
<p>Nice. I'm just waiting on the PSP sticks, am going to be giving this a shot soon. </p>

About This Instructable




More by metanurb:Add a little two analog axis thumb joystick to your existing joystick. Androino! Control an Arduino from your Android device using a cheap bluetooth module. 
Add instructable to: