Introduction: Breadboard RetroPie

This Instructables show how to build a Breadboard RetroPie, no soldering, no 3D printer, no Laser cutter required.

Building a game machine is a very good project to initial child studying electronics. However, most RetroPie projects built by adult, the main reason is building it require too many advance skills at the same time, soldering, 3D printing, or Laser cutting, metal case patching...

This project aims to make it simple, all things built on the breadboard, the first tools you should know while studying electronics.

The most beauty thing using breadboard is most things can be reused. When you want to build the next project you can unplug and reuse the components and also reuse the breadboard itself!

Step 1: Preparation

Raspberry Pi Zero

I know it is cheap but very hard to buy one, if you want the built-in WiFi feature, Zero W is easier to get and also it can enable net play for your game machine

Micro SD card

Please check RPi compatible SD card list here: http://elinux.org/RPi_SD_cards

LCD Module

2.8 inch ili9341 LCD Module

Base Plate

A 165 mm x 112 mm plastic plate help to combine all component together

Breadboard

This project require connect Raspberry Pi Zero, 2.8 inch LCD, 12 controller buttons, power and audio components all together. So it require various size breadboard connected together:

  • 1 x 830 hole breadboard
  • 3 x 170 hole Tiny breadboards

Breadboard Wire

Breadboard's best friend

Fishing Line

0.3mm Nylon fishing line, it helps to fix pin header to Pi Zero without soldering

Pin Header

2x40 18mm pin header
Actually it only require 2x20 pins, but the pins is very easy broken while patching, so buy more for backup purpose

Button

Any breadboard friendly button is OK, I an using:

  • 10 x 12 mm buttons with button caps
  • 2 x 6 mm buttons

Battery Holder

2 x 2 AA Battery Holder

Power Switch

Any breadboard friendly switch is OK

DC-DC 5 V Regulator Module

Battery Holder, power switch and DC regulator combined to provide 5 V power supply to Pi Zero. I recommend using rechargeable battery for environment reason, 4 rechargeable AA battery provide 4.8 V power, it is a little bit lower than 5 V but Pi Zero can tolerate a little bit power shortage. If you always use rechargeable battery, DC regulator can be skipped.

Screw Terminal Block

3 x 2 pins screw terminal block, 2 for battery holder and 1 for speaker

Audio Component (Optional)

  • 33nf capacitor
  • 10uf capacitor
  • 47k Ohm resistor
  • NPN transistor (e.g. 2N2222)
  • A tiny speaker (can be found in old gadgets)

Others

A computer, a card reader and micro USB cable for flashing the RetroPie image and initial settings

Step 2: Design Layout

Breadboard split into 2 breadboard panels. Lower panel base on my previous project (Pi Zero on the Breadboard); upper panel combined with 3 tiny breadboard.

At the lower panel:

  • Raspberry Pi Zero placed at the middle
  • Left side is direction buttons
  • Right side is 6 action buttons
  • Above Pi Zero is select and start buttons

At the upper panel:

  • LCD placed at the middle
  • Besides LCD is power button and audio components
  • Speaker placed above the LCD
  • Left and right side are 2xAA battery holder

Step 3: Prepare Pi Zero on the Breadboard

Please prepare Pi Zero on the Breadboard according to my previous instructables:

https://www.instructables.com/id/Pi-Zero-on-the-Br...

Step 4: Install Game Buttons

Some buttons may need some adjustment to fit on the breadboard firmly.

The buttons layout just depends on your preference, the only thing need to follow is one button terminal connect to GND and another terminal connect to a Pi Zero GPIO.

Step 5: Connect All Buttons 1 Terminal to GND

Step 6: Connect Buttons Another Terminal to a Pi Zero GPIO

Here is the buttons connection summary:

GND -> Up    -> GPIO 22
GND -> Down  -> GPIO 17
GND -> Left  -> GPIO 27
GND -> Right -> GPIO 4
GND -> A     -> GPIO 26
GND -> B     -> GPIO 19
GND -> L     -> GPIO 13
GND -> X     -> GPIO 5
GND -> Y     -> GPIO 21
GND -> R     -> GPIO 20

Step 7: Install Select and Start Button

Buttons connection summary:

GND -> select -> GPIO 16
GND -> start  -> GPIO 6

Step 8: Decorate Button Caps

Step 9: Measure and Cut Base Plate

Step 10: Make Sharp Corner Round

Step 11: Stick Breadboard Altogether

Step 12: Stick the Battery Holder

Step 13: Install Battery Holder Wire to Terminal Block

Step 14: Connect Power Wire

Step 15: Install Power Switch

Here is the battery power connection summary:

left battery holder -ve -> right battery holder +ve
left battery holder +ve -> power switch -> 5 V regulator (optional: only for non-rechargeable battery) -> breadboard 5 V
right battery holder -ve -> breadboard GND

Step 16: Connect LCD Wire

Here is the LCD connection summary:

LCD Vcc   -> breadboard 5 V
LCD GND   -> breadboard GND
LCD CS    -> GPIO 8
LCD Reset -> GPIO 25
LCD D/C   -> GPIO 24
LCD MOSI  -> GPIO 10
LCD CLK   -> GPIO 11
LCD LED   -> GPIO 15

Step 17: Install Audio Component

Here is the audio component connection summary:

GPIO 18 -> 33nf capacitor -> breadboard GND
GPIO 18 -> 10uf capicitor -> NPN transistor base pin
NPN transistor emmitter pin -> breadboard GND
NPN transistor collector -> speaker -> breadboard 5 V

Step 18: Install the LCD Modules

Step 19: Download RetroPie Image

Please download RetroPie image here:

https://retropie.org.uk/download/

Select "Raspberry Pi 0/1" option to download the image for Raspberry Pi Zero.

Step 20: Download Source

2 further source code required for the Breadboard RetroPie:

mk_arcade_joystick_rpi: https://github.com/recalbox/mk_arcade_joystick_rp...

rpi-fbcp: https://github.com/tasanakorn/rpi-fbcp

Simple click "Clone or download" button and then "Download ZIP" from both source web page.

Step 21: Prepare ROM Files

For the non license free game, I think you should only use the ROM that you have the original game.

Or you may find some license free games here:

http://pdroms.de/files

http://www.doperoms.com

Step 22: Flash the RetroPie Image

The steps to flash RetroPie image to the micro SD card is as same as flashing Raspbian image. If you are not familiar the flashing steps, please follow the steps provided by Raspberry.org:

P.S. remember to replace the image file name with the RetroPie image.

Step 23: Copy Files

Copy "mk_arcade_joystick_rpi-master.zip", "rpi-fbcp-master.zip" and your game ROM to the RetroPie micro SD just created.

Step 24: Configure Micro SD

We need further config after RetroPie boot, before that, we need to enable DWC2 USB controller to make network connection between computer and Pi Zero.

Edit the config.txt in micro SD, append the follow line at the tail:

dtoverlay=dwc2

Edit the codlin.txt in micro SD, insert "modules-load=dwc2,g_ether" after "rootwait" keyword. The result should be something like that:

dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait modules-load=dwc2,g_ether quiet loglevel=3 consoleblank=0 plymouth.enable=0 quiet init=/usr/lib/raspi-config/init_resize.sh

Create a blank file called "ssh" in the micro SD to enable openssh server, e.g. in my Mac:

touch /Volumes/boot/ssh

Ref.: https://www.instructables.com/id/Connect-to-a-Ras...

Step 25: USB Connect

Insert the micro SD to Pi Zero and connect the Pi Zero 2nd USB socket (labelled "USB") to the computer.

Wait around a minute, you should find a new network adaptor in your computer. Type the follow command connect to the Pi Zero:

ssh pi@retropie.local

P.S. default password is "raspberry", you should change it ASAP by "passwd" command

Step 26: Configure LCD

Append to "/etc/modules"

spi-bcm2835

fbtft_device

create the "/etc/modprobe.d/fbtft.conf"

options fbtft_device custom name=fb_ili9341 gpios=reset:25,dc:24,led:15 speed=48000000 rotate=90 bgr=1

Ref.: https://retropie.org.uk/forum/topic/7464/ili9341-t...

Step 27: Enable Fbcp

Extract source files:

unzip /boot/rpi-fbcp-master.zip

Compile and install:

cd rpi-fbcp-master/

mkdir build

cd build

cmake ..

make

sudo install fbcp /usr/local/bin/fbcp

cd ../..

Insert the follow line before "exit 0" in "/etc/rc.local"

/usr/local/bin/fbcp &

Append the follow line in "/boot/config.txt" at the tail:

hdmi_force_hotplug=1

hdmi_group=2

hdmi_mode=87

hdmi_cvt=320 240 60 1 0 0 0

disable_overscan=1

dtparam=spi=on

Ref.: https://github.com/tasanakorn/rpi-fbcp

Step 28: Configure Joystick

Extract source files:

unzip /boot/mk_arcade_joystick_rpi-master.zip

Edit buttons definition:

cd mk_arcade_joystick_rpi-master/
vi mk_arcade_joystick_rpi.c

Find the "static const int mk_arcade_gpio_maps[]" row and update to your button definition, e.g. my definition:

static const int mk_arcade_gpio_maps[] = {22, 17, 27, 4, 6, 16, 26, 19, 20, 5, 21, 13};

Compile and install module:

sudo mkdir /usr/src/mk_arcade_joystick_rpi-0.1.5/

sudo cp -a * /usr/src/mk_arcade_joystick_rpi-0.1.5/

export MKVERSION=0.1.5

sudo -E dkms build -m mk_arcade_joystick_rpi -v 0.1.5

sudo -E dkms install -m mk_arcade_joystick_rpi -v 0.1.5

Test the buttons:

sudo modprobe mk_arcade_joystick_rpi map=1

jstest /dev/input/js0

Append to "/etc/modules"

mk_arcade_joystick_rpi 

create the "/etc/modprobe.d/joystick.conf":

options mk_arcade_joystick_rpi map=1

Ref.: https://github.com/recalbox/mk_arcade_joystick_rp...

Step 29: Design Your Own Button Layout

Updated: 2017/05/18

Breadboard is very easy to plug and unplug the components, please feel few to try and design your own button layout.

If you have changed the GPIO connection, you may run the follow script to recompile the modules:

cd mk_arcade_joystick_rpi-master/

export MKVERSION=0.1.5

sudo -E dkms uninstall -m mk_arcade_joystick_rpi -v 0.1.5

vi mk_arcade_joystick_rpi.c

sudo rm -rf /usr/src/mk_arcade_joystick_rpi-0.1.5/

sudo mkdir /usr/src/mk_arcade_joystick_rpi-0.1.5/

sudo cp -a * /usr/src/mk_arcade_joystick_rpi-0.1.5/

sudo -E dkms build -m mk_arcade_joystick_rpi -v 0.1.5

sudo -E dkms install -m mk_arcade_joystick_rpi -v 0.1.5

Step 30: Enable GPIO 18 Mono Audio

Append the follow line in "/boot/config.txt" at the tail:

dtoverlay=pwm,pin=18,func=2

Ref.:

https://learn.adafruit.com/adding-basic-audio-oupu...

https://retropie.org.uk/forum/topic/4269/popeye-pi...

Step 31: Copy ROM Files

Copy ROM files from "/boot" folder to "~/RetroPie/roms/$CONSOLE" folder

Ref.: https://github.com/retropie/retropie-setup/wiki/Tr...

Step 32: Boot RetroPie

  • Turn off the RetroPie:
sudo halt
  • Unplug the USB cable
  • Insert fully charged AA battery
  • Turn on the power switch
  • Follow screen instruction to config the game button
  • Select the console and game
  • Enjoy!

Step 33: Happy Studying!

Breadboard RetroPie is a good starting point of learning Raspberry Pi. It's time to start a Raspberry Pi project with your child!