MegaPi Zero

 

The MegaPi

Not long ago I bought myself a NESpi and was telling a friend about it. She went on to ask me if there was a Sega equivalent, as her brother was an avid Sega fan growing up. Sadly I had to tell her there wasn’t but that added, that building such a console wouldn’t be that difficult, me and my big mouth. Thus I found myself with a new project on the drawing board, added to all the other projects I was tinkering with. When will I learn?

Having built the NESpi and my Picade, I knew EmulationStation could easily accommodate my needs. Not only can it emulate the MegaDrive, but the Master System, GameGear and SegaCD as well. The only real question was what platform I would use for all the grunt work. A Pi3 seemed a little overkill, true it would handle anything thrown at it, but it also hiked up the cost of the build and I was trying to keep to a budget. I might have been able to pick up a second hand Pi2b, however they seem to sell close the what they cost new. I didn’t want to go down the clone route as support isn’t as good, so that left me with one option, the Pi Zero. I’d never tried using a Zero for playing games, messing about with electronics yes, but gaming just seemed a little to demanding for BCM2835 processor. However if you read up on the Zero, for such a tiny board, you realize its actually quite powerful. Clock at 1Ghz, the CPU is approximately 40 percent faster than the same chip inside the original RaspberryPi. Tests have shown the Zero operates roughly four times faster then the original Pi. While I was never going to see Pi2 performance, it would hopefully be enough to emulate the MegaDrive. It seems a little crazy that a 1ghz 32bit processor shouldn’t be capable pf running 30 year old software, but we have to keep in mind, that the Zero is being call upon to accurately emulate a whole console. Translating sound, display, input on the fly, into something close to the real thing.

 

usbhub
Building

From the beginning my intention was to alter the MegaDrive very little, in fact I wanted to replicate the consoles original functions. Allowing the Power and Reset buttons to work pretty much in the same way they had before. I was able to make this possible using Pimoroni’s on/off shim, this tiny board sits atop the Pi’s GPIO header and allows you to safely shutdown the computer with the touch of a button. It also comes with through holes, allowing you to solder your own button to the board. The shim is pretty versatile, you can either use the included header block or solder the shim directly to the GPIO header, thus freeing up the GPIO pins if say you wanted to use another HAT, like a PHAT DAC. Once installed, for the shim to function you must plug power in to it directly and not in to Raspberry Pi. That way power is being fed through the shim in to the Pi via the GPIO header, putting the shim in control of feeding power to the Pi. The added bonus to all of this, is that your bypassing the Pi’s annoying poly fuses.

onoffshim
With the power sorted out, the next step was the Reset button. The Zero, like other Pi’s comes with a pair of through holes labeled ‘RUN’. If you short them, the Pi’s CPU will halt what it’s doing and reset the system. Ordinarily this isn’t something I would recommend doing regularly, as you run the risk of corrupting your SD card. However, if your running a Pi and for what ever reason it locks up. If your only input devices are two joypads, a reset button might just be what you need to get back on track. This was first time I’d ever wired up a reset button on the Pi and later was thankful I had, as on one or two occasions EmulationStation locked up because I’d done something stupid.

Out of the box, the Zero comes with only a single micro USB port, which isn’t much good if you want a two player game of GoldenAxe. To work around this problem, I used a compact USB hub, specifically suited for the Zero as it came with molded micro USB connector and not a full size USB plug. I then used a set of cables to extend two USB ports to the front of the console, where the joystick ports had once been. I also made a custom power lead, one end going to the rear of the console as a dedicated power socket and the other going in to the on/off shim. Always use thick gauge wire when extending the Pi’s power socket as it only take a little voltage drop for the dreaded ‘undervolts’ icon to appear in the top right hand corner of your screen.
backpanel
For the rear panel of the MegaPi, I designed a custom I/O panel to replace the Megadrives existing RF and Power Jack with micro USB and HDMI. After cutting out the existing panel, I hot glued the laser cut acrylic panel in place, along with the cables coming from the Zero. I applied a copious amount of glue to both sockets, especially the HDMI port as I found it a little tight when I was hooking up my TV.

Press My Buttons

I’ve already mentioned how I was able to get functional Power and Reset, but getting both to work with the cases existing buttons was a challenge unto itself. First I began with two tall 6mm tall micro switches, which I soldered to strip board and later trimmed to fit the area under both red buttons on the case. It took a little trial and error, trimming the height of both micro switched until they worked properly with the buttons. When I had both working to my satisfaction, I used my trusty glue gun to affix them to the underside of the top lid. Glue guns are by far, the makers best friend!

switches
With the both switches in situ, all that was left to do was connect them up to the pi itself. A quick test, proved both worked as desired and so the next task was setting up the software.

EmulationStation

Without a doubt, building the Megapi would have been a very different story if it were not for EmulationStation. Setup and configuration of this software has been made very simple, allowing even the most inexperienced to follow it. Configuring the Sega style USB controllers I’d bought was a little fiddly but trial and error eventually prevailed and I had both working as desired. I was even able to setup a custom loading screen and Sega themed booting screen. The first time I came to try out a game, I was really surprised by the performance. The Zero handled most games I threw at it, struggling only once or twice, I doubt very much it could handle any of the 32x or SegaCD titles. But as a bog standard Megadrive it copes pretty well, better then a £5 computer really ought to. But it just goes to show what good value the Zero is and what it possible with such a cheap, tiny computer. I’m really glad the foundation developed the Zero, with the increasing speed of the larger Pi3b and now 3b+, it stands as an affordable foot in the door. Had the Zero not be around, I probably would have tried to buy a cheap second hand Pi2. For the simple fact that the Pi3 was too expensive and powerful for my needs. That being said, I’m not even certain the larger Pi form factor would fit inside the MegaDrive II case.

Conclusion

This was a fun project and not one I would have made had it not been for my friend asking. Truth be told, once built, I grew really attached to it and was sad when it came time to hand it over for my friend to give her brother. From what I gather though, he really loved his birthday present. Hopefully he’s reliving his childhood, maybe even having a mate over for a few beers a game of sensible soccer or Sonic and Tails.

The on/off shim is available via the Pimoroni website at

https://shop.pimoroni.com

Advertisements