7
\$\begingroup\$

Does anyone have a pinout diagram for the Nintendo NES Controller? I'd like to connect the NES controller to an Arduino.

\$\endgroup\$
1
  • 3
    \$\begingroup\$ unless you want to try sourcing the mating connector for that unusual NES plug, why worry about the pinout? I'd probably cut the original plug off and replace it with a DB-9, and wire it to suit. \$\endgroup\$
    – JustJeff
    Commented Nov 4, 2010 at 0:51

4 Answers 4

5
\$\begingroup\$

PinoutsGuide have a page Nintendo NES and SNES joystick controller pinout.

\$\endgroup\$
7
\$\begingroup\$

The NES Pad library not only has a pinout, but is a great arduino class for using the NES controller.

\$\endgroup\$
6
\$\begingroup\$

Here's another page with some helpful information, including a signal diagram.

          +----> Power  (white)
          |
5 +---------+  7    
  | x  x  o   \     
  | o  o  o  o |    
4 +------------+ 1  
    |  |  |  |
    |  |  |  +-> Ground (brown)
    |  |  +----> Pulse  (red)
    |  +-------> Latch  (orange)
    +----------> Data   (yellow)
\$\endgroup\$
6
\$\begingroup\$

I found a great article on Hack-A-Day regaring your quest. This article is on interfacing the SNES controller with an Android utilizing an Arduino. To save you some of the trouble of sifting through the article, I found the linked code they cited:

This code uses an old-school 1980's NES controller to control a servo and an LED with the Arduino. With this code, the 'up' pad turns a servo to 180 degrees, 'right' turns it to 90, and 'down' turns it to 0 degrees. Also, the A and B buttons turn a LED on and off. You can get a NES controller from ebay for less than $10.00 Here is a crude drawing of the controller plug, four holes on one side, three holes on the other.


                       0     --  0v (ground)
      +5V  ---  0      0     --CLOCK   
  nothing  ---  0      0     --LATCH  
  nothing  ---  0      0     --SERIAL OUT 

You can just stick wires into the controller plug holes for prototyping. The +5 is connected to the Arduino +5 Ground to Arduino Ground Latch goes to Pin 2 (with this code) Clock to Pin 3 Serial Out to Pin 4

The servo data line is connected to Pin 10, and the LED is on Pin 11.

If you want to see the controller input on the serial monitor then just open up the serial monitor. It will show you the binary numbers that are coming in from the controller. Each button has its own binary number. 'Up' is 11110111, for example. I included a //hidden Serial.println code that will display "Button has been pressed" if you press down the start button. Just erase the '//' if you want to use that. The SNES plug is different, you're interested in that you will have to look elsewhere for the clock,latch,serial out info.

Quote:

/* INITIALIZATION */
#include <ServoTimer1.h>
ServoTimer1 servo1;

int latch = 2; // set the latch pin
int clock = 3; // set the clock pin
int datin = 4;// set the data in pin
byte controller_data = 0;
int ledpin = 11;


/* SETUP */
void setup() {
Serial.begin(57600);
pinMode(latch,OUTPUT);
pinMode(clock,OUTPUT);
pinMode(datin,INPUT);
pinMode(ledpin, OUTPUT);

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

servo1.attach(10);

}

/* THIS READS DATA FROM THE CONTROLLER */
void controllerRead() {
controller_data = 0;
digitalWrite(latch,LOW);
digitalWrite(clock,LOW);

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

controller_data = digitalRead(datin);

for (int i = 1; i <= 7; i ++) {
digitalWrite(clock,HIGH);
delayMicroseconds(2);
controller_data = controller_data << 1;
controller_data = controller_data + digitalRead(datin) ;
delayMicroseconds(4);
digitalWrite(clock,LOW);
}

}

/* THE LED, SERVO, AND SERIAL MONITOR PROGRAM */
void loop() {
controllerRead();
Serial.println(controller_data, BIN);

// if (controller_data==B11101111){
  // Serial.println("Button has been Pressed");   
   //}  else {
   //Serial.println("Button not pressed");
   //}

//for REFERENCE:  
//UP = 11110111
//DOWN=11111011
//LEFT=11111101
//RIGHT=11111110
//SELECT=11011111
//START=11101111
//A=01111111
//B=10111111

if (controller_data==B01111111){
 digitalWrite(ledpin, HIGH);   
 }

if (controller_data==B10111111){
 digitalWrite(ledpin, LOW);
}

if (controller_data==B11110111){
 servo1.write(180);
}  

if (controller_data==B11111011){
 servo1.write(0);
}

if (controller_data==B11111110){
 servo1.write(90);
}

delay(100);
}

Arduino SNES Instructable

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.