SNES Arcade Controller

[Daniel] is making a mini arcade cabinet with an SNES housed inside. He wanted to build an arcade controller for it and chose to construct something from scratch instead of destroying an original piece of hardware. We can almost feel you guys sighing with relief at that one. He sent us some nice photos of his build and pointed out that he’s using one of the Evilmadscientist AVR boards housing an ATtiny2313. The arcade buttons are readily available at sparkfun. The source code for this project is available after the break.


/**
 * Emulate a 16-bit input shift register with integrated pullup resistors.
 * In other words, a SNES controller.
 *
 * Daniel Holth
 */

#include
#include
#include

ISR(SIG_PIN_CHANGE)
{
 /* Pin change interrupt for latch */
 USIDR = PINA | (PIND & 0b01111100) | (PINB << 7);
 USISR = (1 << USIOIF); // clear overflow bit, set counter to 0
 USICR |= (1 << USIOIE); // enable overflow interrupt
}

ISR(SIG_USI_OVERFLOW)
{
 /* USI finished shifting out 8 bits... */
 USIDR = (PINB << 3) | 0x0f;
 USISR |= (1 << USIOIF); // clear overflow bit
 USICR &= (0xff ^ (1 << USIOIE)); // disable overflow interrupt
 // TODO: output should be low after all 16 bits have been read out,
 // according to <a href="http://www.raphnet.net/electronique/arcade_control/arcade_control_en.php" target="_blank">http://www.raphnet.net/electronique/arcade_control/arcade_control_en.php</a>
}

int main() {

 USIDR = 0xff;
 USICR = (1 << USIWM0) | (1 << USICS1); // 3-wire mode; external, positive edge.
 // USICR = (1<<USIWM0)|(1<<USICS0)|(1<<USICS1); // negative edge

 DDRA = 0;
 DDRD = 0;
 DDRB = 1 << 6; // MISO

 // Enable pullups
 PORTA = 0x3;
 PORTB = 0b11111;
 PORTD = 0xfc;

 // USIDR is shifted out MSB first.

 // pin change interrupt for latch pin
 PCMSK = (1 << 5);
 GIMSK |= (1 << PCIE);

 sei();

 while (1) {
 sleep_mode();
 }
}

22 thoughts on “SNES Arcade Controller

  1. as Frode stated, a SNES controller is just two 4021 shift register chained together. The SNES provides power, clock and latch. I can’t see something easier.
    For the “cost” of a ATtiny2313, it should include an autofire mode or something like that.

  2. Looks familiar, aside from the mangling of the angles in the source code. Yes, a pair of shift registers could have done it, but if an MCU is what you have on hand… besides, it’s a learning experience.

  3. love the controller he built but the micro controller is overkill unless he plans to wire it up to more than one console. If it is just for an SNES then he should have gotten one of those horrid 3rd party controllers for like a dollar at thrift store and just used its PCB. or just used the shift registers like stated above. this is OVERKILL. =D

  4. I keep seeing people mention that the microcontroller will allow him to add some functionality later on. What better functionality for your favorite arcade fighter then MACROS. ‘b+a+right trigger+up’ entered in one button press for a sweet super punch. And recording them and playing them back would be really easy with that ATtiny. That and a small menu would allow you to select a set of them really easy.

  5. I have to critique his choice in a stick. The zippyy stick is a skoppy knockoff of the Seimitsu LS32 joystick. If he removed that bootleg and put in a nice, authentic joystick, he’d have a lot more fun with the joystick, I guarantee it.

  6. Eh. Not sure why people are complaining that much.

    The 4021Bs cost about $0.60 each and the ATtiny2313 is about $2.60 each according to Digikey. Its roughly 2x more expensive but thats only ~$1.30 which isn’t much.

    If Daniel was going to put this design into mass production and doesn’t intend to add any other features to it at all then sure, its a waste of money but otherwise, not a big deal IMO.

  7. This is my project. I’m quite aware I wasted a dollar, and a couple of hours of programming time, by using the micro. I /also/ destroyed a knockoff SNES controller to get the plug.

    On the other hand I had a micro, the EMS protoboard is a much nicer place to solder the wires than a gamepad circuit board with holes drilled in it, and I didn’t have to fiddle with soldering 12 pullup resistors because they are built into the micro. I learned how to use the Universal Serial Interface and I left the USART free in case I ever want to add serial communication.

    Great tip about the higher quality Seimitsu joystick. It’s barely more expensive than the one I used. By no means is this an “easier” controller than the gamepad, but it is a really fun way to play. If I build another one I’ll try using higher quality parts.

  8. ain’t it easier to solder the buttons straight to a snes controller, it did work for my as it worked too when i did it with a PS2 controller and an USB pc controller, also i’m going to do it with a X-box 360 broken controller i have liyng arround.

  9. This is WAY too much work. Sure its cheaper than buying an i-Pac. But now this device will only run SNES games. For all the effort you should just build a full MAME enclosure with a PC at the core. Then you could run SNES, MAME, Sega, NES, and a host of other games. For almost the same level of work and expense.

  10. Your doing it all wrong…. You really should have used some Tube amps and some Nixie tubes! Some peoples kids these days!

    Awesome HACK (By all definitions btw)

    Keep up the good work!

  11. The ATTiny2313 only costs 1.85 euro where I live. +0.40E for the socket. So 2.25 euro for the whole deal.
    Shift registers, 0.60E, x2, add sockets: (0.60E + 0.40E) x2 = 2.00E.
    So for 0.25E you can add autofire mode, and a smaller package.

    But look up the prices for those buttons and joystick, and you’ll notice that the electronics used are not really part of the costs.

  12. Nice doing. I have used some snes controllers with the directpadpro type connection for my emulation needs, however snes controllers are increasingly harder to find and I would like to use the shift registers as pointed, does anyone has diagram or schematic? Thanks.

Leave a Reply to Daniel HolthCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.