Picture of USB NES controller with an arduino!

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

Picture of 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/
1-40 of 85Next »

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.

Hey, see the reply to Andromorfo above. Your A is first in the cycle and was being skipped with the first clock pulse.

I have leonardo set to press keys like makey makey and it works fine
On everything but emulator
I don't want to use controller I made foot and fist pads but it won't work on emulator please 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

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.

Hey lewsidius did you fix that wsalgllgkwsaklg thing because I'm getting it too
WilliamW242 months ago
I have pins set to print letters on keyboard how can I use this to play games on emulator
For some reason the arduino key presses aren't registering
Ashleyv34 months ago

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.

Videoscope5 months ago
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
Andromorfo3 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

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() {
for (int i = 1; i < 8; i++) {

Doesent work!

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

This worked for me:

void ReadNESjoy() {

for (int i = 0; i < 8; i++) {
output += dataread * (1 << i);
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?

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;

void ReadNESjoy() {
output += dataread * (1 << 0);
for (int i = 1; i < 8; i++) {
output += dataread * (1 << i);

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
scewy3 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 scewy3 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.
wilson3093 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!!!
hoffsta3 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)  chibiturtleboi3 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)
olskool5 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 olskool5 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)  olskool5 years ago

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

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.
kribbyy4 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
kiwimonk5 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 ;)
1-40 of 85Next »