USB Joystick Controller / Retro Adapter / Dual USB & PSX Joystick Controller
In order to connect Atari/Amiga style joysticks and an old X-Arcade stick with blown controller, I decided to make a USB Joystick Controller. There are a couple of similar projects on the net, but they are designed for analogue joysticks and a limited number of buttons. The X-Arcade has 12 buttons, and having extra buttons is useful for emulators like MAME.
Later, I added support for Sega Saturn, Mega Drive, Master System, Famicom (NES) and Super Famicom (SNES) controllers to create the "Retro Adapter".
A new version of the Arcade Joystick controller is also in the works. Stay tuned for more info.
BBC coverage of the original Retro Adapter and the new prototype (starts after the PacMan segment, at 1.35):
|04.03.08||Updated schematics and stripboard layouts with new diode based USB interface. Old interface used 5V signalling, new version uses more compatible 3.6V signalling.|
|27.04.08||Fixed missing pin 4 -> pin 14 wire in stripboard layouts.|
|15.06.08||Correct diode polarity and added missing D- jumper wire to stripboard layouts.|
|09.08.08||Added Retro Adapter source code.|
I found Igor Cesko's web site and his USB implementation for Atmel AVR microcontrollers. I decided to use it with an ATmega8, and modified it for use as a HID joystick. The device has X/Y axis for the joystick and 13 buttons.
The controller can also be used to convert up to three Atari style joysticks to USB, or two Neo Geo joysticks.
The AVR needs very few external components. A 12MHz crystal is used to provide accurate USB timing. Apart from that, there are just four resistors for the USB interface. Power is taken from USB, and filtering capacitors do not seem to be necessary.
The four directional switches and all buttons are simply switches to ground. Internal weak pull-ups in the AVR keep all lines high when the switches are not closed. There does not seem to be any problem with switch bounce using microswitches, or any input lag.
|Schematic||Stripboard with ISP||Stripboard without ISP|
Note 2: The stripboard layout is identical to the Retro Adapter, except that R5 and R6 are omitted. The device will work with either firmware even if they are included.
The circuit can easily be constructed on stripboard (veroboard). That is how I made the prototype, which was installed in the X-Arcade stick. See the Retro Adapter section for a two layer PCB.
I wanted to connect Sega Saturn pads to USB. Sega manufactured some USB Saturn controllers for sale in Japan, but they are very hard to get. I looked at the Saturn controller interface and realized it would not be difficult to decode. Since I had free pins on the ATmega8, I decided to also support NES/SNES controllers.
Sega Mega Drive and SG-1000 Mark III (Master System) controllers also use 9 pin connectors, and it is possible to connect them to the same port as Atari joysticks. Pin 5 is both an input for fire button 3 on Atari style sticks and +5V supply for Sega controllers. Pin 7 can supply +5V for Amiga joysticks that need it, however it will be pulled low for a few milliseconds every time the joystick is read. So far I have not found any joysticks that use +5V, as autofire circuits use the pull-ups on the fire button line to create oscillation.
|Schematic||Stripboard with ISP||Stripboard without ISP|
The Retro Adapter circuit is compatible with the Arcade Stick controller, and both can also be easily built on stripboard. The PCB can be used for both, simply changing the firmware depending on which type of controller is desired.
|Q1||12MHz Crystal, HC49U or U4 package|
|C1, C2||22pF ceramic disc capacitor|
|C3||100nF ceramic disc capacitor|
|C4||10µF electrolytic capacitor|
|R1, R2||68Ω resistor, 0.125w|
|R3||2k2Ω resistor, 0.125w|
|D1, D2||3V6 Zener diode, 0.5w|
|H1, H2, H3, H4||1 row pin headers 1|
|USB||USB-B PCB header 2|
|ISP||2x3 6 pin header 3|
|R5, R6||10kΩ resistor, 0.125w 4|
1 Makes soldering wires on easy, but you could solder them directly to the board.
2 You can also just solder a USB cable directly to the board, as I did for the prototypes.
3 The ISP header is optional. It is only needed to program the AVR microcontroller once, so if you have a pre-programmed chip it can be omitted.
4 R5 and R6 are only needed for the Retro Adapter, they can be omitted from the Joystick Controller version.
C3 and C4 are to provide protection from noise on the power supply line. I have found them to be unnecessary on every board I have made, but it is possible they may improve compatibility with very long USB cables or poor quality hubs.
Connections are shown on the schematics, and printed on the PCBs. Here is a complete list of connections for the Retro Adapter, in case you want to use the same PCB for a Joystick Controller. Pin-outs for the retro console connectors are also provided.
|Atari/Commodore/Amiga style joystick connector (male 9 pin d-sub)|
|5||Fire 3 (Amiga only)||+5V|
|6||Fire 1||A / B|
|7||+5V (Amiga only)||Select|
|9||Fire 2||Start / C|
|Sega Saturn Controller (at console)|
|Nintendo Famicom / NES Controller (at console)|
|Nintendo Super Famicom / SNES Controller (at console)|
|4||Serial Data||Serial Data|
The Famicom and Super Famicom connectors can be wires to the same pins on the Retro Adapter. Only one or the other can be used at the same time, although nothing bad will happen if both are connected. Be sure to get the +5V/GND wires the right way around!
Generic PCB connections
The same PCB can be used for the Retro Adapter, Joystick controller, and a triple Atari/Commodore joystick adapter. For the latter, extra fire buttons are used for the joystick movement of the second and third sticks. Note that stick 3 only supports one fire button, the others support 2. Of course the same technique works for dual six button joysticks, or any combination. Perfect for Robotron :)
|AVR pin||Retro Adapter||Joystick||Tripple Atari Adapter|
|2 (PD0)||Saturn 2||Up||1.Up|
|3 (PD1)||Saturn 3||Down||1.Down|
|5 (PD3)||Saturn 4||Left||1.Left|
|6 (PD4)||Saturn 5||Right||1.Right|
|11 (PD5)||Saturn 7||Button 1||1.Fire 1|
|12 (PD6)||Saturn 8||Button 2||1.Fire 2|
|13 (PD7)||Atari 5||Button 3||2.Up|
|16 (PB2)||Atari 7||Button 10 (A)||2.Down|
|17 (PB3)||Famicom 2||Button 11 (B)||2.Left|
|18 (PB4)||Famicom 3||Button 12 (C)||2.Right|
|19 (PB5)||Famicom 4||Button 13 (D)||2.Fire 1|
|23 (PC0)||Atari 1||Button 4||2.Fire 2|
|24 (PC1)||Atari 2||Button 5||3.Up|
|25 (PC2)||Atari 3||Button 6||3.Down|
|26 (PC3)||Atari 4||Button 7||3.Left|
|27 (PC4)||Atari 6||Button 8||3.Right|
|28 (PC5)||Atari 9||Button 9||3.Fire 1|
Support for other "simple" joysticks/gamepads is simply a matter of connecting the right wires up. Neo Geo, Sega Master System and most other 8 bit controllers should work without any problem.
Dual USB/Playstation Joystick Controller
After finishing the USB interface, I realised it would be useful to have a joystick that supports both USB and Playstation (PSX) connections. The PSX interface, used on both the PS1 and PS2, is a fairly simple serial protocol. The microcontroller automatically detects which interface is in use. A tri-colour LED shows which interface is active: yellow while detecting, red for PSX and green for USB.
I have one working prototype of this design. Both interfaces work perfectly. The Playstation interface is fortunately rather simple and easy to interface with. However, I ran into a problem with not having enough I/O pins on the AVR to give a reasonable number of fire button inputs as the Playstation connection requires five I/O pins to operate.
My first attempt to overcome this was to use 74153 multiplexers, similar to how the Sega Saturn controller works. Unfortunately this proved to be somewhat unstable in operation, due to the increased current requirements and switching noise. A simpler solution would be to simply use a larger AVR with more I/O pins, which is something I may look at in the future. Such an AVR could also easily support connection to Saturn and Nintendo consoles too.
Two Retro Adapter prototypes were built into a Sega Saturn multi-tap. Two NES connectors are available on the other side, not visible in the photo.