Saturday 6 August 2016

NES + Pi : Power Buttons

I've been a little busy lately, but I got some time recently to do the power / reset buttons, as well as the LED indicator. 

So, as mentioned before I've opted to use a mausberry shutdown circuit - this can handle  on/off switches like the NES, and "momentary" switches too.  It also supports powering an LED too, but for simplicity I decided to hook that directly to the GPIO on the Raspberry Pi itself.

The circuit takes micro-usb in, and has it's own male microusb port onboard, so it basically acts as a power-passthrough to the Pi - albeit it with some light scripting on the Pi itself to handle the GPIO trigger used to initiate a shutdown.

More detailed setup information is on their website here. On that page it shows the only real communication with the Pi itself is through "out" and "in" lines, which are connected directly to the GPIO of the Pi (#23 and #24).  These signals are then handled via a script that is run by updating etc/rc.local on the Pi itself (rc.local just runs scripts/commands during boot).  The instructions to do that are on their setup page too.

The circuit also has solder-points for the power and reset switches, so 4 in total (plus an LED point if you want to run an indicator through the switch rather than the device being powered).  As said above, I'm using the Pi to power the LED instead - and we'll need a resistor on the negative line from the LED.  The positive will be connected to pin #04 on the GPIO (5v DC out), with the negative line going to a ground pin - I chose #39 for convenience due to a short cable length.

I tested it before soldering, thankfully the 5v out does turn off when the Pi shuts down fully, so the LED will turn off and on with the Pi.

I was going to do a wiring diagram for this, but after I'd finished I found mausberry have a really simple wire-colour to solder point diagram on their site here.  I'm pretty sure that's new, I didn't see it before I did my wiring, would have made life easier!

Finished, the wiring looks like this (my soldering is terrible, I know!):

GPIO view

LED - beneath the tape is a resistor

Overview without the cartridge loader

Shutdown circuit - solder points


I had a few problems with the LED indicator - it was driving me nuts!!  Eventually I realised my resistor was incorrect, I'd been distracted by kids running around the house and accidentally connected a 8k resistor rather than 800.

A quick test once I'd replaced the resistor on the LED circuit - all working! :)




I'm not sure if it's obvious from the photos, but I ended up buying a Raspberry Pi 3.  I wanted the convenience of being able to have it connected to wifi, extra grunt for more demanding games, and I decided I wanted a couple of extra USB ports for general use.  Because of that I've also ordered an extra two USB ports for the back of the NES so that I can plug in my Buffalo SNES pads for 16bit games, or my xbox 360 wireless usb connector.

So - the last step is just to cut out the holes on the back of the console of HDMI and USB power - replace the cartridge loader and lid, then we're done!