DEV Community

Kyle Trahan
Kyle Trahan

Posted on

Hacking a SNES Controller

I reached the end of the Arduino tutorial book the other day and finally got a look at what it takes to hack into an existing electronic device. Come to find out I don't have to many electronics in my house that my girlfriend was willing to potentially part with. Lucky for me she did have an extra SNES controller that was fit for the job. So I got to work on taking the controller apart. Which was surprisingly easy, and really cool to see that I actually understood, for the most part, what was going on inside.

My plan was to find a SNES game that had a jump action in the game. My goal was to set up a tilt sensor on my breadboard and wiring that to the jump button on the controller. Making it possibly for me to kind of shake the breadboard in order to cause the character to jump.

I had some varying levels of success. I got the functionality working but since I don't have a soldering kit and wasn't really willing to ruin the controller, I was left with taping the wires onto the SNES controller. This made short circuiting the SNES button a little shakey as far as when it would actually work, but in the end it did work! It was more about a proof of concept for me. I am now able to hack into existing electronics and that was a very rewarding feeling.

The code for this project was really simple. I was able to take the tutorial code and make some tweaks here and there to fit my needs. The big new component for me on this was the optocoupler. Optocouplers are typically used to allow transfer of analog or digital information between circuits while maintaining electrical isolation. Basically it allows you to trigger things on and off without the opportunity for the power from each device overlapping.

Heres the code for the project if you were interested:

const int optoPin = 2; 
const int switchPin = 8;
int switchState;

void setup() {
  pinMode(optoPin, OUTPUT);
  pinMode(switchPin, INPUT);

void loop() {

  switchState = digitalRead(switchPin);
  if ( switchState == 1) {
    digitalWrite(optoPin, HIGH);  
    digitalWrite(optoPin, LOW);  


Enter fullscreen mode Exit fullscreen mode

I had a really fun time building this project and am still super excited to continue down the path of microcontrollers. Hope this was a little insightful and have a great day!

Top comments (0)