Electronics | Retro Game Computer

The idea behind this project was to create a large custom case for the Raspberry Pi with a style reminiscent of the older gaming consoles (like the Commodore 64 or the Amiga). The case was made in thin multiplex wood, housing a Raspberry Pi 3B+ that runs RetroPie. In addition, the case accommodates a custom-coloured PS/2-over-USB keyboard, a turn off/on button, a sequence of LEDs to indicate the current CPU temperature, an internal 5V temperature-controlled blower fan, a status LED indicating SD-card activity, externally-routed access ports for HDMI, power, audio/video jack, and Ethernet, and a USB hub containing three extra USB ports as well as various card readers.

The case was made such that both the Raspberry Pi and/or the keyboard can be removed if needed, with custom made compartments for storing cabling (HDMI, power and adapter, earbuds, SD-cards, ...). After sanding down, the wood was painted with multiple layers of various-coloured acrylic spray paints, and coated in two layers of acrylic gloss varnish. The front of the case contains a wooden panel on which an image was created by transferring toner to the wood.

The operating system (Raspbian stretch with RetroPie) runs on a SanDisk Ultra microSDHC UHS-I Card (32 GB, max. 80 MB/s), and also contains the LXDE desktop environment (with Python, Java, Eclipse, LibreOffice, ... and the Conky system resources monitor installed).

  • Painting the keyboard

  •                
  • Soldering the electronics

  •                            

    The fan is a 5V Sunon MagLev 1.2W model, using some 190 mA; it receives its power directly from pin 2 (5V PWR). The fan is controlled via pulse- width modulation (PWM) (including hysteresis) using the 3.3V pin 29 (GPIO5), which is connected to the base of a BC547E NPN transistor (having a 0.7V voltage drop from the collector to the emitter). A 1K ohm resistor is put between the GPIO pin and the transistor, and a diode is placed in parallel with the fan to protect the motherboard from reverse current during the turning on and off sequences of the fan.

    The first three LEDs (green, yellow, and red) are controlled via the 3.3V pins 31, 33, and 35 (GPIO6, GPIO13, and GPIO19, respectively), with currents limited by three 120 ohm resistors. Both the LEDs and the fan are controlled via a Python script running as a service in the background, continuously monitoring the CPU's temperature and being activated accordingly. The fourth LED is a blue one, directly controlled via pin 37 (GPIO26) as its forward voltage is over 3V; it is associated with SD-card activity.

    A pushbutton is also connected to pins 5 (GPIO3) and 6 (GND). There is a Python script running as a service in the background, continously monitoring the button's state, which in turn triggers a proper shutdown sequence for the CPU. In low-power mode, the board is reactivated once the button is pressed again.

    Finally, a truncated 5V blue LED-strip was placed inside the case, placed in series with an on/off switch.

  • Python and Bash scripts


  • Installation instructions
  • # ==================
    # MONITORING SCRIPTS
    # ==================
    -> import all scripts by copy-pasting from UltraEdit into SSH session -> Convert to DOS format (YES)
    
    cd Scripts
    
    sudo chmod +x ShowTemperature.py
    
    sudo chmod +x MonitorShutdown.py
    sudo cp MonitorShutdown.py /usr/local/bin/
    sudo chmod +x MonitorTemperature.py
    sudo cp MonitorTemperature.py /usr/local/bin/
    
    sudo chmod +x MonitorShutdown.sh
    sudo cp MonitorShutdown.sh /etc/init.d/
    sudo chmod +x MonitorTemperature.sh
    sudo cp MonitorTemperature.sh /etc/init.d/
    
    sudo update-rc.d MonitorShutdown.sh defaults
    sudo update-rc.d MonitorTemperature.sh defaults
    
    sudo /etc/init.d/MonitorShutdown.sh start
    sudo /etc/init.d/MonitorTemperature.sh start
    
    vcgencmd measure_temp
    
    # =================
    # ACTIVITY LED (SD)
    # =================
    sudo /boot/nano config.txt
    
    -> modify hdmi_force_hotplug=1
    -> add after last line:
    # use external LED as activity LED
    dtoverlay=pi3-act-led, gpio=26
    
    # lift the current limit from 0.6A to 1.2A
    max_usb_current=1
    
    # ====================
    # SSH ACCESS VIA PUTTY
    # ====================
    Hostname: retropie.local
    Password: pi
    -> Connection -> Data -> Terminal-type string: linux
    Window -> Translation -> Remote character set: Use font encoding
    
    # ==================
    # .PROFILE & .BASHRC
    # ==================
    export PATH=$PATH:~/Scripts
    alias cls='clear'
    alias dir='ls -lh'
    alias adir='ls -alh'
    alias wdir='ls -h'
    alias wadir='ls -ah'
    alias del='rm'
    alias cd..='cd ..'
    alias md='mkdir'
    alias rd='rmdir'
    alias d='sudo du -h | sort -r -h | less'
    alias e='emulationstation'
    alias el='elinks http://www.google.be/'
    alias h='htop'
    alias x='startx'
    alias t='ShowTemperature.py'
    alias c='sudo ~/RetroPie-Setup/retropie_setup.sh'
    alias cr='sudo raspi-config'
    alias s='sysbench --test=cpu --cpu-max-prime=20000 --num-threads=4 run >/dev/null 2>&1'
    alias restartmenu='lxpanelctl restart'
    alias u='sudo apt update ; sudo apt upgrade ; sudo apt autoremove ; sudo apt clean'
    
    # ========
    # SERVICES
    # ========
    sudo raspi-config
    -> Interfacing options
    -> Enable VNC
    
    # ========
    # PACKAGES
    # ========
    -> Install SCUMMVM from RetroPie-Setup
    sudo ./retropie_setup.sh
    -> Manage optional packages
    
    sudo apt-get install sysbench
    sudo apt-get install -y software-properties-common
    
    sudo apt-get update
    sudo apt-get upgrade
    sudo apt-get dist-upgrade
    sudo apt autoremove
    
    -> Install LXDE from RetroPie-Setup
    sudo ./retropie_setup.sh
    -> Manage optional packages
    -> Configuration / tools
    -> Raspbiantools
    -> Install Pixel Desktop Environment
    -> Manage optional packages
    -> Install lin-apple
    -> Install quake3
    
    sudo apt-get install synaptic
    -> gimp
    -> geany
    -> idle-python2.7
    -> Manually create menu (.desktop) in ~/.local/share/applications
    -> idle-python3.5
    -> Manually create menu (.desktop) in ~/.local/share/applications
    
    sudo apt-get install conky-all
    -> Update .conkyrc
    -> Manually add startup desktop script to ~/.config/autostart
    
    sudo apt-get install lxtask
    
    sudo apt-get install libreoffice
    
    sudo apt-get install xscreensaver
    -> Configure shadebobs
    
    sudo apt-get install audacity
    
    sudo apt-get remove openjdk*
    sudo apt autoremove
    sudo apt-get install dirmngr
    sudo apt-key adv --recv-key --keyserver keyserver.ubuntu.com EEA14886
    sudo nano /etc/apt/sources.list
    ---------
    deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main 
    deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main
    ---------
    sudo apt-get update
    sudo apt-get install oracle-java8-installer
    java -version
    javac -version
    sudo apt-get install oracle-java8-set-default
    cat /etc/profile.d/jdk.sh
    ---------
    export J2SDKDIR=/usr/lib/jvm/java-8-oracle
    export J2REDIR=/usr/lib/jvm/java-8-oracle/jre
    export PATH=$PATH:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin
    export JAVA_HOME=/usr/lib/jvm/java-8-oracle
    export DERBY_HOME=/usr/lib/jvm/java-8-oracle/db
    ---------
    source /etc/profile
    -> Manually create menu (JDKAPI.desktop) in ~/.local/share/applications
    
    sudo apt-get install eclipse
    
    ******* IF ARM VERSION IS AVAILABLE (NOT 32-/64-BIT X86) *******
    Download Eclipse from https://www.eclipse.org/downloads/eclipse-packages/
    cd Downloads/
    sudo tar xfz  -C /opt/
    ls /opt/eclipse/
    sudo ln -s /opt/eclipse/eclipse /usr/local/sbin/eclipse
    ls -l /usr/local/sbin/
    -> Manually create menu (Eclipse.desktop) in ~/.local/share/applications
    *******
    
    Fraxion
    -> Manually create menu (.desktop) in ~/.local/share/applications
    
    -> Manually create menu (CUPS.desktop) in ~/.local/share/applications
    
    sudo ./retropie_setup.sh
    	-> Manage packages
    	-> Manage optional packages
    	-> 830 scraper
    	-> Configuration / options
    	-> Scrape all systems
    
    sudo apt clean
    
    # =======================
    # EMULATIONSTATION THEMES
    # =======================
    sudo ./retropie_setup.sh
    -> sudo ./retropie_setup.sh
    -> Configuration / tools
    -> esthemes
    -> Install 28 (mattrixk/metapixel)
    -> Install 33 (HerbFargus/tronkyfran)
    -> Install 55 (dmmarti/steampunk)
    -> Install 106 (lipebello/spaceoddity)
    
    Modify tronkyfran to include favorites
    Move to /etc/emulationstation/themes/tronkyfran
    sudo mkdir auto-favorites
    sudo cp -r ../carbon/auto-favorites/* auto-favorites/
    -> Overwrite theme.xml