UPDATE 22-12-2014
Instructables user mattpbooth has updated the code and is hosting it on github:


Thanks Matt!

UPDATE 03-12-2011

Replaced a println with print (derp).

UPDATE 01-12-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://hellalame.com/nes/nes_controllers.html

Or a retrozone NES kit: http://hellalame.com/nes/nes_controllers.html

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/
Hello! <br> <br>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. <br> <br>I have a hard time believing that the same button on both my controllers are broken, especially since my NES never saw much use. <br> <br>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.
<p>Hey, see the reply to Andromorfo above. Your A is first in the cycle and was being skipped with the first clock pulse.</p>
I have leonardo set to press keys like makey makey and it works fine<br>On everything but emulator <br>I don't want to use controller I made foot and fist pads but it won't work on emulator please help
thanks for the update and quick reply <br>i got an error code right away and on this line <br>import processing.serial.*; <br>am i doing something wrong <br>sorry im a newb
still getting error messages and wsalgklgkwsaklgwsalgwsalgklgkwsaklgwsalgwsalgklgkwsaklgkwsaklgws <br>when trying to use the controller
<p>Hey, those keystrokes are down to the keyboard emulator doing its thing. The processing script was reading a string as individual char at the version I used so was firing text like the above when not touching the buttons. If you swap the Serial communication to use a single byte each time (8 inputs = 2^8 = 256) by using Serial.Write/Serial.Read you'll also save 2 bytes per message and have a fixed message length.</p>
Hey lewsidius did you fix that wsalgllgkwsaklg thing because I'm getting it too
I have pins set to print letters on keyboard how can I use this to play games on emulator <br>For some reason the arduino key presses aren't registering
<p>I would also like to see this include the SNES controller. It's a far easier way to attach a controller to an Ardiuno Uno than building a HID controller.</p>
Please help I got everything hooked up and ready and was ready to play some childhood nes games with the real controller instead of a keyboard but all of the sudden it just started saying wsalglgk just like lewsidius and I don't know if it's hooked up wrong or something please help
Also forgot to say I'm using the arduino uno
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.<br><br>here is a video of my robot arm<br>http://www.youtube.com/watch?v=Va9D9Fpc5H8<br><br>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<br><br>here&acute;s the code, i hope it helps someone getting the same problem<br><br>void ReadNESjoy() {<br> nes[0]=1;nes[1]=1;nes[2]=1;nes[3]=1;nes[4]=1;nes[5]=1;nes[6]=1;nes[7]=1;<br> latchlow;<br> clocklow;<br> latchhigh;<br> wait;<br> latchlow;<br> nes[0]=dataread;<br> for (int i = 1; i &lt; 8; i++) {<br> clockhigh;<br> wait;<br> nes[i]=dataread;<br> clocklow;<br> wait;<br> }<br>}<br><br>
Doesent work! <br> <br>Just throws a buncha error messages like &quot;nes not declared in this scope&quot; among other things.
<p>This worked for me:</p><blockquote>void ReadNESjoy() {<br> latchlow;<br> clocklow;<br> latchhigh;<br> wait;<br> latchlow;<br> <br> for (int i = 0; i &lt; 8; i++) {<br> output += dataread * (1 &lt;&lt; i);<br> clockhigh;<br> wait;<br> clocklow;<br> wait;<br> }<br>}</blockquote>
Hi again, <br> <br>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. <br>I tried to configure a &quot;repeat delay&quot; and a &quot;repeat rate&quot;, 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? <br> <br>Thanks.. <br>
Hi Jeanot1314, <br> <br>Could you show me the code you've written? <br>
thanks for the code ^^ To simplify i tried with the serial reading without processing. This work on actual version of arduino. <br> <br>void loop() { <br> output = 0; <br> ReadNESjoy(); <br> Serial.println(output); <br> delay(50); <br>} <br> <br> <br>void ReadNESjoy() { <br> latchlow; <br> clocklow; <br> latchhigh; <br> wait; <br> latchlow; <br> output += dataread * (1 &lt;&lt; 0); <br> for (int i = 1; i &lt; 8; i++) { <br> clockhigh; <br> wait; <br> output += dataread * (1 &lt;&lt; i); <br> clocklow; <br> wait; <br> } <br>} <br> <br>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. <br>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
This does not work for me, i get the following error-message whilst trying to upload to my Arduino UNO:<br><br>-----------------------------------------------------------------------------------------------------------<br>The &quot;BYTE&quot; keyword is no longer supported.<br>-----------------------------------------------------------------------------------------------------------<br><br>ArduinoSketch.cpp: In function 'void loop()':<br>ArduinoSketch.pde:-1: error: 'BYTE' was not declared in this scope<br><br>As of Arduino 1.0, the 'BYTE' keyword is no longer supported.<br>Please use Serial.write() instead.<br><br>-----------------------------------------------------------------------------------------------------------<br><br>Any ideas of how to fix this issue? //John
i had the same error. <br>i think its because you/we are using a newer version of the arduino program <br> <br>i just installed an alpha version and all worked fine. <br> <br>give that a whirl.
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!!!
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?<br><br>I'm working on a multimedia project that would be running 24/7 and have both NES &amp; SNES emulators available. It would be great if a user could just plug in the appropriate controller and get started without any other configuration.<br><br>Another noob question: If I have 2 NES ports and I plug in two controllers, will the &quot;player 1&quot; and &quot;player 2&quot; identities remain bound to the ports (so I can have it just like a NES, player 1 on left port, player 2 on right?)<br><br>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? :/
Apparently something went wrong when I reupdated the code, sorry for the inconvenience. It has been uploaded now :O
Cool, thanks much!
hey how easy is this to multiply the numer of controllers that can be conected
Very late reply:<br><br>Quite easy, the clock and latch from the arduino can be connected to several controllers. You only need one seperate data line per controller.<br>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???!!!!!).<br><br>How many controllers are you interested in hooking up?<br>(that is, if you still are interested lol)
Hey <a class="entryListTitle" href="../../../member/Prodigity/" rel="nofollow" style="line-height: 16.0px;padding-right: 4.0px;padding-left: 0.0px;">Prodigity</a>thanks for this, it's awesome!<br /> I have one question and one suggestion. The suggestion is to update the code so it has the revised buttons = &quot;this should w0rk... line in it. I struggled with that until I eventually read all of the comments.<br /> <br /> 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&nbsp;reset the arduino by re-uploading the sketch.<br /> <br /> Is there a way to look for the 'z' in processing so that the buffer doesn't ever slip out of sync?<br /> <br /> Thanks for this instructible! I'll be back to post my results when I am finished!<br />
I think I&nbsp;figured it out. Here's the code. It goes in at the end.<br /> <br /> &quot;buttons = NESjoy.readStringUntil('\n');&quot;<br /> <br /> 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!<br /> <br /> <br />
Hey olskool,<br><br>Remade the arduino and processing code completely. (2 million years later lol)<br>I'm quite happy with the arduino code but the processing code might still need some changes..
Heyz,<br /> <br /> Sorry for not responding, I haven't been on instructables for a while.<br /> You're right, I should update the code.. I will get round to it as soon as I'm motivated x'D<br /> As for the additional code, I will implement it and mention you on my 'ible.<br /> Thanks for showing interest in my 'ible =D<br /> <br /> Greetz,<br /> Joshua<br />
I got it resonsive to the nes controller.exe file :( minus the start button ) <br>but how do you get it working with emulators??? do you need a driver?
Hi Lewsidius,<br><br>I've currently updated the code, you might want to try the new code (it should work much better).<br>The program reads the messages the arduino sends and emulates a keyboard, so you don't need drivers.<br>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.<br><br>For FCEUX e.g.<br><br>Config &gt; Input<br>[Port 1] Configure<br>[Virtual gamepad 1]<br>Press the up button in the program, press the up button on the nes controller.<br>Repeat for every button.<br>Done!
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.<br><br>and grampafish: Check out the two lines kiwimonk posted below.
How do I get processing code to work it saysrobot cannot be found
Awesome Work!&nbsp; Now I finally have my NES controllers working on a PC!<br /> I was having trouble with the 'A' button (not working)&nbsp; for a while, and thought it was my Seeeduino.&nbsp; Read up on the controller spec..&nbsp;&nbsp; After moving <br /> line 38: digitalWrite(latch1,LOW);<br /> just below line 46 everything worked!<br /> <br /> I also had to place these imports into the Processing Script:<br /> <br /> import java.awt.Robot;<br /> import java.awt.AWTException;<br /> <br /> After I got it all working I modified the code a bit to support two controllers.&nbsp; If anyone is interested, let me know ;)<br /> <br /> Thank you to you and <span class="post-author vcard"><span class="fn">Sebastian for the great project!</span></span><br />
I WANT THAT CODE!!!!!!!!!!!!!! please.
http://www.megaupload.com/?d=KDTY05VX Enjoy ;)
could you please upload it on rapidshare I can not access megaupload
Cool!<br /> You do know you can buy USB NES controllers online, right? [<a href="http://www.thinkgeek.com/geektoys/games/ba5a/" rel="nofollow">link</a>]<br />
Yeah, those controllers brought me on the idea.<br /> More specifically this website: <a href="http://www.retrousb.com/" rel="nofollow">www.retrousb.com</a><br /> (though it's more fun to make it yourself :P)<br /> <br /> Greetings,<br /> Prodigity<br />
&nbsp;One question, could i do this with a light gun?
Ehm, I haven't tried this myself but it should work assuming the emulator supports it and you use a crt/tft/tv screen.<br /> 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).<br /> <br /> Good luck and have fun tinkering.<br />
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.<br />
A bit more difficult I'm afraid.<br /> The N64 controller has a completely different protocol,<br /> I did a quick google and came up with this:<br /> <a href="http://www.mixdown.ca/n64dev/" rel="nofollow">www.mixdown.ca/n64dev/</a><br /> <a href="http://courses.cit.cornell.edu/ee476/FinalProjects/s2002/jew17/lld.html" rel="nofollow">courses.cit.cornell.edu/ee476/FinalProjects/s2002/jew17/lld.html</a><br /> Not impossible, but you'll have to start from scratch.<br /> (I'll look into it)<br />

About This Instructable




Bio: Semi-Creative Lack of concentration Believes beards are awesome <3 Arduino Willing to help people in need of answers to teh interwebz q's
More by Prodigity:USB NES controller with an arduino! 
Add instructable to: