-
1Step 1
Basic setup :
Download latest Retropie install for Pi zero and burn it on SD card (a 8 gb sd card is enough)
-
2Step 2
Wifi setup :
Connect Pi Zero, add an USB dongle and configure wifi on /etc/network/interfaces :
auto lo iface lo inet loopback iface eth0 inet dhcp allow-hotplug wlan0 auto wlan0 iface wlan0 inet dhcp wpa-ssid "Your Network SSID" wpa-psk "Your Password"
More information here : http://raspberrypihq.com/how-to-add-wifi-to-the-raspberry-pi/
-
3Step 3
Pi TFT screen setup :
You can then halt the pi and connect the Pi TFT screen.
Get the Adafruit kernel and software :
curl -SLs https://apt.adafruit.com/add-pin | sudo bash sudo apt-get install raspberrypi-bootloader sudo apt-get install adafruit-pitft-helper
And then "install" the screen :sudo adafruit-pitft-helper -t 28r
(type twice `n` for no output console and no on/off switch)Reboot and you can then test screen by sending random data to it :
cat /dev/urandom > /dev/fb1
It that works, you can then tune screen by editing /boot/config and update dtoverlay value :dtoverlay=pitft22,rotate=270,speed=80000000,fps=40
Values below rotates screen, update display speed from 32 to 80 Mhz.More information here :
-
4Step 4
HDMI display cloning :
To show same display as HDMI output, you’ll need to clone video output.
rpi-fbcp is nice for that. Just clone the project, compile it and install it in /opt.
cd /home/pi/ git clone https://github.com/tasanakorn/rpi-fbcp cd rpi-fbcp mkdir build cd build cmake .. make sudo chown root:root fbcp sudo chmod u+s fbcp cp fbcp /opt/
You then need to run it at boot,I put it in /etc/rc.local, just before exit 0
/opt/fbcp &
Reboot and you should see Retropie booting on both hdmi output and the PiTFT screen -
5Step 5
Audio :
Connect resistors and capacitor for audio like described here : https://learn.adafruit.com/adding-basic-audio-ouput-to-raspberry-pi-zero/pi-zero-pwm-audio
I used GPIO 18 (pin 12) and 19 (pin 35).
(optionnal) you can clone WiringPi project, build it :
cd /home/pi/ git clone git://git.drogon.net/wiringPi cd wiringPi git checkout 78b5c32 ./build
(optionnal) check all GPIO :
sudo gpio readall
Fetch then following script to switch GPIO 18 & 19 to output :curl -SLs https://goo.gl/V4JGF6 > gpio_alt.c gcc -o gpio_alt gpio_alt.c sudo chown root:root gpio_alt sudo chmod u+s gpio_alt sudo mv gpio_alt /opt/
and change then pin to output mode :
gpio_alt -p 18 -f 5
gpio_alt -p 19 -f 5
(optionnal) Check gpio :
sudo gpio readall
Pin 18 and 19 should show ALT0 and ALT5.
If that’s ok,try to play a file :
aplay /usr/share/sounds/alsa/Front_Center.wav
Then update volume via alsamixer command.To reconfigure pin at boot, I’ve put thoses lines in /etc/rc.local, before exit 0 :
- /opt/gpio_alt -p 13 -f 5
- /opt/gpio_alt -p 18 -f 5
-
6Step 6
Map button on keyboard :
Then load my forked Adafruit-retrogame (2buttons branch) in order to use controller and compile it.
That version includes some changes to be compatible with GPIO used by audio and also to fix an issue with Neo Geo emulator (the "insert coin" should map tab key).
cd /home/pi/ git clone https://github.com/paulgreg/Adafruit-Retrogame.git cd Adafruit-Retrogame git checkout 2buttons make retrogame sudo chown root:root retrogame sudo chmod u+s retrogame cp retrogame /opt
Compile it and launch it from /etc/rc.local, before exit 0 :
/opt/retrogame &
-
7Step 7
Enable controls in emulator :
As explained on adafruit, add a new udev rule :
sudo vim /etc/udev/rules.d/10-retrogame.rules
And add that content :
SUBSYSTEM=="input", ATTRS{name}=="retrogame", ENV{ID_INPUT_KEYBOARD}="1"
-
8Step 8
Disable wifi :
If everything is working, comment wlan configuration in /etc/network/interfaces.
-
9Step 9
Print 3d parts :
Download files from that project and print them.
My files have been updated from Adafruit’s ones :
-
10Step 10
Assemble :
Assemble and wire power boost (pin 2 and 6), solder buttons like explained on Adafruit’s page except UP button that you need to solder to pin 3 (GPIO 2).
Pin 12 (GPIO 18) is already used by audio.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.