top of page

ALL POSTS:

Using SNES controller with LEDs test

So I was clearing out some old boxes of stuff to see what needed to be thrown away, and i came across a Super Nintendo controller and console. I am not sure that the console part works, but I really wanted to use the controller in a project or something. If you look at the port of the SNES it is really strange.



I thought at first it might be that each pin corresponds to a button, and if you powered it each pin would go on and off depending on it's correponding button state, but there is not enough pins for all the buttons. So after looking up how to use the SNES controller for with a pc i soon found out this was certainly not the case. I found out that there was a latch pin, a data pin, a clock pin, a ground pin and a 5V pin. The fact that it needed 5V is just evidence that it was made to be used with arduino projects! After some further research I found the SNES controller communication protocol and that therefore t how to manipulate these pins to get the output of the button states of the controller.



This is the protocol:

  • The Latch pin is normally off/low

  • The Data pin is normally on/high

  • The Clock pin is normally on/high

You give the latch pin a pulse of 12 microseconds, then pulse the clock pin 16 times with a width of 6 microseconds and a gap of 6 microseconds between each pulse. After the each clock pulse you can recieve data from the data serial pin, for the first 11 pulses because after that it is just always a high voltage.


So you can use this information to write the code that will recognise the buttons that are being pressed. I also went one step further and made the colour buttons: A,Y,B,X light up LEDs of the corresponding colour. Here is the code:


Some pictures


The LED circuit:

This works well for one or two LEDs on but if they are all on, they get less power. This certainly isn't a satisfying solution because they have different max current and max power dissipation, so blue and green seemed much lighter than red and yellow.

RED-50mA

YELLOW-50mA

GREEN-20mA

BLUE-20mA


I am so excited with this because I can use it as a free controller for other projects. It has also opened my eyes to how you can represent multiple button states with latches, clock and data pins. If you asked me last week how to show multiple button states on a small amount of pins, I might have thought of some kind of binary representation, but it wouldn't work if multiple buttons are pressed. This project is by far my favourite so far and has given me an insight to how commercial products work, even if this one is out of date.


:)

0 comments

Comentarios


bottom of page