MintyPi V1.0 Inspired Portable + A Basic Guide To Making A Pi Zero Portable

Show off your completed mintyPi, or post your build logs here!
Post Reply
User avatar
VinnDoesntSleep
Posts: 1
Joined: Sat Jan 07, 2017 12:46 pm

MintyPi V1.0 Inspired Portable + A Basic Guide To Making A Pi Zero Portable

Post by VinnDoesntSleep » Wed Mar 30, 2022 12:24 pm

This project was a pretty important one for me, not because it was complicated or because I'm doing anything special, but because I made it as a homage to the very project that made me want to get into electronics and go on to study electrical engineering. The Original Minty Pi!.
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:
IMG_20220330_174831.jpg
IMG_20220330_174831.jpg (3.33 MiB) Viewed 44620 times
IMG_20220330_174958.jpg
IMG_20220330_174958.jpg (2.8 MiB) Viewed 44620 times
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:
IMG_20220330_175916.jpg
IMG_20220330_175916.jpg (3.04 MiB) Viewed 44620 times
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! :cry: .
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. :o

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]
SETUP
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.
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.
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
After this, enable SSH and setup wifi on raspi-config. You can access it by typing:

Code: Select all

sudo raspi-config
Then you will be installing some dependencies. For the screen we're gonna use fbcp-ili9341 and for controls we're gonna be using GPIOnext. Fbcp-ili9341 requires cmake to be installed, GPIOnext requires python3-pip and the python dependency evdev. Install them using these commands:

Code: Select all

sudo apt-get install cmake python3-pip
sudo pip3 install evdev
Now we're ready to begin setting things up. We'll start with the controls, to install GPIOnext use this command, it will clone the repo to your home folder.

Code: Select all

git clone https://github.com/mholgatem/GPIOnext.git
To install fbcp-ili9341, it's the same process.

Code: Select all

git clone https://github.com/juj/fbcp-ili9341.git
Now the fun part begins.

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:
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)
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.
Here's the PWM audio circuit I used. It includes a Low pass and a High pass filter.
Screenshot from 2022-03-30 19-54-42.jpg
Screenshot from 2022-03-30 19-54-42.jpg (149.77 KiB) Viewed 44620 times
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:
Note: 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.
SETUP 2: THE SEQUEL
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
In the config script, mark the buttons you have using spacebar, once all are marked, press enter. Then the program will scan your inputs, it's pretty intuitive from here.

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 it did not turn on, or you're experiencing problems like a blank white screen or stuttering/glitchy image. Check your wiring for shorts or poor connections.
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 &
It may also help to set the resolution to the screen's native resolution. For this, edit your /boot/config.txt and paste the following at the end:

Code: Select all

hdmi_group=2
hdmi_mode=87
hdmi_cvt=320 240 60 1 0 0 0
hdmi_force_hotplug=1
Now, finally, my mortal enemy... PWM Audio :o
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
If you're gonna go with Mono Audio, paste this:

Code: Select all

dtoverlay=pwm,pin=18,func=2
or

Code: Select all

dtoverlay=pwm,pin=13,func=4
I've heard about GPIOnext messing with PWM audio, in one of the github issues addresses this. Here's the link.

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?

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest