Instructables
This instructable has been updated AGAIN!!! 3 December 2011
Replaced a println with print (derp).

This instructable has been updated! 1 December 2011

Remade all code from scratch.
Remade 'ible code section; Now includes a 'Processing COM port config for dummies'

Ladies and gentlemen, I proudly present 8bit pleasure.. yours for the grabbing!
Whether you use GNU/Linux, Mac OS X, or Windows
the USB NES controller is compatible.

Will this in any way alter the controller?
Nope, the controller will stay the same so you can still use it on a real NES

But I don't have an arduino ;_;
You can use the parallel port:
http://hellalame.com/nes/nes_controllers.html
Buy an arduino:
http://arduino.cc/en/Main/Buy
Or a retrozone NES kit:
http://www.joystiq.com/2004/09/07/how-to-make-a-nintendo-controller-into-a-pc-joystick
 
Remove these adsRemove these ads by Signing Up

Step 1: Ingredients for some awesome controller soup

You will need:
A NES controller
An Arduino
A USB cable type B
Something you can use as a Casing
and some wire..
Optional: NES port http://www.parallax.com/Store/Components/Other/tabid/157/CategoryID/32/List/0/SortField/0/Level/a/ProductID/522/Default.aspx

Arduino software http://arduino.cc/
Processing http://processing.org/

Step 2: How to connect the arduino to the nes controller

Arduino_Diecimila.jpg
100_1854.JPG
With some wire connect the pins according to the texts on both pictures..
You could also use the controller port from a NES (a broken one, don't waste a working one).

You want something vaguely similar to the last picture.
1-40 of 75Next »
Jeanot13141 year ago
Hi again,

I made it with an atmega standalone inside the nintendo, so i can plug two remote. I used the usbkeyboard librairie but i still have a tiny problem... When i print letter on a txt everything work fine, but on a emulator it seem that the flow of data is not good. My mario is almost not moving at all, and he make very small jump when i keep press.
I tried to configure a "repeat delay" and a "repeat rate", but the result is still the same. I don't anderstand how your usbjoystick library send the data to the computer, do you know any configuration to do about that?

Thanks..
Prodigity (author)  Jeanot13141 year ago
Hi Jeanot1314,

Could you show me the code you've written?
Jeanot13141 year ago
thanks for the code ^^ To simplify i tried with the serial reading without processing. This work on actual version of arduino.

void loop() {
output = 0;
ReadNESjoy();
Serial.println(output);
delay(50);
}


void ReadNESjoy() {
latchlow;
clocklow;
latchhigh;
wait;
latchlow;
output += dataread * (1 << 0);
for (int i = 1; i < 8; i++) {
clockhigh;
wait;
output += dataread * (1 << i);
clocklow;
wait;
}
}

If you replace the loop and the setup in the program with this, you can see directly the value in the Serial Monitor. All the buttons are fonctionning, it s necessary to read the first time before the first clockhigh.
THanks again, and now lets play!!!! ^^
you should use an arduino nano and ditch the power cable. it would be smaller and less bulky.just a thought. ..good ible
Andromorfo2 years ago
Hey man thanks for the instructable, i used the NES controler to control my robot arm, but for some reason the button A doesn`t work, and i`ve tested it with different controlers.

here is a video of my robot arm
http://www.youtube.com/watch?v=Va9D9Fpc5H8

P.D.- sorry for the awful english :P
i changed some of the arduino code and now it works with all the buttons, i needed to read the first bit before the for cicle and then read the others 7 bits

here´s the code, i hope it helps someone getting the same problem

void ReadNESjoy() {
nes[0]=1;nes[1]=1;nes[2]=1;nes[3]=1;nes[4]=1;nes[5]=1;nes[6]=1;nes[7]=1;
latchlow;
clocklow;
latchhigh;
wait;
latchlow;
nes[0]=dataread;
for (int i = 1; i < 8; i++) {
clockhigh;
wait;
nes[i]=dataread;
clocklow;
wait;
}
}

Doesent work!

Just throws a buncha error messages like "nes not declared in this scope" among other things.
Hello!

I tried this today and it works but i cannot get a response outta the A button and i've tried both my NES controllers.

I have a hard time believing that the same button on both my controllers are broken, especially since my NES never saw much use.

So i'm leaning on an error in the code somewhere, i'm not a programmer and thus have no knowlefe in this stuff, so debugging is out for my part.
scewy2 years ago
This does not work for me, i get the following error-message whilst trying to upload to my Arduino UNO:

-----------------------------------------------------------------------------------------------------------
The "BYTE" keyword is no longer supported.
-----------------------------------------------------------------------------------------------------------

ArduinoSketch.cpp: In function 'void loop()':
ArduinoSketch.pde:-1: error: 'BYTE' was not declared in this scope

As of Arduino 1.0, the 'BYTE' keyword is no longer supported.
Please use Serial.write() instead.

-----------------------------------------------------------------------------------------------------------

Any ideas of how to fix this issue? //John
NondoX scewy2 years ago
i had the same error.
i think its because you/we are using a newer version of the arduino program

i just installed an alpha version and all worked fine.

give that a whirl.
wilson3092 years ago
the processing sketch went fine and it uploaded to arduino board fine but what do i do after i select the proper port and upload onto arduino board? im confused because i open my emulator and a joystick isnt showing up nor will pressing buttons on the nes controller assign keystrokes? connections are solid and it's wired correctly and used the above codes. much help is needed ive been trying to do this for 2 days now (1st arduino project) PLEASE I NEED HELP!!!
lewsidius3 years ago
thanks for the update and quick reply
i got an error code right away and on this line
import processing.serial.*;
am i doing something wrong
sorry im a newb
still getting error messages and wsalgklgkwsaklgwsalgwsalgklgkwsaklgwsalgwsalgklgkwsaklgkwsaklgws
when trying to use the controller
hoffsta2 years ago
I for one would like to see you update this to include support for SNES controllers. I'm new to Arduino, would it be possible to build 2 NES ports and 2 SNES ports simultaneously on one Arduino?

I'm working on a multimedia project that would be running 24/7 and have both NES & SNES emulators available. It would be great if a user could just plug in the appropriate controller and get started without any other configuration.

Another noob question: If I have 2 NES ports and I plug in two controllers, will the "player 1" and "player 2" identities remain bound to the ports (so I can have it just like a NES, player 1 on left port, player 2 on right?)

Thanks for all you work on this! Totally RAD!
It might just be me but I can't seem to find the code anywhere in this guide, any ideas? :/
Prodigity (author)  chibiturtleboi2 years ago
Apparently something went wrong when I reupdated the code, sorry for the inconvenience. It has been uploaded now :O
Cool, thanks much!
TechDante4 years ago
hey how easy is this to multiply the numer of controllers that can be conected
Prodigity (author)  TechDante3 years ago
Very late reply:

Quite easy, the clock and latch from the arduino can be connected to several controllers. You only need one seperate data line per controller.
Some code adjustments need to be made, but my guess is that you can probably hook up to 16 controllers to an arduino duemilanove and even more to an arduino mega (WHY???!!!!!).

How many controllers are you interested in hooking up?
(that is, if you still are interested lol)
olskool4 years ago
Hey Prodigitythanks for this, it's awesome!
I have one question and one suggestion. The suggestion is to update the code so it has the revised buttons = "this should w0rk... line in it. I struggled with that until I eventually read all of the comments.

The question is: in the arduino code it looks like you are sending a 'z' at the end of the x/o pattern, but it looks like processing doesn't look for it. Currently I get the wrong buttons pressed unless I reset the arduino by re-uploading the sketch.

Is there a way to look for the 'z' in processing so that the buffer doesn't ever slip out of sync?

Thanks for this instructible! I'll be back to post my results when I am finished!
olskool olskool4 years ago
I think I figured it out. Here's the code. It goes in at the end.

"buttons = NESjoy.readStringUntil('\n');"

It's the Until('\n'); that does it. It looks for that to signal the end of the transmission. Thanks for putting all of this info up!


Prodigity (author)  olskool3 years ago
Hey olskool,

Remade the arduino and processing code completely. (2 million years later lol)
I'm quite happy with the arduino code but the processing code might still need some changes..
Prodigity (author)  olskool4 years ago
Heyz,

Sorry for not responding, I haven't been on instructables for a while.
You're right, I should update the code.. I will get round to it as soon as I'm motivated x'D
As for the additional code, I will implement it and mention you on my 'ible.
Thanks for showing interest in my 'ible =D

Greetz,
Joshua
lewsidius3 years ago
I got it resonsive to the nes controller.exe file :( minus the start button )
but how do you get it working with emulators??? do you need a driver?
Prodigity (author)  lewsidius3 years ago
Hi Lewsidius,

I've currently updated the code, you might want to try the new code (it should work much better).
The program reads the messages the arduino sends and emulates a keyboard, so you don't need drivers.
In order to configure the controllers, you simply follow the same steps you would to map controller buttons to keys except you press the buttons on the nes controller.

For FCEUX e.g.

Config > Input
[Port 1] Configure
[Virtual gamepad 1]
Press the up button in the program, press the up button on the nes controller.
Repeat for every button.
Done!
kribbyy3 years ago
I ported this code to work with an SNES controller using an Arduino Uno, and updated the graphical interface accordingly. If anyone's interested give me a shout.

and grampafish: Check out the two lines kiwimonk posted below.
How do I get processing code to work it saysrobot cannot be found
kiwimonk4 years ago
Awesome Work!  Now I finally have my NES controllers working on a PC!
I was having trouble with the 'A' button (not working)  for a while, and thought it was my Seeeduino.  Read up on the controller spec..   After moving
line 38: digitalWrite(latch1,LOW);
just below line 46 everything worked!

I also had to place these imports into the Processing Script:

import java.awt.Robot;
import java.awt.AWTException;

After I got it all working I modified the code a bit to support two controllers.  If anyone is interested, let me know ;)

Thank you to you and
I WANT THAT CODE!!!!!!!!!!!!!! please.
http://www.megaupload.com/?d=KDTY05VX Enjoy ;)
could you please upload it on rapidshare I can not access megaupload
http://rapidshare.com/files/416302296/NESpad_2_Controller.zip
thanks
technoguy944 years ago
Cool!
You do know you can buy USB NES controllers online, right? [link]
Prodigity (author)  technoguy944 years ago
Yeah, those controllers brought me on the idea.
More specifically this website: www.retrousb.com
(though it's more fun to make it yourself :P)

Greetings,
Prodigity
608294 years ago
 One question, could i do this with a light gun?
Prodigity (author)  608294 years ago
Ehm, I haven't tried this myself but it should work assuming the emulator supports it and you use a crt/tft/tv screen.
LCD screens won't work due to light decay and screen response, though some newer variants could work (those that support 3d shutter glasses should work).

Good luck and have fun tinkering.
awesome. i made a belt buckle out of one of those:)
I have a quick question...how hard would it be to add axis support so as to be able to add joysticks? I have several 3rd party n64 controllers with awesome joystick (real potentiometers, not cheap plastic) and I was thinking about making a custom gamepad.
Prodigity (author)  willrandship5 years ago
A bit more difficult I'm afraid.
The N64 controller has a completely different protocol,
I did a quick google and came up with this:
www.mixdown.ca/n64dev/
courses.cit.cornell.edu/ee476/FinalProjects/s2002/jew17/lld.html
Not impossible, but you'll have to start from scratch.
(I'll look into it)
1-40 of 75Next »