Recalbox 2018 Xmas beta using 2.2“ TFT LCD and GPIO buttons
-
With the 2018 Xmas beta version of recalbox, I made a handheld recalbox game console using 2.2“ TFT LCD and a Raspberry Pi 0 W and GPIO buttons. You can find my youtube video here [https://www.youtube.com/watch?v=q_Xg_Vp2br4](link url)
that demonstrated the following steps:
A. Get all the parts.
B. Solder the parts together.
C. Install Recalbox software.
D. Configure Recalbox for GPIO buttons
E. Configure Recalbox for TFT and speakersA.Get the Parts:
Most of them available on amazon or aliexpress or from China and Hong Kong Taobao.
- Raspberry Pi Zero W
- 16G TF card.
- 2.2" TFT LCD SPI il9341
- 5V USB charger for battery management
- 3.7V 1500MaH LIPO battery.
- Two mini speakers
- 3.5mm headphone jack with switch
- Two 10uF capacitor.
- 14 silent buttons
- 50K VR for LCD brigtness control.
- Mini Slide switch
- double-sided 7cm x 9cm prototype PCB
- 7cm x 9cm Arglic board for back cover.
- Four 3mm x 20mm screws to hold the back cover.
- 0.2mm or 0.3mm laminated (insulated) wire
- mini-HDMI to HDMI convertor plug or cable.
- micro-USB to USB convertor plug or cable.
B. Set up the hardware.
This project uses a double-sided 7x9 cm prototype PCB as the frame of the game console. We shall refer to this as „the PCB“.
Solder the buttons as shown in the layout to the front side of the PCB.
Mount the 2.2“ TFT LCD to the front of the PCB. Insert the pins through the PCB into the 9 pin female header at the other side of the PCB.
Mount the raspberry pi zero W at the back side of the PCB.
Using 0.2 or 0.3mm Laminated (insulated) wires, solder up all the connections from the TFT LCD to the Raspberry Pi following the circuit diagram and the pin layout. The LED pin of LCD connects via a 50K VR to the 3V for brightness adjustment.
Solder one end of the button to ground, and the other end to the right GPIO pin of Raspberrry Pi following the pin layout.
Solder up the 10 uF capacitors, the headphone jack and the speakers as shown in the circuit diagram.
Solder up the 5V battery charger circuit board, the sliding switch and the battery to the 5V and ground pins of the Raspberry Pi according to the circuit diagram.
Cover up the back of the PCB with an argylic board and secure it with screws.C. Install Recalbox software to work in default set up.
Download the Recalbox 2018 12 24 Xmas beta boot image for Respberry Pi 0.
https://forum.recalbox.com- The Recalbox boot image already comes with some freeware game roms. Download more Games Roms from the web.
- Use Etcher or other Sdcard burner - to burn the Recalbox boot image to 16G TF card.
- Insert 16G TF card to the TF card slot of the Raspberry Pi 0 W.
- Connect an HDMI screen to the mini HDMI port of the Raspberry Pi 0W through a mini HDMI to HDMI convertor.
- Connect a USB keyboard to the USB port of the Raspberry Pi trhough a microUSB to USB convertor.
- Connect the Micro USB power cable to the 5V battery charger.
Switch on the slide switch to power it up. - Check that the recalbox splash screen appear and the startup music is played on the speaker. Otherwise, power it down and recheck all the connections.
- The following keys on the keyboard is mapped to the joystick buttons for initial set up:
A=(to proceed), S=(to go back), ENTER/Return as START, Space as SELECT.
Arrow keys Up/Down/left/right are mapped to the D-PAD‘s up/down/left/right. - Press ENTER to get to system menu. Use arrow keys to go to the Network Settings, and press A.
- Once in WIFI menu, use arrow keys and A keys to enable WIFI, input the SSID and password of your WIFI network. Make sure proper upper/lower case is used. Lastly select CLOSE and press A to enable WIFI.
- Go back to the Network Settings screen, and record the IP address assigned to the Recalbox.
D. Modify Recalbox configurtions for GPIO controller buttons
-
From your PC or Mac, SSH to the ip address of the recalbox.
ssh root@192.168.1.170
Or you can try ssh root@recalbox.local -
Login using the id of root and the default root password of “recalboxroot”
-
Type the following commands to set up the GPIO buttons and other parameters for the TFT LCD.
mount -o remount, rw /
cd ~
vi recalbox.conf -
While in vi, use “/pattern” to search for the word. then press ENTER to jump there.
Press A key to turn into edit mode.
Type in required values (using arrow keys, backspace/delete keys where required).
Once editing of that line is finished, then press “ESC” key to go back to read-only mode.
Continue to search for the other parameters.
Once all done, press “ESC” to go back to read-only mode.
Press x:! To save and exit.
system.power.switch=PIN56PUSH
controllers.gpio.enabled=1
controllers.gpio.arg=map=4 gpio=21,24,26,19,5,6,22,4,20,17,27,16,12- The boot up script file of the recalbox 2018 Xmas beta (/recalbox/scripts/recalbox-config.sh) cannot take in the second parameter I put into the recalbox.conf file.
Until this is fixed in a later release, we need to change the following lines to fix this issue so the custom GPIO button pin mapping can take effect.
mount -o remount, rw /
vi /recalbox/scripts/recalbox-config.sh
While in Vi Search for the line with extra2=“$4” using the command /extra2=“ , then press ENTER and a to add a line after it.
extra3=“$5”
Then Search for the line with map="$extra2” using the command /map=“
Then change it to
map="$extra2 $extra3”- After that, reboot the recall box to take effect of the changes by typing
shutdown –r now
- After the recal box has boot up., use the keys on the keyboard to press ENTER to go to the main menu. Then select controller settings and press A. Select configure a controller and press A. press A a second time to confirm.
- You will see a screen to ask you to press and hold one of your joystick keys. Press and hold the A button on your recalbox (not the keyboard) until you see the next screen. If this does not work, the button connections may have something wrong, pls check the connections again.
- If all is good, you will be asked to press the button for each of the joystick keys laid out on the screen. First press the D-pad keys, up, down, left, right, etc. When you come to joystick-1, joystick-2, press Down button on the recalbox to skip these buttons as they are not provided on the GPIO controllers. When you come to L1/page up, press L1 button, L2/pagedown, press R1 button. For L2, R2, L3, R3, there are not provided by the GPIO controllers, skip these buttongs. Lastly, press Hot Key (HK) for the hotkey button.
- Finally press the B button to accept the new buttons configured.
- You will be back to the main menu. Test the up down left right and other buttons on the GPIO controllers.
- If it‘s all good, you can proceed to the TFT screen configuraiton.
E. Modify Recalbox configurations for TFT Screen and speakers.
- From your PC or Mac, SSH to the ip address of the recalbox.
ssh root@192.168.1.170
Or you can try ssh root@recalbox.local - Login using the id of root and the default root password of “recalboxroot”
- Type the following commands to set up the TFT LCD and speaker.
mount -o remount, rw /boot
vi /boot/config.txtWhile in vi, use the down arrow to go all the way to the bottom of the file.
Press A key to turn into edit mode.
Type in the following lines, then press “ESC” key to go back to read-only mode.
Press x:! To save and exit.enable GPIO TFT
hdmi_group=2
hdmi_mode=87
hdmi_cvt=320 240 60 1 0 0 0
dtparam=spi=on
dtparam=i2c1=on
dtparam=i2c_arm=on
dtoverlay=pitft22,rotate=270,speed=64000000,fps=30enable GPIOs analog audio
dtoverlay=pwm-2chan,pin=18,func=2,pin2=13,func2=4
-
Type the following commands to set up the other parameters for the TFT LCD.
mount -o remount, rw /
cd ~
vi recalbox.conf -
While in vi, use “/pattern” to search for the word. then press ENTER to jump there.
Press A key to turn into edit mode.
Type in required values (using arrow keys, backspace/delete keys where required).
Once editing of that line is finished, then press “ESC” key to go back to read-only mode.
Continue to search for the other parameters.
Once all done, press “ESC” to go back to read-only mode.
Press x:! To save and exit.
system.fbcp.enabled=1
global.videomode=default
audio.device=jack -
After that, reboot the recall box to take effect of the changes by typing
shutdown –r now
-
After the recal box has boot up., the TFT screen should dipslay the splash screen and the welcome music will be played on the speakers drivien by the GPIO pins. if you do not get that after 1 minute or more, then somethings wrong. Power down the box and check the connections again.
-
If all goes well, you can start playing a game.
-
That‘s all the steps you need to set this up. Good luck with retro gaming.
-
DONE