Sunday 26 June 2016

Retron Pi

Or things to do with a dead Retron 5..


The Retron 5 is basically a SOC running a emulators that dump the ROM image from the inserted cartridge rather than otherwise acquired ROMs.

And I've a dead one (apparently these are not the most reliable devices), so replacing the SOC with a Raspberry Pi 2 seems like a fair swap as both are Linux based ARM boards running emulators.

I wanted to fully integrate the Pi if possible so that meant getting the controller ports & front panel LEDs working.

First step was to gut the original console, had to remove some of the internal plastic in order to fit the Pi. Once the Pi was in place it was a case of routing the HDMI and USB extension cables to the rear panel and securing in place.

At this point we have a bootable Pi running the RetroPie distribution fitted, but powered from the Pi's micro USB connector.

I made up a board to handle powering on and off the Pi. Its based on an Atmel ATtiny85 microcontroller, its input is the front panel power switch and has outputs to drive the power LED, a relay to switch the Pi power on (or off) and also has an output to drive one of the GPIOs on the Pi to instruct the Pi to shutdown - the Pi is running a daemon monitoring that GPIO and the ATTiny gives it a 10 second countdown before killing the power.


Rear panel of Retron (with accidentally inverted USB port)


So now we can boot and shutdown the Pi from the front panel switch. Next job is getting the controller ports to work. 
For these I used an ATMega8 microcontroller to interface the controller ports and the Pi by having the microcontroller behave as a USB joystick - one for each player.

These particular microcontrollers don't have any USB capability built-in but using the V-USB library its possible to bit bang USB over a pair of IO pins, making it perfect for low speed HID devices like joysticks. The firmware reads the 3 controller ports before building the USB report so all of the controller ports are usable.

The picture below shows how everything is laid out, Pi in the middle, the ATMega8's are the top & bottom near the controller ports and the ATtiny board is tucked away in the upper right. Ribbon cable hooked up to the Pi GPIO is connected to the front panel LEDs.




Fitted the cartridge pcb again, as it adds a bit of weight and rigidity to the console, also has the power switch and LED mounted on it.



Made a tweak to the emulator start up scripts to light a different LED for each emulator running, not crucial but finishes the whole thing off nicely.


SNES emulator


NES Emulator

So that's the basic setup done :)