NES-to-USB Modified Controller


Summary

In this project, I modify an old Nintendo Entertainment System (NES) controller, enabling it to be plugged into any PC with USB capability. The circuit is extremely simple - just an SiLabs c8051F320 microcontroller with minimal support components. No need for any voltage regulation, since the uC gets its power from the USB port upon plugging it in.

Human Interface Device (HID)

To date, any project I've done that takes advantage of USB connectivity has used the generic HID Class. As long as you don't need any exotic functions, this class gives you basic two-way communication from host to device and vice versa. In this project, I don't even need to send data to the device (the NES controller). The host simply polls the device using the USB Communication protocols, and the device responds with 3 bytes: The X value of the d-pad (-127 or +127...left/right), the Y value of the d-pad (-127 or +127...down/up), and the third byte only uses 4 bits - the state of the buttons (select, start, A, and B).
The trickiest part of using the HID Class is making sure the Report Descriptor is correct. I learned just enough of how USB Reports are handled to be dangerous...I essentially Googled until I found an example that best fit my project's requirements, and then changed the parameters appropriately.

Integrating the PCB

As you can see from the picture, the final PCB is very minimal. The NES controller connects each of the 8 buttons on the controller to an 8 bit shift register. It sends these bits to the NES base unit serially over a 3 wire interface. My circuit "fakes" an NES base unit in order to get this data. It then packages up that data to be sent to the host PC. If all of our USB descriptors are written properly the host OS (Linux or Windows) will interpret this data as "gamepad" input, ready to be used for any game you want! (This includes NES Emulators).

I can also write C/C++ programs to access the raw USB data directly, like I do for my 8x8x8 LED cube games.