Saturday, August 5, 2017

PiGRRL Zero Plus Tutorial


This past summer, my 12-year-old son and I decided to build a handheld video game system called a PiGRRL Zero Plus that runs on a Raspberry Pi Zero.  Considering we had little experience with soldering and small electrical parts, this was a challenging yet rewarding project.  This tutorial is a compilation of the many hours of work and research we did that hopefully someone else will find useful.

Resources
-          There are some helpful videos and downloads on Thingiverse by JPete24 found here.  He also sells cases on Etsy if you don’t have a 3D printer.  You will also need the pdf download of separate instructions found here.
-          There is also a helpful tutorial for the PiGrrl Zero (not Plus) found here.  It is not quite what is needed for the Plus, though, but close enough to be helpful.  (Don’t download the software support packages, though.)

Initial Setup
-          Write the PiGrrl Zero Plus image file (download from here or here) onto the SD card using Win32DiskImager
 
-          For troubleshooting the screen, you can also use the Jessie Lite-based PiTFT 2.8” Resistive Image (download from here) which should work “out of the box”
-          When re-writing an image over the SD card, clear the partitions and format the card first by following the steps listed on the second suggestion found here (the suggestion that uses diskpart in the command prompt):
-           The command line procedure is not simple, but it is the most likely thing to work.
-           When re-formatting the "drive" you're actually only formatting a partition on the drive. You need to use the diskpart utility to remove the partitions and create 1 single partition covering the full volume.
-           diskpart can be a bit dangerous, because if you pick the wrong disk or partition, you can remove data or partitions that are extremely, EXTREMELY important and lose all data on your machine.
-           Proceed with extreme caution!
-           Open up a command prompt as administrator (open the start menu, type cmd and press Enter.)
-           Type diskpart and press Enter. You'll end up with a new prompt that looks like this:
-           DISKPART>
-           Type
-           list disk <ENTER>
-           and you'll get a listing of all drives on your machine.
-           Type
-           select disk # <ENTER>
-           to select a disk, where # is the number of the disk Windows screw-balled. Usually, the device is disk 1, but it's always best to make sure.
-           Then type
-           list partition <ENTER>
-           to get a listing of all partitions on the disk.
-           If you're sure you have the right disk/partition, you can then repeat typing
-           select partition # <ENTER>
-           delete partition <ENTER>
-           until all partitions are removed from that drive.
-           Once the drive is empty, exit diskpart and remove the drive. Wait at least 5 minutes, then re-insert the drive. DO NOT CLICK FORMAT – this will most likely re-create the problem. Instead, enter diskpart again, and select the disk. Then type
-           create partition primary <ENTER>
-           Once you have created the partition, exit diskpart and, in the command promt, type
-           diskmgmt.msc <ENTER>
-           This will provide a reliable way to create a FAT32 partition. On the drive you would like to format (NEVER TOUCH DISK 0!), right click and select format. The allocation unit size option should be default, and the File System option should be set to FAT32. The format may take a while, depending on the disk size, be patient.
-           This should fix partition troubles on any readable USB flash drive.
-          Insert the card in the Pi Zero, use the dual male header to connect the 3.2” PiTFT screen to the Pi Zero (use some poster putty to wedge the Pi Zero and header for a temporary solderless connection), connect a USB hub with a keyboard and wireless connector, and connect the power supply and plug it in to turn it on
-          Don’t put the Pi Zero in upside down!  When the PiTFT screen is facing away from you, the mostly green side of the Pi should be facing towards you.
-          If all goes well, a green light will flash on the Pi Zero, the screen will start out white for about 10 seconds, then turn black, and eventually load Retropie.  This usually takes about 30 seconds.
-          The PiGrrl Zero (not Plus) tutorial pdf instructs you to download PiTFT Support and other things.  There is no need to do this!  The PiGrrl Zero image will already work without PiTFT support.
-          Use the left/right arrows to find RetroPie, hit “X” to select it, use the up/down arrows to find “config wifi”, hit “X” to select it, and follow the on-screen instructions to connect your Pi Zero to your wi-fi
-          Use PuTTY (download from here) to conveniently SSH into your Pi Zero from a computer on the same wifi network.  After opening PuTTY, type in the hostname of “retropie.local” and click “Open”.  A new window should open up and ask for credentials.  After you input the user name of “pi” and a password of “raspberry”, you will gain access to the Raspberry Pi command line.
 
-          In the Raspberry Pi command line (via PuTTY), type “sudo nano /boot/config.txt” to open up the config file.  On the last line of the file, add “display_rotate=2”, press “Ctrl+X” to exit, and save changes on the way out.  This will turn the screen display 180° which is necessary for the PiGrrl Zero Plus.  In the Raspberry Pi command line, type “sudo reboot” to reboot the Pi to test this.
-          To use all the memory on your SD card, expand the file system by typing “sudo raspi-config” in the Raspberry Pi command line, choose “Expand File System”, follow any directions, and reboot.
 
-          To upload roms (and remove pre-installed roms), turn on the Pi Zero Plus, make sure it is connected wirelessly, go to a computer with Windows, open up File Manager, and type “\\RETROPIE” in the address bar.  Choose the “ROMS” folder and copy and paste the new ROM in the appropriate system folder.
-          Sometimes I would get the error message “Windows cannot access Retropie”.  On the Pi Zero Plus, go to “RetroPie” and then “Config WiFi”, get the IP address, and type that in the windows address bar in place of “RETROPIE”.  For example, “\\192.168.1.67”.
-          The Pi Zero is not powerful enough to run N64 (or higher) roms.
-          The Gameboy Advance emulator needs an additional file called “gba_bios.bin” copied in the RetroPie/BIOS folder for its games to work.  The file can be downloaded from many websites (such as here) and one way to copy it over is to go to File Manager in Windows, type “\\RETROPIE\bios” in the address bar, and paste the file there.
-          To change the look of the Retropie menu, go to Retropie, and choose “install emulation station theme” and follow the instructions to download and install.  (My favorite is “Simple Dark”.)  Then restart EmulationStation, go to “UI Settings” on the main menu, and scroll down to “Themes” and pick your theme.
-          Sometimes the font size for a theme is too small for the PiTFT screens (like “Simple Dark” on a 3.2” PiTFT).  To make the font size bigger on a theme, go to the command line, and type “sudo nano /etc/emulationstation/themes/carbon/carbon.xml” (or whatever the name of the theme is) and change all font-size to 0.05 (so that each line with “fontSize” it looks like “<fontSize>0.05</fontSize>”).

Screen
-          Now that everything is working, unhook the PiTFT and use some heavy duty wire cutters to clip off the 2x20 female pins and the other set of 2x16 pins, and solder all 40 points of the dual male header to where the 2x20 female pins used to be.  Place some masking tape on the other set of unused pins to prevent short circuits.  Use a multimeter to test your soldering connections.
-          Cut trace Pin #18 on the PiTFT circuit board.  Use a multimeter to make sure it is cut.
-          Solder the Pi to the other side of the male dual header.  Once again, make sure it is put in the right way: when the PiTFT screen is facing away from you, the mostly green side of the Pi should be facing towards you.  Use a multimeter to test your soldering connections.
-          Turn on the Pi to make sure the screen is working before moving on to the next step

Battery
-          Solder wires to the battery circuit board, switch and Pi Zero GPIO pins exactly as described here.  You will need to snap off the female USB jack off of the battery circuit board and save it for the USB step.
-          Connect the battery to the circuit board and test everything out by turning on the Pi with the battery before moving on to the next step.

Buttons
-          Solder all buttons on the button gamepad (described here). 
-          Also solder the four buttons for the PiTFT that are on the front beside the screen.
-          Solder wires from the two button gamepads (B1, B2, B3, B4, ground) and the two shoulder buttons (but not the TFT buttons) to the appropriate GPIO pin on the Pi Zero.  Use the diagram found here.
-          Since the Pi Zero is upside down and rotated inside the case, I used this modified image to help me (battery ground, battery 5V added; start, select, and TFT buttons not needed):

-          I also used some of the available “ground” pins for grounding the button and audio components
-          It’s also helpful to use different color wires and write down which colors went where to help troubleshoot for later on
-          Use a multimeter to test all your connections.
-          Once soldered, wrap the metal parts of the shoulder buttons with some masking or painter’s tape to prevent accidentally short circuits.
-          Turn on the Pi to make sure the buttons are working before moving on to the next step.  You will probably need to play a game or two (or three or ten) to test this out properly.  (The top TFT button is “Select” and the second TFT button is “start”)

USB
-          Solder wires from the USB OTG adapter to the female USB jack (from the battery circuit board) exactly as described here
-          I could never get this step to work out properly.  The keyboard would work but not the USB hub or wireless (maybe a power issue?)  I bought a $5 micro USB to female USB adapter from Amazon, cut the plastic off the female USB and melted some of the plastic on the case to make it fit in the right spot.
-          Connect a USB device (the hub with keyboard and wireless connector) and turn on the Pi to test your USB wire out before moving on to the next step.

Audio
-          Solder wires from the speaker, potentiometer, and audio circuit board as pictured in the 2nd page of this pdf file
-          I did not need to connect SD to 5V (Vin to 5V was enough)
-          I have no idea how to “bridge between gain and GND” so I did not do that, either
-          Turn on the Pi, load up a game (or two or twenty) to test out the sound before moving on to the next step
-          Maybe it was just my poor soldering skills, but I found the audio to be very finicky and the potentiometer to die out if the volume was maxed out for extended periods of time.
-          Also, the volume knob only works from 90% to 100% (there were several other online reports of this, too)
-          Expect retro sound quality.

Putting Everything Together
-          Tap each screw hole of the case with a tap set.  Screw the tap bit in the hole until it “bites” (a few turns), and then alternate between doing ¾ of a turn right and ¼ of a turn back.  When you have gone far enough, unscrew the tap bit until it comes out of the hole.
-          Screen: Put the four 3D printed TFT buttons in the appropriate holes and balance the case on top of two equally wide books on each side so the buttons can hang down.  Peel the plastic protector off of the screen and place the screen in the appropriate place, lining the screw holes up.  Screw the four screws in to hold the screen in place.
-          I needed a little more wiggle room to install these, so I actually took the soldering gun and melted some of the inside of the case to make more room
-          Buttons: Put the 3D printed D-Pad and 3D printed A, B, X, Y button pad in the appropriate holes and balance the case on top of two equally wide books on each side so the buttons can hang down.  Line the button pads with their two screw holes and screw those in place.
-          I needed a little more wiggle room to install these, so I actually took the soldering gun and melted some of the inside of the case to make more room
-          Don’t screw in the screws all the way or the buttons will stay in the down position.  The button pads will probably not be level.
-          Audio: Place the speaker in the appropriate hole and use a little bit of tape to hold it in place.  Place the potentiometer in the appropriate place and use a little bit of poster putty to hold it in place (or if you are feeling confident use a hot glue gun).  Whatever you use, make sure that you can still spin the potentiometer after you put it in!  Then place the audio circuit board in the top right of the same case and use some poster putty to hold it in place.
-          Battery: Place the battery circuit board in the appropriate place (there are four protrusions to hold it in place), the battery switch in the appropriate place, and the battery in the top middle of the same case.  Use poster putty to hold each part in place.
-          USB: Place the female USB jack in the appropriate place and use some poster putty to hold it in place.
-          Turn on the Pi and test everything out before screwing the two sides of the case together.  If everything works, use some masking or painter’s tape to cover any putty (otherwise wires from the other side stick to them) and any metal parts (so nothing short circuits), place the shoulder buttons and 3D printed shoulder buttons in the appropriate place, put the two sides of the case together, and screw the four screws in place.
-          Enjoy your Pi Zero Plus!
  

No comments:

Post a Comment