I have an idea for a unique custom NES controller and I would like to use an Arduino for this project. The gist of it is hooking up the buttons to multiple shift registers, shifting the data to the Arduino, using the Arduino to perform various manipulations on the shifted data, then sending the data to the NES controller port. A standard NES controller uses a 4021 shift register where the buttons are connected to along with pull-up resistors. The NES then pulses the 4021 shift register on the controller to shift out the bits that represent each of the buttons (at least to my understanding). Essentially in this project, I would like the Arduino to act as the shift register that the NES communicates to, shifting out the manipulated bytes. While I can see a few ways to do this, it is still a little fuzzy in my head and would like some guidance while I wait for the NES controller extension cable I ordered to come in.
The first way would be to hook the clock and latch pins from the NES to the interrupt pins on the Arduino and send the data through the data pin after it detects the clock and latch signals. The other way that I can think of would be to use the SPI pins, but I'm not sure how I'd configure the Arduino to be the slave for the clock and latch pins, while the master for the data pin (unless I am misunderstanding which devices need to be master/slave).
Any advice would be a great help. To be clear, I am not looking to read data from a standard NES controller such as this project: https://www.allaboutcircuits.com/projects/nes-controller-interface-with-an-arduino-uno/
I am looking to create my own NES controller with the Arduino acting as the 4021 shift register. Thank you very much for your time!
The first thing you need to know is how fast the NES is clocking its shift register. It might be too fast for the Arduino to emulate because hardware is a lot faster than a simple Arduino. So measure the NES clock with a scope and see if the project is on.
Some docs to look at.
Thank you both for your responses!
@Grumpy_Mike, unfortunately, I do not own a scope. I am still relatively new to electronics, and have been creating projects like this to learn, but I figured a scope would be overkill at this point. It is something I'm planning on investing in, but hard to do on a tight college budget haha. However, I was able to find this during research
The NES uses a serialized polling mechanism to query the state of the buttons. Every 60 Hz, the NES sends a 12us high signal to the Latch pin, telling the controller to latch the state of of all buttons internally. Six microseconds later, the NES sends 8 high pulses on the Pulse pin, 12us per full cycle, 50% duty cycle.
Source: The NES Controller Handler
I also know Ben Heck was able to use two ESP8266 wifi modules to create a wireless multi-console controller, so I imagine an Arduino of some kind might be capable enough?
@justone, that is a good read. Even though it is for the SNES, it does appear to use a similar protocol, just shifting out 16 bits instead of 8.