Close

SNES success

A project log for Joy Boy

Jump into the action with this awesome joystick for your Game Boy®. Now you're playing with power. Stick power.

Sven DahlstrandSven Dahlstrand 08/13/2019 at 22:380 Comments
SNES controller with relevant pins connected to Arduino Uno.

Yes, I found my old SNES controller and, yes, it uses the same communication protocol as the NES controller and, by extension, the Zinger. In other words: it is a decent substitute until a working joystick shows up.

First thing I did after unearthing the controller, was to figure out its pinout. I ended up learning the order of things from the Schematics, Ports, and Pinouts page at the SFC Development Wiki. There's no fancy drawing this time, just this photo:

SNES controller plug pinout. From left to right: GND, NA, NA, D0, OUT, CLK, +5V.

SFC Development Wiki provides different signal names compared to the ones at wiki.nesdev.com; using data, latch, and clock instead of D0, OUT, and CLK. I like the former, more descriptive ones, better. Next, I hooked up the controller to the Arduino Uno and ran my test program.

Lo and behold, it worked. I made contact! What does that mean? That I'm able to show current controller state, which buttons are held down at any moment, in a serial monitor on my Mac.

Finally, I've made progress.

Serial monitor and source code windows. Each serial output line represents a change in the controller state. It's me, pressing buttons!

What you see in the screenshot above is the result of me pressing buttons frantically during a test session. The controller state fits in a single byte, each bit representing one of the buttons. Can you guess which buttons I pressed in each case with just the screenshot as your guide? There's a hint in the source code window.

On the subject of source code, my test program is pretty simple. On a high level, it implements the NES controller protocol using the Arduino's SPI hardware. At roughly 60 Hz the controller is asked nicely to latch the button state into its shift register and start delivering bits until a full byte is received.

That byte is sent out on the serial line for me to marvel at in the monitor.

I won't go into more details here. The source file is short (< 100 lines) and heavily documented, so I strongly suggest anyone interested to take a closer look and study it.

It's great to be on track again. Now, time to focus on the Game Boy.

Discussions