I wanted to use the stock SNES AC-Adapter to power the system, so I had to find out what it’s output was rated for.
According to the label, the AC Adapter is rated to provide 850mA at 10v. Nintendo is known for quality, so I trust the labeling, and accept that the wall wart could provide what it is labeled.
As the Model B Raspberry Pi runs on 5v, and could use upwards of 700mA, I needed a way to step down the voltage to 5v. Going by Ohms law, and assuming the impractical notion you could convert the voltage with 100% efficiency, you’d have 1700mA power at 5v, but we live in the real world. Actual Super Nintendos use a 7805 linear voltage regulator with heatsink to step down the voltage. While this may have been logical in 1991, and still economical today, there are MUCH better ways of doing things.
I ended up using a Murata DC-DC converter that is rated to provide up to 2 Amps of power @ 5v. According to the data sheet, it is 95% efficient when stepping down 10v. Rough math tells me 95% of the 1700mA I provided earlier gives me 1615mA to work with. To be safe, I placed a 1.5A pico fuse in the circuit, in fact, this is the same value a stock SNES uses. This is cutting it close as the Raspberry Pi typically only begins acts stable when provided with an 1A PSU, but I felt the rest of the peripherals shouldn’t drain too much current. Connecting any high-current USB devices, like a hard drive would likely trip the fuse, but I’ll be mindful not to do that. ;)
If you examine the picture above, you could see I kind of threw in the kitchen sink. A few things to note; on the bottom right corner is a Reset button I stole from an SNES motherboard. It lines up to the case’s Reset button, and will be used later. The unpopulated socket directly above it is reserved for a SuperCIC Lock. The SuperCIC emulates an original SNES CIC chip which is used to check for pirated games. Nintendo got smart later in the consoles life, and started using the “key” in some carts to scan for unauthorized copying equipment by scanning for a lock. I reserved this space as I imagine I may need it for SA-1 games.
As the Pi has no real power management, I needed a way to safely power off the system using the power switch, thus using the switch to physically disconnect the power was a huge no-no. I purchased a P-Channel MOSFET that was way over-kill, and has a nominal Gate-Source voltage of -10v, despite being marketed as being TTL controlled, but using 5v logic is fine. Basically pulling the gate low passes voltage.
The MOSFET is configured to switch power to the entire system with the exception of the power management circuit I have to monitor the switch state, and safely shut down the Pi.
The way I configured the Arduino to do this isn’t elegant, but it works given the limitations. Basically, when the file system, and really the Linux kernel shuts down, the Serial UART TX Pin that is typically a HIGH 3.3v goes low. When the user switches off the power switch, the Arduino logs in to the Serial terminal as a user, and issues a poweroff command. The Arduino then monitors the stat of the Pi’s TX pins. Once the pin goes low, and stays low, I turn off the MOSFET. The detection of this occurring is represented with the green LED in the video below..
If the Pi doesn’t safely power down after about 40 seconds, the Arduino attempts to log in as a user again, and send the poweroff command one last time. If the Pi doesn’t power down about 30 seconds after this, the Arduino kills the power anyway, as life goes on, right?
Connected to the Power Management circuit of things powered all the time is an 74HCT125N chip used to step up the Clock and Latch lines used by both SNES controllers from 3.3v to the 5v logic that they need. It also steps up the Pi’s TX pin that connects to the Arduino. While the Arduino will accept 3.3v as logic high, the chip is there, so why not use it? Also connected is a 74LVC245AN chip needed to step down the SNES controllers 5v Data pin logic to something that won’t damage the Pi. It also steps down the ATMega’s TX pin used to log into the computer.
I kept both chips powered at all times as there is a feature to hold their I/O lines in high impedance, and I didn’t want to have the chips powered off in an environment of a mixed power state. I could probably rethink this, but it works for now.
Next up, setting up the I2C bus, and SNESDev-Pi controller driver..