NESVerter

Introduction

The NESVerter is a conversion board to make an original NES controller into a USB gamepad. It originally came about after I made one based on this one over on raphnet.net for my friend Kat. I wanted to try making a PIC-based version that would fit inside an NES controller without modification to the case. This is the result.

The NESVerter is a small PIC18F14K50-based board that solders into an NES controller in place of the standard 4021 shift register. It requires removing that part. For more on how the NES controller works, visit here.

Hardware

There are two versions of the hardware, mostly the same. Version 1 is a slightly larger board, with a reset and a bootloader button so you can download new code to the board. Due to a miscalculation on my part, Version 1 requires filing down part of the case. Version 2 is smaller (thus no filing) and loses the buttons in favour of using the controller’s buttons on power up to activate the bootloader.

NESVerter versions 1 and 2

The schematics are as follows:

NESVerter 1.0 Schematic

NESVerter 2.0 Schematic

This is a very, very basic USB PIC setup. There are some pads for ICSP and USB connections, a couple of capacitors for the PIC, a crystal and load caps, pullup resistor on reset, and the 330nF capacitor on the VUSB pin. The 4021 is only used in the schematic as a footprint – it’s actually populated as pins connecting the board in place of the removed 4021 in the NES controller. Pullup / pulldown resistors on the inputs aren’t required, as they’re in place on the controller PCB (as printed-on carbon).

Firmware

The firmware can be downloaded at our Bitbucket site here. It’s based on JALv2 with JALLIB. HEX files are also included. The first versions were based on Microchip USB stack examples, but licensing issues with those led me down the JAL route, which actually turned out well.

There are actually two parts to the firmware. The first is the USB HID bootloader, which allows you to download updated code to the controller without taking it apart and breaking out the PICKit2. There are two versions – one for the V1 hardware and one for the V2. The V1 one uses the buttons on the PCB, while the V2 requires that you hold down the A and B buttons on the controller while plugging it in to enter the bootloader. I think the V2 one will work on the V1 hardware, so just use that. The bootloader gets loaded on via the ICSP board and something like a PICKit2.

The second part of the firmware is the actual gamepad firmware, which you load on via the bootloader. This is a very basic USB Gamepad firmware. I copied the USB descriptor from raphnet’s version, and much of the rest of the code comes from this JALLIB sample. All it really does is check which buttons are pushed, and sets the appropriate bits in the USB HID report for those buttons. That’s it. The code is documented if you want to have a look.

Building it

The board is all-SMD, and fairly tiny stuff too. I’m only providing instructions and a parts list for Version 2, as I don’t recommend building Version 1. You’ll need the following parts:

Device Quantity Parts on board Digi-key part number
10K 0603 resistor 1 R1 311-10KGRCT-ND
10uF 0805 capacitor 1 C3 445-1371-1-ND
12.000 MHz Crystal, 5×3.2mm 1 Q1 535-10875-1-ND
22pF 0603 capacitor 2 C4, C5 445-1273-1-ND
100nF 0603 capacitor 1 C1 311-1343-1-ND
330nF 0603 capacitor 1 C2 445-5142-1-ND
PIC18F14K50, SSOP package 1 IC2 PIC18F14K50-I/SS-ND

Note the thickness of the PCB – using standard 1.6mm PCBs is a bad idea here. Pay a little extra for thin, if you have to – I went with 0.8mm.

I won’t cover how to build the board – if you’re experienced with surface-mount soldering, odds are you can figure out where stuff goes based on the parts list above and the silkscreen on the board. You will need to burn the bootloader to the board, however. For that, I use a PICKit2 with a cable and pogopins. The same pads that are used for USB can be used for ICSP to load the bootloader – connection is as follows:

NESVerter ICSP pinout

Here’s how to assemble the controller:

  1. Disassemble an NES controller. Clean it, and then move to the PCB.
  2. Open the controller, and remove the board form the case
    Step 1: Open the controllerStep 2: Remove the circuit board

  3. Desolder the cable
    Step 3: Desolder the cable
  4. Desolder the 4021 chip
    Step 4: Desolder the 4021 chipStep 5: Pry off the desoldered chip
  5. Line up the NESVerter over the IC holes
    Step 6: Line up the NESVerter board
  6. Thread small-gauge wire through the holes, and solder on both sides. Then, clip the wires.
    Step 7: Add wiresStep 8: Solder the wiresStep 8: SolderingStep 9: Cut the wires
  7. Cut the end off the USB cable (the PROPER end – not the type A plug!). Strip and tin the wires.
    Step 10: Grab a USB cableStep 11: Cut off the square endStep 12: Strip off the plasticStep 13: Strip and tin the wires
  8. Solder the wires to the PCB. The pads are indicated with the colour of the wire (G = Green, W = White, R = Red, B = Black) that attaches to them.
    Step 14: Solder to the PCB
  9. Route the USB cable, and reassemble the controller
    Step 15: Start reassemblyStep 16: Put the buttons back inStep 17: Put in the PCB assemblyStep 18: Route the USB cableStep 19: Put the back back onStep 20: Done!

Loading the firmware, and testing it

To load the firmware, you’ll need to use the USB HID Bootloader program that comes with the Microchip Libraries for Applications. The program is in the USB\Device – Bootloaders\HID directory. Follow the following steps:

  1. Open the program
  2. Hold down the A and B buttons on the controller (for the V2 bootloader) or press the bootloader button (for the V1 bootloader) and plug in the controller
  3. The app should indicate that the device was found.
  4. Click the Open button, and open the nesverter.hex file from the code-gamepad directory in the source code download
  5. Click the Erase/Program/Verify button to download the code
  6. When the app tells you, unplug the controller and plug it back in.

To test it, you’ll need an app to test the controller. On a Mac, I use Joystick Show from the Mac App Store. On Windows, you can go into Devices, right click on NESVerter, go to Game Device Properties, click on NESVerter and hit Properties. That’ll show you the state of each button.

Using it

The gamepad is a standard USB HID gamepad, so it’ll work on any major modern OS without a custom driver. You’ll need to consult the documentation for whatever game, emulator, etc. you’re using to see what, if any, configuration it needs to use a standard gamepad. Some emulators on the Mac, for example, require the Emulator Enhancer program to use a gamepad.

Lessons learned, and conclusions

Overall, this project was a big success – the system worked very well for bringing the venerable NES controller into more modern times, and was a very inexpensive way to do so. The first version had issues requiring a little filing of the case to fit the board, but that was easily corrected in version 2. Definitely something to keep track of in future versions – making sure the dimensions are correct before sending boards out for manufacture.

In future, I’d like to do another version of this – without surface mount or stitching together boards, both of which are difficult for people who aren’t that experienced with soldering. I’m thinking of doing one with through-hole parts and Microchip’s newer (and cheaper) USB parts, with a full-PCB replacement for the NES controller. Before I do so, though, I’ll have to find some more NES controllers – they’re getting harder to come by.


Category : Project Updates

Leave a Reply