Everyone loves the 80s right? Well, I certainly do - well, the revival anyway. There were certainly parts of the 80s I don't want to see again, but that's another post. Suffice to say, some of the technolgy, style and music is coming back in a big way. With the EMF Cybar and Nullsector just around the corner I decided around June to have a look at the Nintendo Powerglove and how I could modernise whilst still keeping it intact.
You can find all the code for this over at my github page.
I'd also like to thank my nephew Sam for being very diligent with his soldering and helping with the research! :D
The powerglove was designed to be plugged into a NES. This means it really only has the basic NES control pad inputs - A,B, Start, Select and 8 directions. There are two parts to the glove system really. The glove itself and the frame-like sensor bar that contains a set of microphones. The frame itself picks up ultrasonic pulses from the glove in order to figure out how it's moving. So if the glove is inside this frame and it's all calibrated, you can move your hand up or down to generate the corresponding button-push on the controller.
I decided not to look at this part because I wanted to wander around wearing the glove. It also seemed a little beyond me as the technology inside these sensors and the box that connects them seems mostly analogue. There are very few digital components in here as I would know them. Some clever amp circuits and what not going on here.
The glove unit plugs into the main box, as do the arms of the frame. Looking inside this box there are what seem to be some amplifiers, shift registers and what not but the majority of connections from the glove bypass all of this circuitry completely. The only ones that don't appear to be related to the fingers, which we'll get into. The connector from the glove is a standard DB9 which gives us a place to start.
The first step was to see which DB9 pins correspond to which NES pins. Looking at the main box we know that some are directly linked so all we need to do is take our multimeter and find the mappings with a little continuity testing.
So far, the mapping I've found on the DB9 connector look like this:
1 - x (wiggle?) 2 - GND 3 - x (wiggle?) 4 - x (wiggle?) 5 - +5V 6 - GND 7 - LATCH 8 - CLOCK 9 - DATA
Turns out we can quite easily create a NES controller with an Arduino and some code that looks like this (thanks to this article)
File........... NES Controller Test Code Purpose........ To demonstrate how to interface to an NES controller Author......... Joseph Corleto E-mail......... corleto.joseph @ gmail.com Started........ 04/13/2016 Finished....... 04/14/2016 Updated........ --/--/----
- The NES controller contains one 8-bit 4021 shift register inside.
- This register takes parallel inputs and converts them into a serial output.
- This code first latches the data and then shifts in the first bit on the data line. Then it clocks and shifts in on the data line until all bits are received.
- What is debugged are the button states of the NES controller.
- A logical "1" means the button is not pressed. A logical "0" means the button is pressed.
- This code shifts the first bit of data into the LSB.
- The order of shifting for the buttons is shown in the table below: