Monthly Archives: February 2018

Raspberry Pi 3 based arcade box DIY

Posted by admin on February 24, 2018
DIY / No Comments

I recently built an arcade box for emulating old arcade games and old home computers but I wanted an authentic experience with a nice box around it, since emulation can be done with anything these days, computers, a pi connected to the tv with bluetooth controllers etc. I ended up having a friend (thanks Tasos) design and cut a box made out of FOREX PVC, which ended up great. I also cut a plexiglass for the top part and printed a nice retro gaming related graphic under the plexiglass. The final box looks like this:

A little explanation on how this works. I installed an 128GB RetroPie from here: for a 200GB microSD card that I put on my Raspberry Pi 3. This saved me a lot of trouble (finding the roms, finding marquees, screenshots, videos, putting everything together etc) but also gave me some space to put some extra stuff that I wanted (I HAD to have the first games I ever loved Рnamely Blue Max and Alley Cat on the Atari XE emulated in there, I just had to). I then got a USB encoder with 10 fire buttons and a 8way stick from ebay ($27 for everything), which looked like this:

This nice thingy looks like a real mess inside the box, but it gives you a USB controller which I connect from the outside of the box to the Pi, using one of the 4 USB ports available. This was by design for 2 reasons. First of all, at any time, I can disconnect the USB from the Pi and connect it to any PC or laptop and use the controller there. Also, I am planning on creating a second identical small system, without the Pi, to use as a player 2 controller which I will just connect to the same Pi and play with friends. I configured the 8 fire buttons as A,B,X,Y,LT,RT,LS,RS and the 1P and 2P buttons as Start and Select. These map nicely to all systems if they don’t require any analog controls. For these, I can still connect USB controllers (like the excellent 8BIT N30 Pro which works as USB or bluetooth if I want to) for other systems or for more authentic gameplay depending on the system.

Wow, messy I know but it works. The buttons go through the holes and screw from the underneath with their own plastic rings, while the joystick is screwed very tight with 4 metal screws. I also dug a little bit on the top of the FOREX, under the plexiglass, to bury the heads of the screws so they don’t push the plexiglass up. The USB encoder also has options for auto fire and turbo fire, which I connected with small momentary buttons on the back of the box. Speaking of the back of the box, this is what it looks like:

From left to right as we see it, we have an HDMI output (put there with a small internal extension from the Pi), the turbo and normal fire modes (mentioned above), an exhaust fan with a fan switch (more on that later), a restart and a shut down buttons (more on that later), a small hole for status leds (more on that later), the exit hole for the USB joystick and for the power cable (the standard 2.5A RPi supply), the standard Pi ethernet and 4 USB ports and a 3.5 audio jack for headphones (also connected to the Pi with a small internal extension).

Here are the initial schematics for the whole thing, slightly altered as I went along:

There are 2 leds (a red and a green) that both fit inside the small whole I mentioned above. The idea was that the green led will light up when the system starts and the red will light up during the shut down sequence (a safer way to shut down the pi than just pulling the plug). In order to do these, I connected the leds directly to GPIO pins (BCM 16 for the green and BCM 21 for the red) with respective resistors and wrote the following python script for the green led to turn it on at startup:

import RPi.GPIO as GPIO

I also connected the “shut down” momentary button on BCM 23 and wrote the following python script to perform a clean “sudo shutdown -h now” and also light the red led:

import os
import time
import RPi.GPIO as GPIO
print("Shutting down...")
os.system("sudo shutdown -h now")

The restart momentary button is connected to the 2 holes on the pi that reset it without any code. These are the pins I refer to:

In the beginning I used very small heatsinks like these:

but let me tell you, with emulation I had huge problems with overheating, even with an NES running. Maybe it’s the enclosed casing, maybe it was the bad heat sinks, whatever the reason, I had issues. I looked it up a little bit and I found a guy on YouTube who did all sorts of test with different heat sinks, with and without fans. Bottom line, fans and a much bigger heatsink with good thermal paste is the best solution.

Here is the guy explaining why:

I used a smaller fan which I mounted sideways with a double sided tape on the board blowing through the heat sink, because putting it on top interfered with the joystick. I connected the fan to 5V (it is a 5V fan) but used a transistor connected to GCM 17, to turn the fan on and off depending on the CPU temperature. Here is the python script:

import RPi.GPIO as GPIO
import os
from time import sleep
import sys
def setup():
def getCPUTemperature():
	res=os.popen('vcgencmd measure_temp').readline()
	print("CPU temperature is {0}".format(temp))
	return temp
def fanON():
def fanOFF():
def getTemp():
	if CPU_Temp > maxTmp:
		if CPU_Temp < minTmp:
def setPin(mode):

	while True:
except KeyboardInterrupt:

This will pass 5V to the fan if the temperature gets higher than 45 degrees C and cut the power when it’s less than 40 degrees C (checked every 5 seconds). Since this is an enclosed space, I figured that extensive gameplay sessions could result in the heat getting trapped inside the case, so just in case (pun intended) I also added a manual exhaust fan with a simple switch to turn on and off manually if needed. This is the fan you see on the back picture with the grill. Since this is also noisier than the small one, I avoid unnecessary noise. I was also able to slightly overclock the Pi using this system to allow it to play Playstation 1 and N64 games smoother. I also positioned the transistor inside the airflow of the fan, to avoid it overheating.

Here are some pictures of the heat sink and fans:

All scripts are run at startup in the /etc/rc.local:

python /home/pi/
python /home/pi/
python /home/pi/ &
python /home/pi/ &
exit 0

I finally configured the controls on Emulationstation, updated everything over ethernet and started playing.

How well does it play? Well, it plays GREAT. And it looks like this: