Through a brief understanding of the reTerminal product from Seeed Studio, it is equipped with a Raspberry Pi CM4 core board, and has a 5-inch multi-touch capacitive screen, and it's a HMI device with extensive of external interfaces. Recently, there has been a wave of retro handhelds gaming console trending on the crowdfunding platform, and it also carries lots of childhood memories. Retro handhelds will never be outdated, where there is a Raspberry Pi, RetroPie must be installed. So my first impression of reTerminal is that it has a screen, a Raspberry Pi and a 40pin GPIO of the Raspberry Pi, and it is only a pair of controllers away from a game console. Of course, it also need a power supply. I hope that this project can bring you some fun while learning the knowledge of using reTerminal.
This project redefines reTerminal as a retro gaming handheld terminal, and defines "RE" of "reTerminal" as the concept of Retro. By designing an external device suitable for reTerminal to connect with the 40pin GPIO of reTerminal, a gamepad shell that is easy to plug and unplug, and at the same time provide power support for the entire system, this project also needs to flash RetroPie system into the reTerminal. The third-party software used in the project will continue its open source agreement, and the software and system tutorials produced will be released in the form of open source agreement GPL3.0, and will be listed on github for future reference.
Project planningBasic functionality:
- It should have a joystick with buttons like: up, down, left, right, A, B, X, Y, START and SELECT.
- RetroPie must be install and functioning with the joysticks.
- Support output minimum 5V 2A, supply power through 5V port on 40pin GPIO.
- Built-in lithium battery pack
- Type-C charging port to charge the battery pack
- a power switch
- Easy to carry and hand hold
- Easy to plug and unplug reTerminal
According to the basic functions of the project, I divide the research into three questions:
- System configuration: How to install RetroPie software and adapt it to the reTerminal environment?
- Button control: How to configure the buttons that connect through the 40 pin GPIO on the Raspberry Pi, and adapt the control interface with RetroPie?
- Power supply: How to provide a stable 5V and at least 2A power supply with a lithium battery charging and discharging function?
we need to thank the rise of open source projects, which saved me time on completing the project.
First of all, the first research reference is Adafruit's PiGRRL 2 project. Adafruit is an American open source software and hardware manufacturer. They have a wealth of learning materials for reference on their official learning platform, and also include project-related hardware development. Their design documents and software hosted on GitHub are all open source licensed. By learning the PiGRRL 2 project, I have the confidence to complete this project. In the PIGRRL 2 project, Adafruit systematically introduced the whole process of using the Raspberry Pi to build a retro game console, including the customized button development board PiGRRL Gamepad connected to the 40pin GPIO of the Raspberry Pi. Install the RetroPie software system and adapt the software configuration for PiGRRL Gamepad buttons, as well as the connection and adaptation methods of the PiTFT screen and the PowerBoost 1000C power supply system. Finally, Adafruit also introduces the design ideas and provides 3D design documents for enthusiasts.
The second reference item is that I have bought a Raspberry Pi lithium battery expansion board from Waveshare, which can provide stable 5V output, support fast charging, and a built-in LED power indicator. Equipped with the Standby button function, this "power bank" chip is well suited for the power management of the "retro game terminal".
The final question is the installation and configuration of the RetroPie software system on CM4. after a simple search about whether RetroPie can be running on the Raspberry Pi CM4 module, I found several crowdfunded retro gaming systems are using the Raspberry Pi CM4 module, which is similar to the Raspberry Pi CM4 handheld (picture from Raspberry Pi CM4 Handheld) project in the picture below.
As a circuit design tool, I chose the free and open-source Easy EDA. At the same time, combined with JLC PCB, it is possible to make a one-stop PCB prototyping services. In addition, you can directly export the BOM on the EDA platform and place an order for electronic components in the LCSC. It's so convenient.
schematic desgin:
First of all, the schematic of the button part are directly refers to the adafruit PiGRRL 2 project, which links the "up, down, left, right, start, select, A, B, X and Y" buttons to the corresponding 40 pin GPIO pins, As shown in the figure below, it is also very convenient to directly adopt the software of PiGRRL 2 project
Then the schematic design of the power supply is based on the schematic of the Raspberry Pi lithium battery expansion board from Waveshare, as shown in the figure below.
图
The before layout the PCB, because of the GPIO pin header of the expansion board from this project and the GPIO pin header of the reTerminal are plug-in interfaces, so when designing the position of the female header of the PCB, you must refer to the reTerminal The placement position and shell design ensure "perfect docking". At the same time, it is also necessary to ensure that the keycaps correspond to the positions of the buttons, so it is necessary to design a shell quickly and simply and determine the outline of the circuit board.
Case Design:For case design, I used Fusion 360 design software. First, I imported the reTerminal STP 3D design file downloaded from the wiki page of Seeed Studio and then found a 40pin GPIO header 3D design file on the model library website, and then align and move the GPIO pin header with the reTerminal GPIO interface to insert in the perspective view and leave a little tolerance. Then, according to the outer contour size of the reTerminal and the size of the protruding part of the 40pin female header, the length of the case after adding the tolerance is basically determined to be 161.75mm, width 168.00mm, wall thickness 3.00mm, and finalized the shape of the PCB accordingly.
Before ordering the everything, I went through everything and made some changes.
Redraw the frame:
According to the new frame, I redesigned a version of the circuit board. This time, I rounded the square corners of the circuit board outline, and also designed the unique name of the project on the silk screen. After all, the design that was applied for competition at that time It basically took a day to get it out, and I didn't care much about the image. After confirming that the DRC was correct, I placed an order to produce the circuit board, and at the same time placed an order for the components required for the project according to the component BOM. When placing an order for the 3D proofing shell, some fine-tuning was made according to production constraints, such as the power indicator. Since the SLA 3D printing technology can only achieve an accuracy of 0.05 mm, this place was hollowed out first.
Revised schematic and board layout design:
BOM List
Configure Retro Pi for reTerminal
Step 1: Prepared keyboard, mouse and Type-C charging cable for reTerminal. Press the power button and wait for the Raspberry Pi system to boot up.
Step 2: Open the Terminal application
Step 3: Enter following command to upgrade the system package:
sudo apt update && sudo apt -y upgrade
Step 4: Please download the Retro Pi installation script that I have prepared for reTerminal
git clone https://gitee.com/robomon/retro-pie-setup-reterminal.git
Step 5: Enter the retro-pie-setup-reterminal folder to run the installation script with following command:
cd retro-pie-setup-reterminal/
sudo./retropie_setup.sh
Step 6: Enter the installation environment, please use the up, down, left, and right keys to guide, and enter to select.:
First, please select the first basic installation (Basic install), then press Enter and select OK. During the long wait for the download and installation process, at the meantime you can find the ROM file of the game you want to play.
Step 7: Next, you need to set the boot to automatically start the Emulation Station. After the installation is complete, it will automatically jump back to the displayed configuration script homepage. At this time, please use the "Down" key on the keyboard to control and select Configuration/tools, and then Press Enter to confirm,
Enter the interface and select the autostart option, and then enter the displayed selection default startup interface, the red box is the game virtual machine, the green box is the Raspberry Pi system, please choose according to the situation, here we are of course To choose to start into the game virtual machine, after confirming OK, there will be a prompt page to remind you to set up to automatically start into the game virtual machine.
Step 7: Now that the game virtual machine has been installed, you can exit the setting page, use the keyboard "right" key to select Cancel (Cancel) and press Enter,
And again use the keyboard "Right" key to select Back (Back) and press Enter,
then Use the right key on the keyboard to select Exit.
and finally return to the command interface.
Step 8: Enter the following command to import a prepared open source 2048 mini game:
cp roms/2048.zip ~/RetroPie/roms/nes/
Step 9: Install the button configuration for retro handheld terminal, first run the following command on the command line, and then the configuration interface will appear.
First, press the number key "1" to choose to configure Retro Terminal,
Then enter "y" in the prompt to confirm the installation,
Finally restart REBOOT NOW? After [y/n] on the interface, enter "y" again and press Enter to confirm the restart.
Note: This will install the configured the key settings for the Retro-pi installation, the specific configuration are listed below:
Step 10: You will first see the Emulation station loading page.
After the loading is complete, the game system emulator option should be appeared. Please refer to Table 2 for the interface button operation method, press the "Z" key to enter the Nintendo game system interface
Press the "Z" key again to enter the 2048 game:
Then the "G" key to start the game,
the up, down, left, and right keys to control the number movement, press the F+G key to exit the game.
The PCB and components finally arrived...Let's get some soldering done...
soldering job done...
The 3D printed case arrived as well.
the M3x8 screw and M3 Knurled nut inserts
Let's start to assemble everything together, insert the M3 Knurled nuts in the front panel nut holes:
Place the 3D printed button in the button slot:
Align the PCB with reserved screw holes on the upper cover.
Then place the back cover and align the screw holes and tighten the screws.
Slot the reTerminal into the retro handheld extension. Pay attention to align the male head of the reTerminal with the female plug of the extension to avoid unnecessary "magic smoke".
Docking successfully:
Connect the power supply to the Tpye-C port of reTerminal, turn it on and wait to enter the virtual game console system. After entering the game system, please refer to the button table for specific handle button operations.
Then select the "NEOGEO" emulator and press the "A" key to confirm.
Once it entered NEOGEO emulator and use the arrow keys to find "Metal Slug 5" and continue to press the "A" key to confirm and enter the game.
Start to play...
Mission 1 Complete !!!
Adafruit pigrrl-2:https://learn.adafruit.com/pigrrl-2/overview
Waveshare Li-Po Battery HAT:https://www.waveshare.net/wiki/Li-polymer_Battery_HAT
Adafruit-Retrogame:https://github.com/adafruit/Adafruit-Retrogame
RetroPie:https://retropie.org.uk/
Raspberry Pi CM4 Handheld 7 - Aegis":https://github.com/juckettd/RaspberryPiCM4Handheld7Inch
PiGRRL Game Pad PCB: https://learn.adafruit.com/assets/34652
Comments