This document is intended for a somewhat advanced user base, but we have made it simple enough to follow along for anyone
- Fresh RetroPie install mounted on an SD Card
- Raspberry Pi Zero (preferably WiFi edition)
- Keyboard
- OTG USB Cable (to plug in a USB A type keyboard)
- Mini HDMI (you know, to see things on a screen)
Setup Raspberry Pi requirements
With your Keyboard and HDMI cable plugged in, go ahead and turn on your Raspberry Pi Zero Allow it to go through the boot requirements (RetroPie will reboot once on it's own)
Once the Raspberry Pi boots into RetroPie, it will start EmulationStation automatically.
You will see a screen telling you to either set up a controller or press F4 to exit.
- Press F4 to exit to terminal
Once the Raspberry Pi reboots into EmulationStation, use your keyboard and navigate to RetroPie configuration
Select WiFi and enter your SSID/PSK information as necessary
Once you have connected to your WiFi network, you can go back to your laptop and continue via SSH from there
Should you choose to work completely from terminal, hit F4 from the EmulationStation menu to get to terminal
sudo iwlist wlan0 scan
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
network={
ssid="your ssid"
psk="your password"
}
sudo systemctl daemon-reload
ifconfig wlan0
If you have done your WiFi correctly from here you can use SSH
ssh pi@[ip address]
- Run the Rapsberry Pi configuration program
sudo raspi-config
In the Interfaceing Options menu, you will need to
- Enable SSH
- Enable SPI
In the Advance Options menu, you will need to
- Expand Filesystem
- Disable Overscan
Once these are complete, you will be asked to reboot you Raspbery Pi. Do so.
We will now be connecting the 2.8" ILI9341 TFT LCD module, so you can set your other keyboard aside for now
From you computer (not the Raspberry Pi)
Enter the following to add a Loadable Kernel Module for the TFT Device
sudo modprobe fbtft_device custom name=fb_ili9341 gpios=reset:25,dc:24 speed=80000000 fps=60 bgr=1 rotate=90
Confirm the module has been loaded
dmesg | tail
See the TFT LCD module details
fbset -fb /dev/fb1
Lets test that we can show 'stuff' on the TFT LCD module (this will simply add static noise)
cat /dev/urandom > /dev/fb1
Map the console to the TFT LCD Module you should now see a scaled terminal window on the TFT
con2fbmap 1 1
Should you ever need to stop the mapping, reverse the command
# switch tft to hdmi
con2fbmap 1 0
Note: if you need to remove the module, simply
sudo modprobe -r fbtft_device
Open the modules file
sudo nano /etc/modules
Add these lines to the bottom
spi-bcm2835
fbtft_device
Hit 'CTRL+X' and 'Y' to confirm the save
This will create an empty file named fbtft.conf
sudo nano /etc/modprobe.d/fbtft.conf
Add this line to the empty file
options fbtft_device custom name=fb_ili9341 gpios=reset:25,dc:24 speed=80000000 fps=60 bgr=1 rotate=90 custom=1
Hit 'CTRL+X' and 'Y' to confirm the save
The following lines will download and install the Frambuffer Copy tool in a folder in the root directory
cd
sudo apt-get install cmake
git clone https://github.com/tasanakorn/rpi-fbcp fbcp
cd fbcp/
mkdir build
cd build/
cmake ..
make
sudo install fbcp /usr/local/bin/fbcp
fbcp
Hit CTRL+C to exit 'fbcp'
In order to have a command or program run when the Pi boots we will edit the 'rc.local' file
sudo nano /etc/rc.local
Add the following just before the exit 0
line
fbcp&
Hit 'CTRL+X' and 'Y' to confirm the save
Your file (if you have no other commands running) will look something like this
### replace with this
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
printf "My IP address is %s\n" "$_IP"
fi
fbcp&
exit 0
USB Audio Configuration
Plug in your USB Audio Card, and list your usb devices
lsusb
Now run the sound modules probe
cat /proc/asound/modules
You will see something like
0 snd_bcm2835
1 snd_usb_audio
The snd_bcm2835
is the default, we wan't to force the USB output so, we will edit the conf file
sudo nano /etc/modprobe.d/alsa-base.conf
Add these lines
options snd_usb_audio index=0
options snd_bcm2835 index=1
options snd slots=snd-usb-audio,snd-bcm2835
Reboot, and return to terminal (F4) once EmulationStation has restarted
List out the module probe
cat /proc/asound/modules
You will see something like
0 snd_usb_audio
1 snd_bcm2835
Success, enjoy the sound
Now we are ready to configure the GPIO on the Raspberry Pi as a controller
cd
curl -O https://raw.githubusercontent.com/adafruit/Raspberry-Pi-Installer-Scripts/master/retrogame.sh
sudo bash retrogame.sh
When you run the retrogame.sh file, you will be presented with a menu.
Select the PiGRRL 2 Controls option, and the program will continue to install some modules.
Once complete, you will be asked if you want to reboot.
You will now be assigning keyboard inputs to action buttons of the controller (GPIO pins on the Raspberry Pi)
Edit the RetroGame configuration file
sudo nano /boot/retrogame.cfg
You can replace the entire file with the following
- pro tip:Hit CTRL+K on you keyboard to delete lines*
# Here's a pin configuration for the PiGRRL 2 project:
LEFT 22 # Joypad left
RIGHT 20 # Joypad right
UP 7 # Joypad up
DOWN 12 # Joypad down
LEFTCTRL 19 # 'A' button
LEFTALT 5 # 'B' button
Z 6 # 'X' button
X 13 # 'Y' button
RIGHTSHIFT 26 # 'Select' button
ENTER 16 # 'Start' button
A 18 # Left shoulder button
S 27 # Right shoulder button
Q 15 # Left trigger button
W 17 # Right trigger button
ESC 16 26 # Exit ROM; PiTFT Button 1
Hit 'CTRL+X' and 'Y' to confirm the save
This is really just a visual check to ensure your file looks as below
Open the EmulationStation Input configuration file
sudo nano ~/.emulationstation/es_input.cfg
Ensure that your file's content are exactly as below
<?xml version="1.0"?>
<inputList>
<inputAction type="onfinish">
<command>/opt/retropie/supplementary/emulationstation/scripts/inputconfiguration.sh</command>
</inputAction>
<inputConfig type="keyboard" deviceName="Keyboard" deviceGUID="-1">
<input name="pageup" type="key" id="97" value="1"/>
<input name="start" type="key" id="13" value="1"/>
<input name="up" type="key" id="1073741906" value="1"/>
<input name="a" type="key" id="1073742048" value="1"/>
<input name="b" type="key" id="1073742050" value="1"/>
<input name="down" type="key" id="1073741905" value="1"/>
<input name="pagedown" type="key" id="115" value="1"/>
<input name="right" type="key" id="1073741903" value="1"/>
<input name="x" type="key" id="122" value="1"/>
<input name="select" type="key" id="1073742053" value="1"/>
<input name="y" type="key" id="120" value="1"/>
<input name="left" type="key" id="1073741904" value="1"/>
</inputConfig>
</inputList>
If all is good as above, hit CTRL+X to exit the editor and
The final reboot, you can now unplug the HDMI from the Raspberry Pi
sudo nano /boot/cmdline.txt
dwc_otg.lpm_enable=0 console=tty1 console=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait fbcon=map:10 fbcon=font:6x12 logo.nologo
Reboot
sudo reboot now
RetroPie will reboot and start EmulationStation (all on the tiny screen)
Once EmulationStation is up, you will again see the 'No Device Configured' screen... ...Don't Panic
With your keyboard plugged in, press and hold 'Enter' until the Controller Configuration shows up on the screen
Hit your keys on your keyboard as mapped above, skip the analog sticks
- pro tip: When you get to the section*
This one is all on you
We DO NOT provide any system or game 'roms', for that you will need Google.