Gamasutra: The Art & Business of Making Gamesspacer
arrowPress Releases
October 31, 2014
PR Newswire
View All
View All     Submit Event





If you enjoy reading this site, you might also want to check out these UBM Tech sites:


 
CONNECTING NES POWER PAD TO PC FOR ITS 25TH ANNIVERSARY
by Archie Prakash on 07/02/13 01:00:00 pm   Featured Blogs

The following blog post, unless otherwise noted, was written by a member of Gamasutra’s community.
The thoughts and opinions expressed are those of the writer and not Gamasutra or its parent company.

 

Twenty-five years ago, on a bright and glorious day, the NES Power Pad was released to the US. Since the birth of home video game consoles, there have always been odd one-off peripherals to accompany gaming systems: the Amiga Joyboard for the Atari 2600, the Guitar Hero controller, the recent Xbox Kinect to name a few. They have been a welcome alternative to the classic controller or joystick. Still, one of the greatest and widely distributed gaming peripherals of all time is arguably the Nintendo Power Pad. A flexible mat with 12 pressure sensitive buttons and two unique sides, it launched as the Family Trainer in Japan and was then rebranded as the Power Pad for release in the United States. Every child of the 80’s can remember the Nintendo Power Set, which was a NES bundle that featured the Power Pad. It was guaranteed to make you the most radical kid in the neighborhood.

But the Power Pad suffered the weakness of all console peripherals–a lack of support from developers and publishers. In total, six games were released in the US and a grand total of thirteen released worldwide. The most notable of these were World Class Track Meet, Athletics World, and Dance Aerobics. To this day, Power Pads are plentiful and can be found in massive quantities on eBay selling for as little as $20 with shipping! So as a dedication to our childhood and the 25th anniversary of this amazing video game peripheral, we at CyborgDino have figured out a way to connect this device to any PC, Mac and even a PS3 as a controller using an Arduino microcontroller. In addition, from what we can tell via a Google search, this is the first time a Power Pad has ever been connected to a desktop computer.

The rest of this article will outline steps and items required to create a USB hookup to the Power Pad.

A list of items required.

To start off, you want to take the NES extension cable and cut off the female end of the connector. It is possible to forgo the extension cable and just use the actual wire of the Power Pad, but by using the extension cable, you will have yourself a general purpose NES connector that you can use with any NES joystick, controller or peripheral. As a bonus, it will be magnitudes easier to find the proper pins of the device.

After separating out the internal wires of the extension cable, you will want to use the multimeter’s continuity setting to determine what wire corresponds to the pin-outs of the NES plug. Once determined which wire is which, a little masking tape was used to mark out the names for future reference. Trust us when we say this will save you loads of time down the road. The final step here is to solder on some hookup wires to the flayed ends of the NES cable; this will insure the best connection possible when connecting to the Arduino. Below is a snapshot of what you will end up with, and a basic reference for the NES controller pin-out.

powerpad01

The next step is connecting the Power Pad to the Arduino. Below, we have made a handy guide to help with connecting the hookup wires of the extension cable to the pins of the microcontroller. With our setup, we have chosen to use a breadboard to better help with prototyping and added a small LED to show when the system is powered up. Once that is complete, all that is left is connecting the Power Pad connecter to the extension cable and plugging in the Arduino to a computer.

powerpad02

Now comes the fun part, programming the Arduino. With a little help from the folks at nesdev.com, we were able to determine that the D3 and D4 pin-outs from the Power Pad are the key to reading all input from the device.

powerpad03

Finally, we were able to formulate the code, which boiled down to a loop reading a byte from the two pins at a 100 millisecond delay. An interesting note we found was a pad read as a 1 when not compressed and the bit was flipped to a 0 when it was stepped on . Later we ended up flipping all the bits by using a NOT operator on each byte after being read.

/* 
Reading a NES POWERPAD
By @CyborgDino
03 June 2013
LOS ANGELES, USA
*/

int latch = 2; // set the latch pin
int clock = 3; // set the clock pin
int data1 = 4; // set the data in pin
int data3 = 5;
int data4 = 6;

byte controller_data1 = 0;
byte controller_data3 = 0;
byte controller_data4 = 0;

/* SETUP */
void setup() {
  Serial.begin(9600);
  pinMode(latch,OUTPUT);
  pinMode(clock,OUTPUT);

  pinMode(data1,INPUT);
  pinMode(data3,INPUT);
  pinMode(data4,INPUT);

  digitalWrite(latch,HIGH);
  digitalWrite(clock,HIGH);
}

/* POWER PAD READ */
void controllerRead() {
  controller_data1 = 0;
  controller_data3 = 0;
  controller_data4 = 0;
  digitalWrite(latch,LOW);
  digitalWrite(clock,LOW);

  digitalWrite(latch,HIGH);
  delayMicroseconds(2);
  digitalWrite(latch,LOW);

  // D1 pin is unused 
  controller_data1 = digitalRead(data1);

  controller_data3 = digitalRead(data3);
  controller_data4 = digitalRead(data4);

  for (int i = 1; i <= 7; i ++) {
    digitalWrite(clock,HIGH);
    delayMicroseconds(2);

    controller_data3 = controller_data3 << 1;
    controller_data4 = controller_data4 << 1;

    controller_data3 = controller_data3 + digitalRead(data3);
    controller_data4 = controller_data4 + digitalRead(data4); 

    delayMicroseconds(4);
    digitalWrite(clock,LOW);
  }

}

/* PROGRAM */
void loop() {
  controllerRead();

  Serial.print("Data 3: ");
  //Serial.println(controller_data3, BIN);
  printBinary(controller_data3, 8);
  Serial.println();

  Serial.print("Data 4: ");
  //Serial.println(controller_data4, BIN);
  printBinary(controller_data4, 8);

  Serial.println();

  delay(100);
}

/* PRINT BINARY */
void printBinary(int v, int num_places) {
    int mask=0, n;

    for (n=1; n<=num_places; n++) {
        mask = (mask << 1) | 0x0001;
    }
    v = v & mask;  // truncate v to specified number of places

    while(num_places) {

        if (v & (0x0001 << num_places-1)) {
             Serial.print("1");
        } else {
             Serial.print("0");
        }

        --num_places;
        if(((num_places%4) == 0) && (num_places != 0)) {
            Serial.print("_");
        }
    }
}

By now, you may be asking “how can I now use this as a controller for my game of choice ?”. At first, we were going to write our own driver but then thanks to the Internet and the Open Source community we came across an awesome project called UnoJoy. Finding this nugget of code was an utter godsend. Within moments, we were able to convert our Arduino to a PS3 controller and the buttons for the controller were supplied by the Power Pad.

All code for this project can be found on our Github. As a bonus, we have taken the time to update the UnoJoy project for Mac developers, which was sorely needed for anyone using OSX 10.8. All updates can be found via the Github jump.

Now that the Power Pad was ours to command, anything was possible. We could maybe write some code to play Street Fighter 4 on the PS3 with only the Power Pad? We chose to take it one step further. Using some Unity 3D magic, we were able to prototype a two-player co-op game where you defend an area with a breakout style mechanic. So we present to you AXIS, what can be called the 14th game ever developed for the NES Power Pad.

We sincerely hope anyone reading this article will feel inspired to create a unique game of their own or adapt a pre-existing game to work with the Power Pad. If you take it so far, please let us know of your efforts on our twitter @cyborgdino. Long live the Power Pad and long live the NES!

This was originally posted at http://cyborgdino.com/2013/06/connecting-nes-power-pad-to-pc/ 


Related Jobs

Forio
Forio — San Francisco, California, United States
[10.31.14]

Web Application Developer Team Lead
The Workshop
The Workshop — Marina del Rey, California, United States
[10.31.14]

Programmer
InnoGames GmbH
InnoGames GmbH — Hamburg, Germany
[10.31.14]

Mobile Developer C++ (m/f)
Activision Publishing
Activision Publishing — Santa Monica, California, United States
[10.31.14]

Tools Programmer-Central Team






Comments


Nicholas Koza
profile image
That's enough to make me consider getting an Arduino. I had my power pad out literally less than an hour ago for our Independence Day guests. Thanks for sharing.


none
 
Comment: