Introduction: Raspberry Split: a Wireless, Switchable Game System!
The latest trend today in gaming is consoles that can split apart, and switch from handheld to TV in a snap. So, why not build your own? Introducing Raspberry Split, the dual-Pi DIY Wireless Game System that allows for flexible gameplay.
At the end of this Instructable, you will have made a console that:
- Has a 480x320 PiTFT display
- Has a seamless video startup screen
- Has a Python-based menu to choose games from
- Has 32-bit 240x160 resolution game compatibility
- Can switch from handheld to TV, to tabletop and back
- Uses a second Raspberry Pi as a Bluetooth controller
- Has a custom 3D-printed case and dock prototype, and a plastic screen stand.
Note: One of our goals was to see if we could create this project using only off-the-shelf parts. We wanted to fit all parts into no larger than a 4"x6" footprint that felt like a handheld console. It's a bit pricey doing things this way, but we did it, and you can too!
Step 1: Parts!
- LCD: Adafruit 480x320 PiTFT from DigiKey, $44.95
- Microcontroller: Raspberry Pi 3 from DigiKey, $43.75
- Micro SD Card: 8GB Panasonic from DigiKey, $13.66
- Battery: AmazonBasics 5600mah from Amazon, $17.00
- Speaker: ESUMICL2go from Amazon, $7.98
- 3.5mm Jack Extender: Seadream Cable from Amazon, $5.99
- Power Cable: MicroUSB from Central Computers, $7.95
- Charging Extender: MicroUSB Right Angle M/F from Amazon, $3.44
- Video Coupler: HDMI M/M from Central Computers, $5.95
- Gamepad: iBuffalo Classic from Amazon, $15.45
- Microcontroller: Raspberry Pi Zero W from eBay, $24.50
- Micro SD Card: Same as screen
- Battery: RAVPower 3350mah from Amazon, $10.00
- USB OTG Adapter: ChenYang from Amazon, $3.50
- Power Cable: Same as screen
- Charging Extender: Same as screen
- Video Extender: HDMI M/F from Central Computers, $7.95
- Video Coupler: HDMI F/F from Central Computers, $5.95
- Charging Extender: MicroUSB M/F from Amazon, $6.29
- Acrylic Box: #764, Clear from Tap Plastics, $3.65
Step 2: Install Controller Software
First, let's set up the software for the Pi Zero Bluetooth controller.
Step 2: After flashing, edit config.txt on the SD card and add "dtoverlay=dwc2" to the end.
Step 3: Edit cmdline.txt and add a space and "modules-load=dwc2,g_ether" after "rootwait".
Step 4: Place a file called "ssh" with no extension or other information in the card's root directory.
Step 5: Unmount the adapter and insert the SD card into the Pi Zero W.
Step 6: Attach the USB port on the Zero into your computer's USB A port or adapter, and the POWER port to a USB outlet.
Step 7: SSH into the Zero. Install the libraries:
pi@raspberrypi:~ $ sudo apt-get install python-pygame python-pip && sudo apt-get install python-dev && sudo apt-get install bluetooth libbluetooth-dev && sudo pip install pybluez pi@raspberrypi:~ $ sudo nano /etc/rc.local
Add THIS before exit 0:
$ sudo hciconfig hci0 name 'Raspberry Split Controller' $ sudo hciconfig hci0 piscan $ sudo python /home/pi/Bluetooth.py then CTRL+O, ENTER, CTRL+X.
Download the code from Gist!
pi@raspberrypi:~ $ cd ~ && curl -L http://bit.ly/RSController >> Bluetooth.py pi@raspberrypi:~ $ sudo reboot
Step 3: Install Screen Software
Now, let's install software for the Raspberry Pi 3 that enables it to connect to the controller, switch between the screen and TV, and play 32-bit games.
Step 1: Download the system image for the 3.5 inch PiTFT from Adafruit's website.
Step 2: Flash the downloaded file "2016-11-08-pitft-35r.img" to the SD card using Etcher. After flashing, place a file called "ssh" with no extension or other information in the card's directory. This is if you would like to perform Terminal commands on the Pi through a computer.
Step 3: Snap the PiTFT on to the top of the Pi, and boot the Pi.
Step 4: Plug in any keyboard.
Step 5: Tap on the Raspberry at the top left, then Accessories, then Terminal. Move the window so you can see the window buttons, then maximize it to see the entire terminal.
Step 6: Connect to the Net using the Pi 3's WiFi system or through any other preferred method.
Step 7: Type "sudo raspi-config", then go to Internationalization, then Change Keyboard Layout, then choose your country's keyboard layout. Then select Finish.
Step 8: (Download the code from GitHub!): Type the following command.
cd ~ && git clone https://github.com/Raspberry-Split/RaspberrySplit.git && cd RaspberrySplit && sudo chmod -R +x .
Step 8.5: Now, you will need to obtain a file called gba_bios.bin. It's 16kb, place it in ~/RaspberrySplit/Apps/gpsp/. It's required to play most 32-bit games.
Step 9: Type "sudo apt-get update && sudo apt-get install python-dev && sudo apt-get install bluetooth libbluetooth-dev && sudo pip install pybluez && sudo pip install python-uinput"
Step 10: Go through the prompts, installing all of the libraries.
Step 11: Type "sudo nano /etc/modules", add uinput to the end of the file, then save and quit by pressing CTRL+O, ENTER, and then CTRL+X.
Step 12: Type "sudo nano /etc/systemd/system/dbus-org.bluez.service", add a space and then "-C" after "bluetoothd", save and exit nano as usual. "sudo reboot".
Step 13: Reopen Terminal.
Step 14: Type "sudo raspi-config", then go to Boot Options, then Console. Then select Finish. Then press escape to avoid shutting down the system.
Step 15: Type "cd RaspberrySplit", then type "sudo cp cmdline.txt /boot/cmdline.txt && sudo cp rc.local /etc/rc.local".
Step 16: Now, the steps change if you want to use a TV or computer monitor when you switch.
For TV, type this:
sudo cp config_TV.txt /boot/config.txt
For monitors, type this:
sudo cp config_monitor.txt /boot/config.txt
Step 17: Type "sudo reboot". Unplug the keyboard and Internet cable if needed.
Step 4: Add Games
You can use any 32-bit game with 240x160 resolution. I can't supply the games; you may obtain them through the way that is legal in your country.
Step 1: Insert the SD card into your computer. Create a folder in the SD's root called exactly "Games". Then create two folders inside of it called "GameFiles" and "BoxArt".
Step 2: Inside "GameFiles", place your 32-bit games inside with a .32bit extension. For best results, use ALL CAPS for the title.
Step 3: Inside "BoxArt", place two copies of the same PNG box art images for each game. One will have the suffix "@1x" and the other "@2x". (Make sure to make sure the names are exactly the same, like "SNAKE.32bit" and "SNAKE@1x.png" as well as "SNAKE@2x.png")
Step 4: Resize all of the "@1x" images to EXACTLY 145x145 pixels, and the "@2x" ones to 290x290 pixels.
Step 5: Eject the SD card and put it back in the Pi.
Step 6: Boot the Pi! It should work! You'll see all the games displayed on the menu.
Step 5: Play It!
Connect the USB controller through OTG to the Pi Zero, and power on the batteries for the controller and screen. You can unplug the USB keyboard.
Except for a case to put everything in, you now have a working prototype!
Here's how to navigate the menu.
START GAME: A
QUIT GAME: Start and Select
VOLUME UP: X/V+
VOLUME DOWN: Y/V-
SHUT DOWN: Start, Select, L, AND R
Step 6: Switch It!
Connect the Raspberry Split via HDMI to your TV or monitor. Press X and Y, (V+ and V-) to switch!
Now you can play in high resolution on the TV or monitor. You can move the controller up to 40 feet away.
When you need to go somewhere, unplug and switch back! Now it's a portable system again.
Step 7: Prototype a Case
We started with a cardboard prototype to make sure all off-the-shelf components would fit within a 4"x6" footprint. After reviewing and trying many different batteries, cables, couplers and extenders, we settled on the final components.
We ended up choosing the best-fit flexible cables, with the smallest bend radius, and the shortest connector ends.
The batteries used were ultra compact, provided 2 amps of power and included a power on and off button.
The USB controller cable was originally 6ft long. In order to fit the controller in the case, we needed to splice the USB cable and shorten it to 3". We rerouted the cable from the top to the bottom of the controller so it could easily reach the OTG connection on the Pi Zero.
Step 8: Design a Case
From the cardboard prototypes, we were able to make measurements and transfer data into Fusion 360 to create 3D printer ready files.
The biggest design issue was figuring out a way to secure the screen and controller together in handheld mode, but also make them detachable. We settled on a tongue and slot system, which allowed the two units to be split apart when switching from handheld to TV or tabletop mode.
Step 9: Make a Stand
We used a soldering iron to cut a diagonal slot on the lid of a small plastic display box. The width of the box balances and supports the weight of the screen and makes it easy to use for tabletop mode.
You can get creative and come up with your own stand design!
Step 10: Final Notes
Every project must have limitations. The Raspberry Pi's GPU can only output to HDMI or composite. So, an SPI TFT display, which is the best way to get a portable screen on a Pi, and the only way to support more than 1 screen connected (switching), can't be accelerated by the GPU.
And, most games USE the GPU as their only source of output.
So, the Raspberry Split must use a CPU-based utility to copy the GPU's output to the PiTFT. For games that have a lot of action (fighting games and fast racing games), this might sometimes result in slight input delay and video lag. This is not an issue when you switch to the TV, though.
Also, some older TVs don't work with the Pi's HDMI output and display a "Mode Not Valid" message.
The Next Step
Our next step is to try to build this project without off-the-shelf parts! If you can figure it out before us, let us know!
Runner Up in the
Microcontroller Contest 2017
We have a be nice policy.
Please be positive and constructive.