N64 Analog Replacement Stick
A new analog stick for better retro gaming
Years ago, lots of friends at school had a N64 console. Priced at about 300 DM it was a bit too expensive, so i only had a Gameboy. 17 years later - walking through one of these 2nd hand stores - I found one for only 40 Euro. A good value compared to the eBay prices. I went to the shop assistant to show my interest.
"The analog stick is always a problem. This one.. Oh. I'll look for a better one!" It turned out that he did not have another one, so he reduced the price and I left the store with my new toy.
Back home I disassembled it and thoroughly cleaned everything. I also had a look for the analog stick. Plastic gears, counting disks, photo sensors. Plastic shavings trickled towards me. It was not usable anymore, the guide was totally worn out. Planned obsolescence?
A new stick
I needed a replacement. Google showed me a few possible options. Kitsch Bent is selling replacement gears. There were also a few Chinese replacement sticks on eBay and Amazon, either in the "original style" or "Gamecube style". The last one is promised to be very durable, so I chose the "Gamecube style" stick.
A few days later, I had the new stick. I installed it within minutes. While playing "Super Mario 64", a strange problem came up: The stick was in the neutral position, while Mario ran very slowly to the right side. This problem was also reported on some websites. To press L+R+Start should reset the controller. Well, that actually worked, but it was somehow annoying to constantly pause the game and perform the reset. A solution must have been found!
Analyzing the problem
The original stick uses a counter disc sampled by two photocells. Depending on the direction of movement, alternating pulses are produced. The chip on the main board counts these pulses and will calculate the absolute position of the stick.
The Chinese replica uses a joystick potentiometer instead. The voltage at the wiper varies depending on the position. It is measured by a microcontroller, compared and converted into pulses. The software seems to be so bad that pulses are lost during fast movements. The zero point is out of alignment.
Micro from the Circuit Board had already developed a alternative PCB. In the thread "N64 Stick Converter PCB v2.2" are a lot of information about his project. There are kits with detailed instructions available for only 10 Euro. Sadly, there is only a small batch of kits for sale every few month. I couldn't wait for it...
Do it yourself
Luckily Micro published the firmware of the AVR microcontroller on his new board. It is well commented (I couldn't have done it better) and free for non commercial use. Here's the potentiometer he used on his design.
Until now, he did not publish his circuit board design, but you'll find the pinout in the comments of the source code. I opened my CAD program and created a schematic diagram - that shouldn't be a problem!
Instead of the ATTiny24 microcontroller I used an ATTiny44. It has a similar pinout and is software compatible, but has a bit more FLASH memory for future upgrades. I also added a 10μF decoupling capacitor (C2). Everything else is implemented as in the original circuit.
The chinese replica stick is disassembled as shown in Micros tutorial, all parts are unsoldered and the relevant positions are measured and transferred into the CAD program. After printing out the board several times and measuring again, everything fits.
Now it's time to place the missing components and route the traces. A transparent foil for the top and bottom of the board is printed, the double sided PCB is exposed, developed, etched, drilled, cut and assembled. The board also contains some VIAs with 0,6mm drill-holes below the microcontroller and potentiometer. They are created with a piece of wire soldered from both sides and carefully sanded down with a rasp to be as flat as possible. Of course, this is only neccessary for prototyping. The subsequent, factory-made circuit boards are chemical plated-through and, needless to say, covered with solder resist.
The first piece of hardware is finished!
Now let's continue with the firmware.
Micro's ZIP file contains a AVR Studio project as well as precompiled HEX and EEP files. It is possible to compile the project by yourself, but you may also flash the HEX and EEP files directly. This is what we are going to do now.
First we need the program Avrdude as well as an AVR In System Programmer. I am using the USBASP. On the circuit board there's 6-pin header for the ISP. Just connect it to the programmer by soldering some wires.
Unpack the files "N64 Stick Converter PCB v2.1.hex" and .eep from the "Debug" folder and rename them to "N64_Stick_Converter_PCB_v2.1.hex" and .eep. Problems may occure on some OS if there are spaces in the filename.
Open a new terminal window (on Windows: Command prompt) and change to the directory where the files are located. Now execute the following commands to set the Fusebits and to write the flash and EEPROM memory of the AVR:
avrdude -p attiny44 -P usb -c usbasp -U flash:w:N64_Stick_Converter_PCB_v2.1.hex
avrdude -p attiny44 -P usb -c usbasp -U eeprom:w:N64_Stick_Converter_PCB_v2.1.eep
If there are no errors shown, you may now unsolder the wires. Continue with stick calibration as shown in Micro's manual.
Compiling the firmware
If you want to build your own firmware instead of using the pre-compiled binarys, you may open the project in AVR Studio or compile it on the commandline. There are a lot of tutorials of using AVR Studio in the web. Because I prefer using the commandline, I'll show you how to compile and flash it without using an IDE.
We need the AVR-GCC compiler and avrdude. On Windows you should use WINAVR. On Linux you need to install the packages avr-gcc, avr-binutils and avrdude. They might be installed through the system package manager (i.e. yum or apt-get).
Unpack the file "N64 Stick Converter PCB v2.1.c" from the ZIP archive into a folder and rename it to "N64_Stick_Converter_PCB_v2.1.c". Also unpack my makefile (download below) into that folder.
In this destination, we execute the following commands to compile and flash everything:
If no errors are shown, continue with the calibration as already mentioned above.
Build your own device
My circuit board design and Micros software are free for non commercial use. If you're not skilled in electronic development or if you want to mount other joystick potentiometers you'd better use Micros board / kit. If you consider the shipping costs it's also the cheaper option. You have been warned!
My alternative layout is available on OSH Park. OSH Park is a supplier for circuit board production located in the USA. Through PCB pooling they provide circuit boards for open source projects at a good value. 6 USD per three pieces, double sided, plated through, purple solder resist, gold contacts.
Micros PCB v3
A small supplement: Micro just announced a 3rd Version of his PCB / Firmware! More details at the Circuit-Board. (In German)
Assembly video (German)
Downloads & Links
- Schematic (PDF)
- Bill of material (PDF)
- Circuit board at Aisler (Germany)
- Circuit board at OSH Park (USA)
- Download of the Gerber-files for the circuit board
- Micro's sourcecode (Link to nfggames.com) [Mirror]
- My makefile for console compiling
- Picture of the potentiometer used (Link to circuit-board.de) [Article on Conrad Electronic]
All brands and product names are the property of their respective owners.