HOME   EVENTS   SOFTWARE   INFO   CONTACT



Arduino is an easy to use open source platform for doing all types of things. The NES isn't. However, it isn't that tough to control your NES with Arduino.

The inside of a NES controller looks like this:



Basically, it consists of a 4021 shift register and a bunch of buttons and wires. Not that complicated at all. Start by desoldering the 4021 shift register, then cutting the colored wires you see in the picture above. Strip them, and to make your life easier, put some headers on them. Leave the controller port attached, as you'll be plugging this thing back into your NES.

Here are two shots of the 4021 on a breadboard:





It is hard to see where to connect all the wires, so I made this diagram based on the 4021 pinout:



The colors correspond to the colors of the wires you cut from the controller. White is 5 volts, brown is ground, yellow is data out, red is clock, and orange is latch. The good news is that you don't really need to worry about all of them if you have them wired correctly - just plug the controller into the NES and it will do the work of timing the controller and reading for input.

Next, run wires from the digital pins on your Arduino to pins 1, 4, 5, 6, 7, 13, 14, and 15. Those pins are on the diagram above, and correspond to buttons on the NES controller. One more important note: you must run a ground from pin 8 on the 4021 to common ground on the breadboard as well.

Now, in their natural state, the buttons are pulled high. That means you should supply each button with 5 volts to keep it "off". If you want to simulate a button press, simply pull the appropriate pin low, then high again.

I'm in the process of writing software to share, but for now - just take a look at this quick example to help you get started:

void setup() {
  //I used digital pins 2-9 for the buttons
  //This declares them as outputs
  pinMode(2, OUTPUT);      
  pinMode(3, OUTPUT);  
  pinMode(4, OUTPUT);      
  pinMode(5, OUTPUT);  
  pinMode(6, OUTPUT);      
  pinMode(7, OUTPUT);
  pinMode(8, OUTPUT);      
  pinMode(9, OUTPUT);
  //This turns all buttons off
  digitalWrite(2, HIGH);
  digitalWrite(3, HIGH);
  digitalWrite(4, HIGH);
  digitalWrite(5, HIGH);
  digitalWrite(6, HIGH);
  digitalWrite(7, HIGH);
  digitalWrite(8, HIGH);
  digitalWrite(8, HIGH);
}
void loop() {
  //This is a test that turns the B button on and off
  digitalWrite(6, LOW);
  delay(400);
  digitalWrite(6, HIGH);
  delay(400); 
}
I really hope this has been helpful. Also, if you want more info on controlling your Arduino with a NES controller (the reverse of this), check little-scale's blog here. It was a helpful resource when I was figuring all this out.

Check back soon for more information and software! Good luck!

Update: 12/11/2009 - I changed the 4021 pinout, as it was mislabeled before. It also seems sending pin 14 on the 4021 high presses both the RIGHT and A buttons. When I have time, I'll look into it and post more here. If you know more, let me know.





8bitpeoples Research & Development