In 2016, I hacked an old NES controller so I could play old NES games on my Raspberry Pi running Emulation Station loaded with many games from my childhood. Since the R-Pi has USB interfaces, I needed to convert the NES’s original connector to a USB connector. The circuit is extremely simple – just an SiLabs c8051F320 microcontroller with minimal support components. No need for any voltage regulation, since the microcontroller gets its power from the USB port upon plugging it in.
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.
In 2020, I hacked a Wii Nunchuk controller so I could control some of the robots I was working on. I cut off the original connector (which uses I2C), and connected the Wii’s I2C wires to my custom PCB, which has an RF wireless chip on board, enabling me to use the Nunchuck as a custom wireless controller.
In the picture, you can see the connector on the Wii’s PCB connecting to my custom PCB’s I2C connector. I managed to fit my PCB and a 3.7V LiPo in the empty space of the controller, including an on/off switch and a couple status LEDs (on/programming/charging state).
I used this controllers in some robotics projects like my Hex Walker.