Whilst building the Nintendo, I still kept checking in on the forums for help and I saw more and more amazing builds. One that looked fun, was a Pi Zero in a Gameboy chassis and I got thinking more about a possible portable version of my Retropie. I had actually just sold my old Gameboy on eBay so I dipped out on doing this project (plus it still looked a bit beyond me at the time soldering etc wise) but I then stumbled upon this NES Controller build. It looked good, was portable and didn’t involve me hacking up anything too much. So, I put my name down on the notification list for a Pi Zero and ordered one as soon as stock came back in.
I liked the idea of the NES controller, but didn’t want to limit the games I could play to just one or two of the consoles built into Retropie by having so few buttons. I thought about a Megadrive pad, a SNES pad and even watched some arcade-sticks for Playstation on eBay til the prices skyrocketed! Then I found a Saturn pad cheap, because the cable was frayed. I thought “I don’t need the cable anyway” so took a punt and won it for 1p. When it turned up, I took it apart, cleaned it and checked the condition of the buttons and the board. All looked OK on the face of it, apart from the frayed lead, although I had no way to test it until I went ahead with my build. Speaking of which, I hadn’t really come up with how to wire this into the Pi once it came in, other than I thought there must be a way of mapping the buttons to GPIO some way. I had a little scan through the Retropie Wiki and lo and behold, there is a driver for running these! I had skim-read this part of the Wiki when I was possibly going to wire in the NES controller ports to my other project, but didn’t scroll down past the top half. The bottom half describes the type of pad I had just bought, amongst other SEGA models as well. Jackpot. Now, the table was OK for telling me where to put what wires, the problem was knowing which wire I had for which input. To me, they were just coloured wires (once I’d cut and stripped the frayed cable) and had no idea how to find out. As with all lifes problems, I Googled it. I then discovered this website which told me exactly what wire went where. As you can see, it showed me the plug and which wire went to which pin. From here, I stripped the controller adapter open and labelled my wires 1 to 9 according to what I found. Job done. Next, I had to get my Pi Zero and decide what to do next.
Part 1 – Plan and Pi Zero
The Pi Zero turned up from Pimoroni and I set about taking a look. I ordered the full adapter and case set, and got hold of a cheap wifi adapter too so I could get things updated etc on Retropie once I had the stock image on the card. I opted for just an 8gb card, as I was sticking to NES, Gameboy, SNES and Megadrive for this build, so didn’t need the additional space for larger ROMS. I still has wires left over from my Nintendo project, so soldered the same coloured wires from the pad onto the end, giving me a nice way of connecting the pad to the Pi meaning I could strip it out easily if needs be. I thought, however I built this, that I wanted to be able to access the Pi easily and remove anything I had to without de-soldering or breaking anything permanently. That was where the plan to house the Pi inside the controller went away quickly, plus it was tight inside the case and not practical. I’ll come to this later though.
Firstly, I just wanted to wire this thing up and see if it actually worked like I wanted. I had got, in the Pi starter set, 2 types of GPIO pin headers: a straight and a right-angled one. My plan was to use the right-angled one to keep the profile lower once I connected the wiring to it. As I’ve mentioned before, my soldering skills are not the best, so having to solder all 40 pins made me a bit nervous. In fairness though, I got it done by just taking my time and not worrying if a joint looked bad. I moved on and came back to it later rather than fret about it. Once I got into a good rhythm, it was OK and I came through quite unscathed.
I wired up the pad according to the instructions in the Wiki (see below) then moved onto getting the driver installed and set to run on each restart.
Now, the driver is a bit more fiddly than just plugging the wires in, but it’s all pretty much documented in the readme file that comes with it. To install, you can select it from Retropie setup. It should update the packages it needs to run and once installed, asks if you want to see the readme. The basics are: modprobe monitors the inputs, you need to tell it the type of controller you’ve connected, then you need to set it to load on startup with that configuration. Lots of help was found here which is the official thread on the Raspberry Pi forums about it by the developer. I needed a bit of guidance for getting it to run correctly on startup, but with the help on that page, it was straightforward enough and did require a bit of file editing on the Pi config files. I fired up jstest and checked the pad – it worked! Lots of lovely numbers popping up when I was pressing the buttons. Bonus! So I loaded EmulationStation and configured the buttons via the setup, then I was away! I decided, unlike my NES project, that the exit-emulator hotkeys were all going to be the same as I was using the same pad for all emulators, so I set that in the retroarch config files in the config directory for the emulators I was going to use. I moved all other ROMS folders for the unwanted emulators to a folder called unused and they disappeared from the main screen, making it nice and clean. I also fiddled with the startup config to hide the terminal text when loading. Apart from setting the Pixel theme by Rookervik and designing a top splash video, there wasn’t much more config to do with the Pi itself, so I set to work on how best to attach it to the controller.
Part 2 – Casing up the Zero
I wanted to attach the Pi somehow to the controller externally. Internally was a no-go since the pad was quite tight inside, and I wanted easy access to the Pi should I wish to swap the SD card or something. I decided on a small plastic case-like-tub-thingy on the back. Technical, yeh. I tried finding a small storage box, but they were all a bit bulky. Then, when binning some of my son’s old dummies, I saw the case they came in. The lid was quite shallow, yet big enough for the Pi. It had a nice curve to it, and where the clasp was, if carefully cut out, would give a small groove fit for some cables to feed into. So this was born!
I cut the bottom out so that I could access the HDMI and micro-USB ports and used the case that came with my Pi as an idea of how to secure it. As it was one of the layered perspex cases, it was held together with nylon screws. I just added the case as the outside layer and fed the screws right through. Pretty neat I thought. I then added a braided-plastic sheath to the cables so that when it was finished up there would be no exposed leads and give a nice finish.
Next up, was to spray the case up and figure out how to hold it onto the back.
I used the same Hycote plastic spraypaint I had on the base of my NES, and finished with a protective lacquer. In the meantime while this dried, I came up with a plan to use two plastic panels secured to the controller with short screws and some heavy-duty velcro to hold the Pi to the controller.
And when secured:
I continued to tinker with the fitting the next day and came up with an idea to use the boot from a black cat 5 cable to feed the leads through and give a neat edge to the chassis. I also improved the velcro fittings to give a more snug attachment as well as adding a black skirt to the edges to hide some of the exposed gap between the case and controller. I didn’t want airtight so that the Pi would get some airflow through and wont crap-out and overheat whilst in use.
So, it turned out pretty sweet in the end even if I did blunder through some of it and stumbled across a perfect case in the form of a dummy-box! I’ve played the finished product a bit, but I think I need to review a couple of things. The power lead is a bit restrictive when gaming as it’s straight into the Pi so limits where you can sit with this. Also the same issue with the HDMI lead, as well as the one I’ve got being a bit too heavy-duty so puts a bit of strain on the port when using the pad. I think you could probably get a thinner one to eliminate this problem though, so I’ll keep an eye out. Overall pretty happy with this. I think it looks fairly professional, especially considering I constructed the case myself and couldn’t hide underneath the NES chassis like my other project. It works, and has re-used a pad that was just going to be binned if I hadn’t won it for 1p.
Here it is finished and working:
And a video of as well.
After finishing this I am even more interested in moving onto more projects. I’ve got plenty of ideas and feel that something a bit more Arcade-like may be good. I don’t know about a fixed-screen cabinet (I’ve got nowhere to put one), but using an arcade-stick to house one would be pretty cool. There’s loads of MAME ROMS out there begging to be played, and with Floob (from the Retropie project) working on an alternative called Attract-Mode to sit over the top of the Retropie configs and emulator bundle, I think I could do something really fun! If I could get this running as well as he has done, as well as having it living in an arcade-stick, I think it would be brilliant!