Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!
Sam Baker
Published © GPL3+

How To: Make a Custom Retro-Gaming Console

From installing RetroPie to controlling power/subsystems and designing a case, the more or less complete how to guide.

IntermediateFull instructions provided2,333
How To: Make a Custom Retro-Gaming Console

Things used in this project

Hardware components

Raspberry Pi 3 Model B
Raspberry Pi 3 Model B
×1
Micro SD Card (8+ Gb)
×1
Power Button
×1
Cooling Fan
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Power Supply 5V/3A Micro USB
×1
Micro USB Extension Cable, left angle
×1
HDMI Extension Cable, 90 degree
×1
General Purpose Transistor NPN
General Purpose Transistor NPN
×1

Software apps and online services

RetroPie
Fusion
Autodesk Fusion

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)
Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Custom parts and enclosures

Sleek RetroPe Case

Code

Power Button

Python
#!/usr/bin/python
import RPi.GPIO as GPIO
import time
import subprocess

PIN = 3 # Pin 5 on the board is GPIO 3

GPIO.setmode(GPIO.BCM)
GPIO.setup(PIN, GPIO.IN, pull_up_down = GPIO.PUD_UP)
oldButtonState1 = True

while True:
   buttonState1 = GPIO.input(PIN)
   if buttonState1 != oldButtonState1 and buttonState1 == False:
       subprocess.call("shutdown -h now", shell=True, 
        stdout=subprocess.PIPE, stderr=subprocess.PIPE)
       oldButtonState1 = buttonState1
   time.sleep(0.1)

Fan Cooling

Python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
from time import sleep
import RPi.GPIO as GPIO
  
PIN = 18 # Whatever GPIO pin you are using
MAX_CPU_TEMP = 40 #C
  
# Setup
GPIO.setmode(GPIO.BCM)
GPIO.setup(PIN, GPIO.OUT)
  
# Functions
def get_cpu_temp():
   readout = os.popen("vcgencmd measure_temp").readline()
   temp = (readout.replace("temp=","").replace("'C\n",""))
   return float(temp)
  
def fan_on():
   GPIO.output(PIN, True)
  
def fan_off():
   GPIO.output(PIN, False)
  
# Main
while True:
   cpu_temp = get_cpu_temp()
   if cpu_temp > MAX_CPU_TEMP:
      fan_on()
   else:
      fan_off()
   sleep(10) # Checks temp every 10s (Change as you wish)

Credits

Sam Baker
5 projects • 12 followers
Engineer and tinkerer.

Comments