I did not do a good job of cataloging this project however, so most of this will be in writing.
This serves as a very basic guide on how to make a retropie portable using a pi zero. If you follow it and run into problems, please consult the issues in the github repositories or ask in the forums.
With this project, I decided to limit myself to get a genuine "basic tools" portable. So, no 3D printing, no Laser Cutting, all by hand.
Here's a picture of how mine turned out:
The parts are held together by 4 M2.5 Screws, they screw into M2.5 nuts that have been super glued to the bottom of the tin. That's the only usage of glue I tolerated. Everything else is attached with 3M VHB tape or some other 20kg double sided tape I had when I needed a thicker gap. I removed the SD card slot from the display and cut the board's corners in order to make it fit properly. I also cut out the perfboard under the speaker so it could sit a bit lower in order to make the tin fully close. I also added a thermal pad where the processor came in contact with the battery because I had some extra space and it helped keep everything cool since I overclocked the pi by about 10%.
Here's a pic of the internals:
There's one thing that I haven't managed to get working, and I'm 99% sure it's because this particular Pi zero is cursed. It refuses to output anything other than HDMI audio, even after a full wipe, setting up audio first, then testing one part at a time, Nothing! .
So I decided I was good with what I had, it still output audio via HDMI and everything else worked completely fine.
Overall I learned a lot about retropie and I couldn't be happier about it. Thank you Wermy and all the entire sudomod community for inspiring me to dive into a pretty awesome hobby and helping out whenever possible. It's hard to believe that original Minty pi video is 6 years old.
GUIDE STARTS HERE
Depending on your approach, this may require some soldering skill. I recommend you practice soldering and get used to how solder flows before attempting this.
I used a regular soldering iron with a knife tip and a hot air station for this project. The hot air isn't required, but helped out with the screen SD card slot removal. A nice pair of ESD safe tweazers and small wire cutters are recommended.
COMPONENTS
- Raspberry pi zero W
- SD Card
- 1400mah lipo battery
- TP4056 USB-C board
- ILI9341 2.8" TFT LCD
- Push Button [x13]
- 3 Pin Switch
- LM358N OpAmp [Circuit Diagram Shown Below]
- 2W 4Ohm Speaker [Or Equivalent]
- Resistor [x4][Values Listed In OpAmp Circuit]
- Capacitor [x2][Values Listed in OpAmp Circuit]
Flash the latest retropie image onto your SD card and plug it on the PI. There's a few things that I find easiest to do before soldering anything.Note: I will be covering GPIO audio in this guide, but since I had problems with it, I can't guarantee it will work. I will link to some troubleshooting articles related to this when we get to it.
Connect it to a display, with a keyboard. Once in the Emulation Station menu, press F4 to quit, this should bring you to the terminal.
In the terminal you will be shown that Pi's specific IP address, write this down so you can SSH into it later.
Update the pi using this command:
Code: Select all
sudo apt-get update && sudo apt-get upgrade
Code: Select all
sudo raspi-config
Code: Select all
sudo apt-get install cmake python3-pip
sudo pip3 install evdev
Code: Select all
git clone https://github.com/mholgatem/GPIOnext.git
Code: Select all
git clone https://github.com/juj/fbcp-ili9341.git
WIRING
I'd recommend wiring the screen before the buttons, to make setup easier. I find it helps to have https://pinout.xyz/ open in order to see which pins to solder to. Solder the screen pins to the ones listed below:
For the buttons, you can solder them to any GPIO pins available on your board, check https://pinout.xyz/ to see the ones you can use. But if you plan to use PWM audio, avoid using GPIO18 and GPIO13 as those are 2 out of 4 pins usable for PWM audio.BL - pin 12 (GPIO 18)
SCK - pin 23 (GPIO 11)
MISO - pin 21 (GPIO 9)
MOSI - pin 19 (GPIO 10)
CS - pin 24 (GPIO 8)
RST - pin 22 (GPIO 25)
D/C - pin 18 (GPIO 24)
VIN - pin 17 (3.3v)
GND - pin 20 (GND)
Here's the PWM audio circuit I used. It includes a Low pass and a High pass filter. Those resistors result in just about 2W of output power from the OpAmp, If you're using a different speaker, calculate the resistor values with this formula:
SETUP 2: THE SEQUELNote: R2 is the 63k resistor and R1 is the 2.2k resistor.
The RPI outputs pwm at 3.3v 20mA, so at about 66mW. So:
Gain = Speaker_Wattage*1000/66
Then to get the resistors:
Gain = 1 + (R2/R1)
It helps if you assume R1 is 1k, then just figure out what value R2 should be.
In my circuit, I used resistors I had in hand, so that's why I didn't use 1k.
I will leave general settings that work with the hardware I listed, if you're using something else, please check the documentation on the library's github pages and issue pages. These two are incredibly well documented.
Let's begin with GPIOnext.
Code: Select all
bash GPIOnext/install.sh
gpionext config
Now let's set up the screen.
Code: Select all
cd ~
cd fbcp-ili9341
mkdir build
cd build
cmake .. -DILI9341=ON -DGPIO_TFT_DATA_CONTROL=24 -DGPIO_TFT_RESET_PIN=25 -DGPIO_TFT_BACKLIGHT=18 -DSPI_BUS_CLOCK_DIVISOR=6 -DSTATISTICS=0
make -j
sudo ./fbcp-ili9341
If your scrolling is low, do the cmake command again but change DSPI_BUS_CLOCK_DIVISOR=6 to a higher EVEN number until that isn't a problem.
Anything else, check the documentation.
In order to make it turn on during startup, paste this onto your /etc/rc.local file.
Code: Select all
sudo /home/pi/fbcp-ili9341/build/fbcp-ili9341 &
Code: Select all
hdmi_group=2
hdmi_mode=87
hdmi_cvt=320 240 60 1 0 0 0
hdmi_force_hotplug=1
This in theory, should be very easy. Go once again to your /boot/config.txt and paste the following:
Code: Select all
dtoverlay=pwm-2chan,pin=18,func=2,pin2=13,func2=4
Code: Select all
dtoverlay=pwm,pin=18,func=2
Code: Select all
dtoverlay=pwm,pin=13,func=4
WRAPPING UP
That should about cover everything. You should now have a very modest yet capable retropie console, and hopefully you have learned a bit in this very very basic guide.
If you manage to spot any mistakes in wiring or whatever here, please let me know. I will fix it right away.
Let me know what you think of my minty pi v1 wannabe. Should I try to make it more complex? Maybe add another branch to the Minty Pi family tree?