|
||||||||
|
||||||||
| Cette page est aussi disponible en français | ||||||||
| The idea | [hide] |
When playing NES and SNES games with an emulator, nothing is better than using
the original gamepads (and mouse).Many people like me have been happy doing this with homebuilt parallel port adapters for years but unfortunately, parallel ports are becoming less common these days. USB is now the way to go for such devices so I decided to build my own NES/SNES gamepad to USB adapter. However, due to the way USB works, the adapter is a little more complicated. Note: There is now a new version which supports up to 4 NES and/or SNES controllers at the same time. |
| News | [hide] |
|
| Solution overview | [hide] |
I built my adapter using an ATmega8 microcontroller from Atmel. This microcontroller
does not support USB in hardware so I used the software-only usb driver
from Objective Development. This
driver allows an AVR microcontroller such as the ATmega8 to talk USB with minimal external components.
As a result, the interface can be built cheaply and easily, thanks to the low
component count.
Depending on your skills, you may build the interface using breadboard and thru-hole components or
the surface mount version, using the PCB artwork I provide. I also sell pre-assembled PCBs,
and pre-programmed Atmega8 (dip package only).No drivers required! That's right, since the USB standard defines device classes. I'm using the human input device (HID) which allows me to tell to the computer that the connected USB device is a joystick and has 2 axis and 4 or 8 buttons. Another nice thing about this is that the adapter should work with all operating systems supporting HID devices. (I tested and it works at least on Win98, Win2K, WinXP and Linux) |
| Schematic | [hide] |
Here is the schematic:
A pdf version is also available (easier to look at and prints nicely): sch-revD.pdf Component list:
For the USB connection, just strip the USB cable and solder the wires directly to the board. USB uses standard wire colors:
Previous schematic revisions: schematic-revA.png schematic-revA.pdf sch-revB.png sch-revB.pdf |
| Programming the microcontroller | [hide] |
A microcontroller is a component which must be programmed in order to do
something useful. So here is the hexfile which must be uploaded to the microcontroller:
Many microcontrollers have what is called 'Fuse bytes'. In the case of the ATmega8, there are two bytes: The high byte, and the low byte. Those bytes are used to configure some aspects of the microcontroller. What type of clock to use? Crystal? Resonator? Internal RC clock? Allow programming via ISP? It's very important to set the fuses to the right values. Using the wrong values can render your MCU unusable. For this project, here are the appropriate fuse values: high byte = 0xc9, low byte = 0x9f For details about how to program an AVR, visit my AVR programming page. |
| Source code | [hide] |
For those who wish to modify the device behaviour or add support
for new type of gamepads, here is the source code. Starting with version
1.5, it is released under the GPL v2 license. Previous version were released under
the Objective Development license, which is basically GPL + extensions to
cover hardware. See License.txt for more information.
Please contact me at raph@raphnet.net if you do useful changes. Objective Development driver modifications: The NES/SNES mode selection jumper changes the HID report descriptor. I had to modify Objective Development's usb driver to support this. Here is a diff against the usb driver from HIDKeys.2006-03-14: usbdrv-diff USB Vendor ID/Product ID pair: Please dont re-use my VID/PID pair for derived or other projects. Instead, get your own. I bought my VID/PID pairs from mecanique, and they are much less expensive than the 2000$ US it cost to get a vendor ID from the usb implementers forum. |
| Printed Circuit Board for surface-mount version | [hide] |
The surface mount version has many advantages:
Here is a composite view of the PCB rev.C: ![]() For reference, here is the composite view of rev.B: snes_nes_usb_pcb_revB.png Here are the gerber files you can use to build your PCB(s): Revision C: snesusb_revC.zip Revision B: snes_nes_usb_PCB-revB.zip |
| Assembly of the surface-mount version (rev.C) | [hide] |
Step 1: Use the composite view,
the schematic and component list to
find out where each component goes. Solder everything in place and inspect
the board carefully for solder bridges. IMPORTANT: Do a solder bridge
between PD1 and PD0 (see schematic).
Step 2: Use the appropriate diagram on the left to solder the USB, ISP and controller/joystick
wires at the right places. The ISP cable can be built with a 2x3 header and a piece of flat cable. Pin numbers on diagram matches the standard atmel 6 pin AVR ISP.
Step 3: If you will be using a NES gamepad, close JP1 with a solder bridge
or a small piece of wire. For DB9 gamepads, close JP1 and JP2.
Refer to the pictures on the right for examples.
Step 4: Connect the USB and ISP cables. Use you programmer to program the hexfile into the ATmega8. Next, set the fuses bytes (High byte=0xc9, low byte=0x9f). Step 5: Test the adapter with a game. If all works well, you can remove the ISP cable if you dont plan to update the firmware. Now find a way to protect the PCB. You can fit it inside a little box, a piece of PVC pipe or a heat-shrink. Also, adding hot glue near the wires you soldered on the PCB will prevent the wires from breaking near the solder points. Step 6: Have fun! |
| Assembly of the surface-mount version (rev.A and rev.B) | [show] |
| Pictures and screenshots | [hide] |
| Pictures from users | [hide] |
| I like to see how others build this project. Please send me your pictures and I will
put some of them here. Tobias Schulte, from Germany, sent me those pictures: Tjerk Kuperus build this project and my arcade style controller for SNES circuit on a single board: Andreas Kronawetter, from Austria, built the circuit inside a NES controller:
|
| Disclaimer | [hide] |
|
I cannot be held responsible for any damages that could occur to you
or your equipment while following the procedures present on this page.
Also, I GIVE ABSOLUTELY NO WARRANTY on the correctness and usability
of the informations on this page. Please note, however, that the procedures
above have worked in my case without any damages or problems. Now you cannot say that I did not warn you :) |
Website coded with![]() | Last update: January 26, 2008 |