• Make your own Joystick with 990.020 MuIn USB

    Older-style gamers will appreciate this project! Everyone played with old arcade videogames well-know the pleasure offered by digital joysticks and microswitch buttons. Today older games can be easily played at home with your own pc using an emulator as MAME (or the most common graphical interface MAMEUI , also known with the old name: MAME32).

    Is great play older videogames without have a lot of coins in the pocket! But.... what you'll use for control the man or the ship in the screen just in front of you? Keyboard is not so pratical and is very easy push a button instead of another. I don't like the modern analog joysticks because they have potentiometers instead of microswitches and the buttons are so small... I need to hear the "Click Clak" when I play my older videogames!

    If you are a picmicro and a do-it-yourself addict, why don't you realize your own, old-fashioned, digital joystick? Won't be fantastic if your joystick can be connected to pc using an USB cable?

    Using some spare parts from older coin-ops, a 990.020 MuIn USB and a plastic box you can realize it in half an hour and you can enjoy a real feeling playing with your old games such as Metal Slug, Golden Axe, Pang!, Arkanoid, PacMan, Space Invaders, SnowBros etc.

    In this article I'll explain you how to realize your own arcade digital joystick! You can download the firmware ready to upload on your 990.020 MuIn USB or the source code for personalize it.

    First, you need a box. I've used a strong industrial electric enclosure:

    The joystick I've realized uses only a stick (2 axes) and 4 pushbuttons : a total of 8 microswitches. However the code can be easily edited to add a lot of other buttons. Here are the stick and buttons I've used:

    Those components are sold as spare parts for coin ops, you can easily found on internet. I've choosed the old-style red ball top stick and 4 colourful buttons.

    Notice: First to mount the stick consider check with a multimeter which microswitch are pressed when you move the stick!

    When you've stick and buttons on your hands, you can take some measurements and decide where place the components on the top of the box and then drill some nice holes:

    Disassemble the stick prior to mount it:

    then mount your colourful buttons (can you hear a voice? Is the soldier of metal slug just calling you!)

    I've added also a nice purple led near the stick:

    This led will flash during installation and then will stay turned on.

    Now get 4 F/F spacers, 8 screws and 8 plastic brackets for fix the MuIN USB into the box. Use a plastic bracket on the top and on the bottom of each of 4 holes, then put the screw into the hole and fix the spacer:

    Solder together pads numbered 1 and 2 on "I2C pullup" jumper on the bottom:

    Choose a suitable place into the box for MuIN placing, take some measures, drill 4 holes and cut a small window for easily connect an USB cable (the hole must be larger than USB receptacle):

    Using some one-row female strips, cut 9 (nine!) three-pins strips (one for each switch + 1 for the led). Remove the central pin from each strip and solder wires on the external pins:

    Don't forget to solder wires also on the buttons! For led I've soldered a small 470Ohm resistor directly on the strip:

    Group the wires, your assembly could look like this:

    The schematic of connections is simple, we're going to connect the 8 switches on PORT B:

    Using the 3-pin-female-strips as I've shown, connect the buttons on PORT B is a matter of seconds:

    Please refer to 990.020 MuIn USB datasheet to understand the connections. Leave disconnected the jumper for power selection on PORTB and PORTA. Connect the led on C2 port (remember that GND is the pin near the board border or your led will not light!).

    Well! Now we're ready to program a new firmware on MuIn USB for using it as a digital joystick! We'll use the bootloader feature: with a jumper short RB6 with RB7 on ICSP connector:

    Since we'll power the MuIN USB from USB, remember to place a jumper on "Micro" connector in direction of "Vusb" as explained in the datasheet and as showed in the above pic (red jumper).

    Connect the MuIn USB to computer and launch the bootloader software (you can download it from "download" section). Yellow led on the board will light and software will show you "device attached":

    Download the compiled HEX from here: MuIN_USB_Joystick.zip

    or download the source code from final part of this article and compile it by yourself.

    Press "program/verify" button and wait until program terminate (the message "erase/program/verify completed succesfully" will appear). Please don't push any button on joystick during this phase!

    Close bootloader software, remove the jumper from RB6 and RB7 pins and then press reset button on the MuIN USB.

    Now you can finally close the box!

    The external led (the one you've attached on RC2) begin to flash while operating system recognize the joystick. You don't need any driver since this joystick is recognized as an HID device. When joystick is installed led will turn on permanently and a new element in device panel will appear:

    Now you're ready to use your digital joystick with game you want! You can test it with an example software like this: joytester

    Source Code

    The source code is derived from the demo "USB Device - HID - Joystick" from Microchip Application Libraries (MAL) and adapted for specific use with 990.020 MuIN USB.

    If you want to personalize your joystick (adding other buttons or analog sticks) you can download the source code and edit it. You must use MPLAB C18 for compiling it. Please notice that this code probably will not work on other boards than MuIN USB!

    If you want to add other buttons on port A, provide a 10K pullup resistor for each port you want to use. On PORTB I've not used external pullup resistor since I've used the integrated pullups.

    The source code you download must to be copied into the MAL directory or it will not compile!