{"id":392,"date":"2015-07-08T15:36:01","date_gmt":"2015-07-08T23:36:01","guid":{"rendered":"http:\/\/www.simpits.org\/geneb\/?p=392"},"modified":"2015-07-08T15:38:45","modified_gmt":"2015-07-08T23:38:45","slug":"simple-to-build-joystick-interface","status":"publish","type":"post","link":"https:\/\/www.simpits.org\/geneb\/?p=392","title":{"rendered":"Simple to build joystick interface&#8230;"},"content":{"rendered":"<p>This project has been simmering on the back burner for a very long time now.\u00a0 I only recently got a chance to scrounge up a round-tuit in order to get this thing done.<\/p>\n<p>With the advent of the Arduino hardware ecosystem has come a general bar-lowering for people doing all kinds of projects.\u00a0 This especially holds true for those of us building simulators of various stripes.\u00a0 You can find Arudino-based gadgets driving instruments and masquerading as all kinds of little cockpit gadgets these days.<\/p>\n<p>One of the holes in this has been a genuinely easy to use flight control interface based on the Arduino.\u00a0 Well with the introduction of the MMJoy2 firmware as written by &#8220;mega_mozg&#8221;, this hole has been filled.<\/p>\n<p><!--more--><\/p>\n<p>mega_mozg&#8217;s firmware can run on a number of different Arduino &amp; Teensy boards, but for this article I&#8217;m going to focus on the ATMega32U4 based Pro Micro.\u00a0 This device can be had from SparkFun for about $20 <a href=\"https:\/\/www.sparkfun.com\/products\/12640\" target=\"_blank\">here<\/a> (you want the 5v version).\u00a0 You can also purchase Pro Micro clones from overseas eBay vendors for as little as $6 plus shipping.<\/p>\n<p>Using the Pro Micro as a base, it&#8217;s pretty easy to create a six axis, 32 button joystick interface that you can customize in just about any way you like.<\/p>\n<p>In order to make this pretty easy to do, I created a couple of printed circuit boards.\u00a0 One is the &#8220;main&#8221; interface board that you plug the Pro Micro into.\u00a0 It has six 3 pin headers for the axis inputs and a 4 and 8 pin header for connection to the the second board.\u00a0 The second board provides an 8&#215;4, diode isolated input matrix.\u00a0 This is how you can connect 32 buttons.\u00a0 The diodes allow for &#8220;n-key rollover&#8221;.\u00a0 You can close all the switches at once and each one will still register individually.<\/p>\n<p>The two links below are a set of Gerber files that you can send to <a href=\"http:\/\/www.oshpark.com\">Osh Park<\/a> to have boards made for you.\u00a0 Their pricing is excellent and their service is even better.\u00a0 Other vendors may be able to process the Osh Park gerber files, but no guarantees.<\/p>\n<p><a href=\"http:\/\/www.simpits.org\/geneb\/wp-content\/uploads\/2015\/07\/Pro-Micro-Joystick-Interface-28Jun15-1.zip\">Pro Micro Joystick Interface-28Jun15-1<\/a><\/p>\n<p><a href=\"http:\/\/www.simpits.org\/geneb\/wp-content\/uploads\/2015\/07\/32-Channel-Input-Board-08Jul15.zip\">32 Channel Input Board &#8211; 08Jul15<\/a><\/p>\n<p>If you like, you can order 3 of each board directly from Osh Park by using the following two links:<\/p>\n<p><a href=\"https:\/\/oshpark.com\/shared_projects\/fULmditL\">https:\/\/oshpark.com\/shared_projects\/fULmditL<\/a><\/p>\n<p><a href=\"https:\/\/oshpark.com\/shared_projects\/SsFjqyuj\">https:\/\/oshpark.com\/shared_projects\/SsFjqyuj<\/a><\/p>\n<p>When you solder up the 32 channel input board, you&#8217;ll need 32 1N4148 diodes.\u00a0 Bend them in half and solder them in with the black band (cathode) &#8220;facing&#8221; the board.\u00a0 If you zoom into the photo below, you&#8217;ll see what I mean.\u00a0 You&#8217;ll also need 9 8 pin headers and 1 4 pin header for each board.\u00a0 You can save some money by buying 1&#215;40 straight headers and break them up into 8 pin headers yourself.\u00a0 All Electronics has them for pretty cheap <a href=\"http:\/\/www.allelectronics.com\/make-a-store\/item\/shs-40\/1-x-40-header-0.1-spacing\/1.html\">here<\/a>.\u00a0 I&#8217;m sure with a little digging you could find them for even less from an overseas eBay vendor.<\/p>\n<p>You&#8217;ll also need to build two interconnect cables &#8211; 1 4 wire and 1 8 wire.\u00a0 I really like the look of crimped connectors and their shells, so I build up my own cabling.\u00a0 You can find both 4 and 8 pin connector shells and the crimp on female connectors at Hansen Hobbies.\u00a0 They&#8217;re a great bunch of people and they ship fast!\u00a0 Here&#8217;s the <a href=\"http:\/\/www.hansenhobbies.com\/products\/connectors\/pt1inconnectors\/\">page<\/a> you want.\u00a0 Order the Female Gold Terminals for .100 and the 1&#215;4 and 1&#215;8 connector shells.\u00a0 It also looks like they sell the 1&#215;40 snappable headers for less than All Electronics!<\/p>\n<p>For the Pro Micro interface board, you&#8217;ll need one of <a href=\"http:\/\/www.hansenhobbies.com\/products\/connectors\/pt1inconnectors\/pt1in_srsh_f_40\/\">these<\/a>.\u00a0 It&#8217;s like the snappable 40 pin header, but it&#8217;s a female connector.\u00a0 You&#8217;ll lose one position for each break, but you only need 2 12 pin connectors out of the 40 available.\u00a0 Note that while the Pro Micro has the same footprint as a large 24 pin IC, I recommend against using a chip socket.\u00a0 The .100 pins that the Pro Micro uses are too large for the pin pockets in a normal IC socket and they&#8217;ll be damaged and may not grip the pins properly.<\/p>\n<p>To finish the interface board, you&#8217;ll need six 3 pin headers, so order enough of the 1&#215;40 snappable headers to get the job done for both boards!<\/p>\n<p>You&#8217;ll also want to purchase six 1&#215;3 female connectors and their pins in order to connect pots or hall effect sensors to the board.<\/p>\n<p>This is what the system looks like as-built:<\/p>\n<p><a href=\"http:\/\/www.simpits.org\/geneb\/wp-content\/uploads\/2015\/07\/interface-ready-to-go.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-393\" src=\"http:\/\/www.simpits.org\/geneb\/wp-content\/uploads\/2015\/07\/interface-ready-to-go-300x186.jpg\" alt=\"interface ready to go\" width=\"300\" height=\"186\" srcset=\"https:\/\/www.simpits.org\/geneb\/wp-content\/uploads\/2015\/07\/interface-ready-to-go-300x186.jpg 300w, https:\/\/www.simpits.org\/geneb\/wp-content\/uploads\/2015\/07\/interface-ready-to-go-1024x635.jpg 1024w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>The two boards are mounted to a 3D printed panel that&#8217;s 5mm thick and attached with 8 1\/2&#8243; 4-40 M-F standoffs.\u00a0 Worked out pretty well!<\/p>\n<p>If you&#8217;ve got a 3D printer, you can download the STL file for that mounting plate here &#8211; <a href=\"http:\/\/www.simpits.org\/geneb\/wp-content\/uploads\/2015\/07\/Joystick-Interface-Mounts.zip\">Joystick Interface Mounts<\/a>.\u00a0 The zip file also contains a DXF file that you can use if you want to create a drilling pattern for mounting the boards on something other than a 3D printed panel.<\/p>\n<p>The 32 channel input board was originally going to be used with a different project, so it includes an extra 8 pin header that&#8217;s not used.<\/p>\n<p>The software you&#8217;ll need to run on the ProMicro can be found <a href=\"https:\/\/translate.google.com\/translate?sl=auto&amp;tl=en&amp;js=y&amp;prev=_t&amp;hl=en&amp;ie=UTF-8&amp;u=https%3A%2F%2Fsites.google.com%2Fsite%2Fmmjoyproject%2Ffajly-dla-skacivania&amp;edit-text=&amp;act=url\">here<\/a>.\u00a0 The original site is in Russian, so I&#8217;ve given you the Google Translate link for it.\u00a0 You&#8217;ll also want <a href=\"https:\/\/490f7bdc-a-62cb3a1a-s-sites.googlegroups.com\/site\/mmjoyproject\/fajly-dla-skacivania\/pro-micro-firmware-instructions.pdf?attachauth=ANoY7cpnrNeVmYw5KYGw-k8Jpk1NbQETLSfmpP9CGFeTrywU2EUTbYoASyPbVx694zG45-R5ouIaU77SLjRykQxAxHLXaUUMUe6ryhUDUnjUDHI1QlEpelMIlvViOJjwoHHGgRXzOobX0XJ2MZEBYpijDJK9ORn-cZhJZNdlN_11w5ty_per4MBPVxCWl0qJfuAaSAcq-v_CBbfVg8-iMHnMJ6HMdHAWFfAV3UixnbE8n7AJA6M2QSW-f9H9WN6g2QjuGibq0QFh9DQ-An-R0XkqiA0llMNegw%3D%3D&amp;amp;attredirects=0&amp;amp;d=1\">this<\/a> PDF file.\u00a0 It&#8217;s a how-to I wrote back in February on how\u00a0 you can upload the MMJoy2 firmware to the Pro Micro without having a special programmer.\u00a0 It&#8217;s a very simple and straightforward process!<\/p>\n<p>Below is a zip file that contains the configuration data used by mega_mozg&#8217;s JoySetup program.\u00a0 Once you&#8217;ve got the MMJoy2 firmware uploaded to your Pro Micro, you can pre-configure the interface using those configuration files.\u00a0 You&#8217;ll probably want to rename the device &#8211; it&#8217;s currently labeled for use as the Roll, Pitch, and Yaw interface for my F-15C project. \ud83d\ude42<\/p>\n<p><a href=\"http:\/\/www.simpits.org\/geneb\/wp-content\/uploads\/2015\/07\/Six-Axis-32-Button-Config.zip\">Six-Axis-32-Button-Config<\/a><\/p>\n<p>If you don&#8217;t want to use my configuration, you can configure the firmware using JoyTest and the diagram shown below.<\/p>\n<p><a href=\"http:\/\/www.simpits.org\/geneb\/wp-content\/uploads\/2015\/07\/Pins_Sparkfunpromicro-geneb.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-400\" src=\"http:\/\/www.simpits.org\/geneb\/wp-content\/uploads\/2015\/07\/Pins_Sparkfunpromicro-geneb-300x223.png\" alt=\"Pins_Sparkfun[promicro]-geneb\" width=\"300\" height=\"223\" srcset=\"https:\/\/www.simpits.org\/geneb\/wp-content\/uploads\/2015\/07\/Pins_Sparkfunpromicro-geneb-300x223.png 300w, https:\/\/www.simpits.org\/geneb\/wp-content\/uploads\/2015\/07\/Pins_Sparkfunpromicro-geneb.png 907w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>In JoyTest, click on the &#8220;Joysticks axes&#8221; tab and change the Source and MCU Port drop-downs to match what&#8217;s shown below.<\/p>\n<p><a href=\"http:\/\/www.simpits.org\/geneb\/wp-content\/uploads\/2015\/07\/joysetup-axis-configuration.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-401\" src=\"http:\/\/www.simpits.org\/geneb\/wp-content\/uploads\/2015\/07\/joysetup-axis-configuration-300x243.png\" alt=\"joysetup axis configuration\" width=\"300\" height=\"243\" srcset=\"https:\/\/www.simpits.org\/geneb\/wp-content\/uploads\/2015\/07\/joysetup-axis-configuration-300x243.png 300w, https:\/\/www.simpits.org\/geneb\/wp-content\/uploads\/2015\/07\/joysetup-axis-configuration.png 331w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Next, click on the &#8220;Joysticks buttons&#8221; tab and set up the button matrix rows and button matrix columns drop-downs to match the figure below.<\/p>\n<p><a href=\"http:\/\/www.simpits.org\/geneb\/wp-content\/uploads\/2015\/07\/joysetup-button-configuration.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-402\" src=\"http:\/\/www.simpits.org\/geneb\/wp-content\/uploads\/2015\/07\/joysetup-button-configuration-300x44.png\" alt=\"joysetup button configuration\" width=\"300\" height=\"44\" srcset=\"https:\/\/www.simpits.org\/geneb\/wp-content\/uploads\/2015\/07\/joysetup-button-configuration-300x44.png 300w, https:\/\/www.simpits.org\/geneb\/wp-content\/uploads\/2015\/07\/joysetup-button-configuration.png 636w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>In order to save your changes to the Pro Micro, you&#8217;ll need to click on the &#8220;Save sets to device&#8221; button.\u00a0 I <em>highly<\/em> recommend that you also click the &#8220;Save sets to file&#8221; button in order to create a backup configuration on disk.<\/p>\n<p>The interface will read either potentiometer in their 3 wire configuration, or hall effect sensors like those made by Allegro.<\/p>\n<div id=\"attachment_407\" style=\"width: 310px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/www.simpits.org\/geneb\/wp-content\/uploads\/2015\/07\/pro-micro-board-top.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-407\" class=\"size-medium wp-image-407\" src=\"http:\/\/www.simpits.org\/geneb\/wp-content\/uploads\/2015\/07\/pro-micro-board-top-300x231.png\" alt=\"Pro Micro board layout\" width=\"300\" height=\"231\" srcset=\"https:\/\/www.simpits.org\/geneb\/wp-content\/uploads\/2015\/07\/pro-micro-board-top-300x231.png 300w, https:\/\/www.simpits.org\/geneb\/wp-content\/uploads\/2015\/07\/pro-micro-board-top.png 720w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-407\" class=\"wp-caption-text\">Pro Micro board layout<\/p><\/div>\n<p>The axis input connectors are clearly labeled as to which axis you&#8217;re connecting to.\u00a0 Pin #1 (as marked on the left) is the signal input.\u00a0 Pin #2 is Vcc (+5v from the USB interface) and pin #3 is the ground.\u00a0 I arranged the pins like this to prevent any damage to the Pro Micro if you plug the connector in wrong.\u00a0 No matter what, Vcc remains in the center and can&#8217;t be shorted out by reversing the connector.<\/p>\n<p>You&#8217;ll note that the position values displayed both in JoySetup and the Windows Game Controller panel will vary wildly if there&#8217;s nothing connected to the individual axis inputs.\u00a0 If you don&#8217;t need all six, you can either disable the un-needed ones in the JoySetup program, or you can attach a jumper between pins 1 and 2 on the 3 pin joystick header.\u00a0 This will have the effect of &#8220;pinning&#8221; that particular axis to it&#8217;s largest value.<\/p>\n<p>Connecting things to the input board is pretty straightforward.<\/p>\n<p><a href=\"http:\/\/www.simpits.org\/geneb\/wp-content\/uploads\/2015\/07\/32-channel-input-board-top.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-412\" src=\"http:\/\/www.simpits.org\/geneb\/wp-content\/uploads\/2015\/07\/32-channel-input-board-top-300x300.png\" alt=\"32 channel input board - top\" width=\"300\" height=\"300\" srcset=\"https:\/\/www.simpits.org\/geneb\/wp-content\/uploads\/2015\/07\/32-channel-input-board-top-300x300.png 300w, https:\/\/www.simpits.org\/geneb\/wp-content\/uploads\/2015\/07\/32-channel-input-board-top-150x150.png 150w, https:\/\/www.simpits.org\/geneb\/wp-content\/uploads\/2015\/07\/32-channel-input-board-top.png 781w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>You&#8217;ll connect your four pin cable to the header marked &#8220;COLUMNS&#8221; and your eight pin cable to &#8220;J1&#8221; directly to the right of the COLUMNS connector.\u00a0 J8 is unused.<\/p>\n<p>Each of the columns are wired together and work in conjunction with the row inputs along the right half of the board.<\/p>\n<p>C-1 handles inputs 1-8, C-2 handles 9-16, etc.\u00a0\u00a0 In order to wire in a switch, you&#8217;ll connect one pin from the column connectors to\u00a0 your one leg of your switch and the other leg of the switch will be connected to one of the row pins.\u00a0 The row headers have their pin #1 on the leftmost position of each 8 pin header.<\/p>\n<p>That&#8217;s all there is to it!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This project has been simmering on the back burner for a very long time now.\u00a0 I only recently got a chance to scrounge up a round-tuit in order to get this thing done. With the advent of the Arduino hardware ecosystem has come a general bar-lowering for people doing all kinds of projects.\u00a0 This especially [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-392","post","type-post","status-publish","format-standard","hentry","category-diycockpit"],"_links":{"self":[{"href":"https:\/\/www.simpits.org\/geneb\/index.php?rest_route=\/wp\/v2\/posts\/392","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.simpits.org\/geneb\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.simpits.org\/geneb\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.simpits.org\/geneb\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.simpits.org\/geneb\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=392"}],"version-history":[{"count":13,"href":"https:\/\/www.simpits.org\/geneb\/index.php?rest_route=\/wp\/v2\/posts\/392\/revisions"}],"predecessor-version":[{"id":416,"href":"https:\/\/www.simpits.org\/geneb\/index.php?rest_route=\/wp\/v2\/posts\/392\/revisions\/416"}],"wp:attachment":[{"href":"https:\/\/www.simpits.org\/geneb\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=392"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.simpits.org\/geneb\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=392"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.simpits.org\/geneb\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=392"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}