loading
There are some nice emulators for vintage video games and computers out there, for example WinVice for commodore hardware like the C64, but how do you connect old joysticks to your PC, like the Competition Pro (the original one, with 9-pin D-sub for an original C64, not the USB version) ? Most emulators provides joystick emulation with the cursor keys or other configurable keys. So this project is one solution for this problem: a Freescale microcontroller implements an USB keyboard and translates the up/down etc. buttons to keyboard events, like if you have pressed the cursor keys.

Programming the microcontroller and testing the joystick with WinVice and International Karate:




Step 1: Tools

See the images for some useful tools for this project and consumption items for soldering: soldering flux, solder, and desoldering wire. A cotton bud is useful for applying the soldering flux.

I recommend a good regulated soldering iron with a 1 mm tip for the SMD parts, like my i-CON 1. The easiest way to solder it is a stereo microscope, but magnifying glasses works, too. But with some practice, the SOP-20 IC needed for this project can be soldered without any magnifying.

Step 2: Parts

The parts list:

C1, C2: 1 uF
C3, C4, C6: 100 nF
C5: 10 uF
IC1: MCP1703CB, Digikey MCP1703T-3302E/MBCT-ND, 0.52 €
IC2: MC9S08JS16L, Digikey MC9S08JS16LCWJ-ND, 0.92 €
IC3: 8 MHz crystal oscillator, Digikey CW515CT-ND, 2.20 €
R1, R2: 33 ohm
R3, R4: 1 k
R5: 1 k
RED-LED: 5 mm LED, 0.20 €
BLUE-LED: 5 mm LED, 0.20 €
S1: programming momentary button, Farnell 1550254, 0.88 €
S2: on/off switch
X1: USB connector, e.g. Farnell 1654060, 1.22 €
X2: sub-D, 9 pin, e.g. Farnell 1653939, 0.33 €

See the images for some of the parts. For the momentary button I like this type, stable and nice to press. For the PCB I have used the type with soldering points on one side, you can get it cheap at eBay. For connecting the USB connector, I have soldered thin wire, 0.4 mm silver-plated copper wire, and for mounting the USB stick I have soldered thick wire, 1 mm silver-plated copper wire, which I soldered at the four outer contacts of the USB connector, which is pretty stable. For the SMD IC you can get cheap adapters from eBay. So without the wire coils, in sum you can build it for less than 20 €.

Step 3: The Board

See the images for the soldered board and the schematic. Eagle schematic file: http://www.frank-buss.de/joystickadapter/eagle/joystickadapter.sch


Step 4: The Software

The developing environment

Freescale provides a free IDE, CodeWarrior Development Suite - Special ( http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=CW-SUITE-SPECIAL ), which is limited to 32 kB, but the chip has only 16 kB anyway, so this is no problem. The microcontroller has an integrated bootloader, so no programmer is required, just the "BOOTLOADER_GUI" from http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=S08JS&fpsp=1&tab=Design_Tools_Tab .

The firmware

http://www.frank-buss.de/joystickadapter/firmware.zip  containts the project file for Code Warrior and all sources. It is based on the keyboard example from the Freescale USB Stack. You can change the switch detection for other types of joysticks in main.c and the key event generation in keyboard.c. The HID protocol is not based on key-press and key-release events, but you have to fill the HID buffer each time it is called with the scancode of all keys currently pressed.


<p>Does it work on Linux/Raspberry ?</p>
Hi Frank! Nice work! I had the same idea.<br> I built one based on Atmel atmega8 because I don't know very much about Freescale's microcontrollers.<br> <br> See my site at <a href="http://www.retronicdesign.com" rel="nofollow">http://www.retronicdesign.com/ </a><br> Cheers!
Nice, your product looks very professional. I guess you are using V-USB and low-speed USB? How much latency do you have? With the Freescale microcontroller I can use full speed USB and can set the HID update rate to 1 ms.
Hum interesting... I might have a look to Freescale products. I tried Atmel's own hardware USB controllers but they are quite expensive for what they bring more for this application. <br> <br>Actually, my design is based on Igor Cesko's design. <br> <br>Latency is not an issue here. Low speed USB is more than enough for joystick interfacing.
Do SEGA Genesis/Megadrive and Atari 2600/7200 controllers work on it? I'm pretty sure 2600/7200 ones should work on them, since they work the same, and have the same plug. The SEGA Genesis/Megadrive uses the plug too, and it would be nice if they would work on this.
The pinout of the C64:<br><br>http://old.pinouts.ru/Inputs/ControlPortC64_pinout.shtml<br><br>So yes, the Sega Genesis joysticks would work with it, too, see this pinout:<br><br>http://pinouts.ru/Game/genesiscontroller_pinout.shtml<br><br>But you would have to connect pin 7 to GND to select button A or to +5V to select button B and you won't have button C with my current schematic. So you could play C64 games with a Sega Genesis joystick, but if you like to play Sega Genesis games e.g. in Mame, my schematic would need to be extended, but should be not too difficult.<br><br>The pinout of the Atari 2600:<br><br>http://old.pinouts.ru/Inputs/JoystickAtari2600_pinout.shtml<br><br>So this would work without problems.
Cool, I love playing retro games, specially Commodore 64 games, because it was my first computer. I was thinking about making an adapter using a keyboard controller (&quot;keyboard hack&quot;). Your solution seems more professional.
Thanks. I plan to make a PCB for it, so that it is easier to rebuild for others, and maybe a kit. Could be enhanced to support a wider range of old joysticks, or any other hardware, which needs to send keyboard events.

About This Instructable

18,143views

36favorites

More by Frank Buss:Windows XP and PicoScope installation on a Mac with VirtualBox C64 USB Joystick Adapter Using a Quadrature Encoder with an ATtiny 2313 and an OLED Display 
Add instructable to: