Oct 10, 2012

RasPiSNES - Design

On the build of the RasPiSNES, some design decisions were made considering the needed connections, and based on the projects incorporated here, namely gamecon_gpio_rpi.

To drive the controllers, the flat cable that was connected to the original SNES board was used, keeping the front plate almost intact. The bonus in using this connection was to get the SNES power led acting as it should.

To show those connections, below are the representation of the RPi header, at left, and the flat cable that came from the front panel, at right, to which the gamepads are connected.


Control Pad connections

For the hotkeys, I was considering the use of an old usb keyboard, but it would kill a good usb port, and to keep it simple I discarded the possibility of an usb hub. Luckily, as only four GPIO pins were used for the two gamepad ports, thirteen remained free!

As the RPi allows for very easy GPIO access with C, C#, python and even shell, among other languages, lets put these pins to work. It is always good to use some spare parts we have as result of some years of collecting junk electronics work, so I took some push-buttons for the essencial operations needed: to pause and manage savegames.
The default operations until this point were based on these keyboard keys:
  • Escape: Exit the retroarch emulator and get back to emulationstation.
    • Map to EJECT on console.
  • H: Reset the current the retroarch emulated console.
    • Map to RESET on console.
  • F2, F4: Save and load games.
    • Map to SAVE, LOAD on the hotkeypad.
  • F6, F7: Change the current.
    • Map to SLOT-, SLOT+ on the hotkeypad.
  • P: Pause games.
    • Map to PAUSE on the hotkeypad.
 Note: I had to remap key F4 to F3 for game load in retroarch.cfg, so if this button got pressed while in emulationstation, it does not quit to the shell. This is quite easy:
#in file
/etc/retroarch.cfg
#added line
input_load_state = f3
These hotkeys are located as hidden as possible at first sight, on the back of the console, and their connections go as this:



Power and Hotkeys

To protect the RPi from some misconnection, I have added a bunch of 10kΩ resistors inline with the pushbuttons. The python script that drive the keys make use of the internal 60k pull-ups, so these were not needed externally.
To make the keys work, the script must be running as user root. As the RetroPie script can make the emulator start on boot, it is only a matter to find where it calls the emulator and start it before:
# in file
/etc/profile
# insert this line..
sudo python /home/pi/rpi-gpio-SNES-commands.py &
# ... before the call to the emulator
emulationstation
The remaining cables (USB, Audio, LAN, Composite) are only passive connections, so no interface is internal, and all ports remain accessible (including one self-made extension for the SD slot).

Oct 8, 2012

RasPiSNES

Recently I've bought a Raspbery Pi to make some little XBMC (a software media center), but after fiddling with it for a week, ideas started to appear.
As some of my hobbies include eletronics and old video-games (notably Super Nintendo), the project that come after was very appealing to me... to make an emulated SNES running on Pi, inside an old SNES case.
Some premises were:

  1. To use as many original components as possible;
  2. Original and unmodified controllers (using gamecon_gpio_rpi driver) ;
  3. Improve original console with save/pause functions;
  4. Use the console buttons in the same way as intended (Power, Eject, Reset) and
  5. Keep RasPi ports accessible.
 To solve #1, MercadoLivre to the rescue (an eBay member in Brazil), find and buy one non-working SNES.
 The item #2 was already explained. Thanks a lot to the author!
 The buttons in #3 and #4 needed a driver, but with Raspberry Pi the pins already have so many API´s to use that I could not resist to just "Keep It Simple" and have adapted an existing python script to fill my needs. Here you can get a copy of the used script.
 At last, but the majority of work done here, #5 was comprised by the RasPi port extensions on the case, pictured below.

Besides Super Nintendo, the RasPiSNES is able to emulate Atari 2600, Nintendo, Sega Master System, Genesys (Sega MegaDrive) and some others with the EmulationStation frontend, thanks to RetroPie script.

 Here are some photos of the RasPiSNES, somewhat ugly inside, but very functional.


 From left to right (Up row):  2xUSB, Control Buttons (Save, Load, Slot-, Slot+, Pause)
(Down Row): Audio out, LAN, HDMI, Power and Composite out.

On the right is the SD Card

Emulator screens: Atari 2600

 Emulator screens: Super Nintendo

 Emulator screens: A good old game!

Inside View, some wires and an auxiliary board to connect the inputs

 Top View, with rewired power, and Eject/Reset connecting to GPIO on RPi

Update: On the second part, we get into the schematics of this project.