A simple NES controller to arduino to USB adaptor that lets you configure it to be a HID or joystick or what ever you want.
NES to USB adaptor
I’ve been playing around with RetroPie of late and this got me thinking, I would love to use the old controllers with the emulators. I took to eBay to see how much USB converters and was quite shocked at the prices. This is when I thought that someone out there must have made a NES to arduino adaptor, After a bit of looking I couldn’t find a simple all in one solution. I did find a arduino library that can read a NES controller and another that turns the arduino leonardo into a joystick. All i had to do was combine them both.
Software and libraries
So my first task was to read the NES controller. For the NES controller I used this library HERE. Now we can read the NES controllers we need to turn our arduino leonardo into a joystick the computer can read. I’m using joystick library from HERE, I’m using the joystick library in the “joystick” folder because I’m only using one controller with my project. Using the sample code and adding a bit of my own I get the arduino to be the middle man between the NES controller and the computer.
Turbo pots and a lot of failing
I was ready to pull the trigger and get the simple NES to arduino board spun, then I thought I would have a go and see if I could add in a turbo switch. After I got the turbo switch worked out I also thought wouldn’t it be cool if you could control the speed of the turbo like you can on the NES advantage pictured below
I was quite shocked to find out that I hadn’t used a potentiometer in one of my arduino projects before. If you look for potentiometer simple code HERE they use delay(); but I couldn’t use delays in my time sensitive project. I had to switch to using millis() timers like they do in the blink without delay sample code HERE.
So here comes the fail. I stupidly didn’t do enough testing with the bread boarded prototype. I’m not sure if I didn’t catch the inconsistencies while testing or thought that It must have been some dodgy wiring on the bread board. What doesn’t work is the turbo, What I was doing was using millis timers to rapidly press the and release the button (in software) that correlates to the button being held down on the controller. The turbo is really inconsistency this is what I don’t get. I can’t find anyone else that has added turbo to their NES to arduino adaptor so I can’t compare to anything else. I will post the failed code so if anyone wants to tell me where I went wrong feel free to.
- Arduino pro micro
- 10k ohm potentiometer
- NES female port
- 3 pin switch
- 1206 blue LED
- 1206 220 ohm resistor
Kicad board files – https://github.com/facelessloser/nes2usb_adaptor/tree/master/kicad_board_files
reading NES controller library – https://github.com/joshmarinacci/nespad-arduino
Joystick library – https://github.com/MHeironimus/ArduinoJoystickLibrary/tree/version-1.0
Hardware walk through – https://youtu.be/qgFyICQwugc