Skip to content

aaron-clovsky/rt4k_auto_profile

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Automatic RetroTINK 4K Profiles using a Raspberry Pi

MOTIVATION

The RetroTINK 4K can be controlled via USB serial connection which makes it relatively easy to interface with using an SBC like a Raspberry Pi. This project was created to interface the gscartsw and Monoprice HRM-2218F with the RetroTINK 4K, enabling automatic profile switching when a console is powered on.

CREDIT

  • Arthrimus published this video and it inspired me
    • You should probably just buy the SVS once it is released instead of using this software
  • Mike Chi made the incredible RetroTINK 4K, and made it very easy to interface with
  • superg for the amazing gscartsw

DESCRIPTION

This service detects input changes on the HRM-2218F and gscartsw and automatically loads one of 12 profiles on the RetroTINK 4K (the same 12 profiles which are mapped to the 12 numbered buttons on the remote). The 8 HRM-2218F HDMI inputs are mapped to profiles 1-8 and the lower 4 SCART inputs (the 4 inputs farthest from the 2 outputs) on the gscartsw are mapped to profiles 9-12 while the upper 4 SCART inputs are not used.

REQUIREMENTS

  • A [RetroTINK 4K] (either PRO or CE should work)
  • A [gscartsw]
  • A [Monoprice HRM-2218F] (discontinued, try eBay)
  • A [Raspberry Pi]
    • I recommend Raspberry Pi Zero WH or Raspberry Pi Zero 2 WH
    • Non-WiFi versions will also work, but SSH will make things easier
    • The pre-soldered header is nice to have, but not required
    • Any other Raspberry Pi (except for the Pico) should also work
    • Other SBCs should also work, but you may need to modify the provided scripts
  • A Micro SD card for the Raspberry Pi's OS
  • A computer to program the Micro SD card
  • A soldering iron if connecting the Pi to the [gscartsw]
  • Solder
  • Wire and Wire Cutters or DuPont Connectors and DuPont Wire for the [gscartsw]'s unpopulated EXT header
    (READ this before deciding how to proceed)
  • An RS-232 to USB cable to interface with the [HRM-2218F] (an FTDI chipset is recommended)
  • A [USB Hub] that can be connected to the Pi
  • A USB-C Y Cable to power the [RetroTINK 4K] and communicate with it over USB at the same time
    (make sure to connect the power-only side to the [RetroTINK 4K]'s USB-C power supply)
  • A USB-C Cable to connect the [USB Hub] to the data side of the USB-C Y Cable
  • A Micro USB or USB-C Cable to power the Pi
  • Two [5v 2A USB PSUs]

BUILD INSTRUCTIONS

  • Download and install Raspberry Pi Imager (use this link if on Ubuntu).
  • Use Raspberry Pi Imager to install Raspberry Pi OS to a Micro SD card (I used Debian Bookworm, the latest release as of 1/1/2025).
  • Download ctrl_monoprice_4067.c and Makefile from this repo, and copy the files to /home/pi, then run the following commands on the Pi:
    • cd /home/pi
    • make
  • Download read_gscartsw.sh from this repo
    • Follow the instructions in README.md to connect your gscartsw to your device and edit read_gscartsw.sh if required, then copy read_gscartsw.sh to /home/pi and run the following commands on the Pi:
      • cd /home/pi
      • chmod +x read_gscartsw.sh
  • Download rt4k_auto.sh and rt4k_auto.service from this repo, and copy the files to /home/pi, then run the following commands on the Pi:
    • cd /home/pi
    • chmod +x rt4k_auto.sh
    • sudo -s
    • cp rt4k_auto.service /etc/systemd/system
    • systemctl enable rt4k_auto.service
    • systemctl start rt4k_auto.service
    • exit
  • Connect your [Raspberry Pi], [USB Hub], [RetroTINK 4K], [gscartsw], [HRM-2218F] and both [5v 2A USB PSUs] as shown below in the hookup diagram

HOOKUP DIAGRAM

                PWR | <------- USB Cable -------> [5v 2A USB PSU #1]
[Raspberry Pi] GPIO | <------- 4x Wires --------> [gscartsw]
                USB | <------- USB Cable -------> [USB Hub]

                                 |--- Power ----> [5v 2A USB PSU #2]
          | <----- USB-C Y Cable |--- Data -----> [RetroTINK 4k]
[USB Hub] |
          | <------ USB to RS-232 Adapter ------> [HRM-2218F]

DEBUGGING

Run sudo systemctl status rt4k_auto.service to view the service's logs

EXTENDING THIS PROJECT

rt4k_auto.sh is relatively simple to extend, more devices and more types of devices can be added as needed.

Both ctrl_monoprice_4067 and read_gscartsw.sh are implemented to work the same way when run:

  • Write a single number: [0-8] as output to stdout
    (all other output goes to stderr)
  • 0 indicates: NO ACTIVE INPUT, [1-8] specifies the active input

By writing additional programs or scripts that follow this protocol, new devices can be polled in the main loop of rt4k_auto.sh. The only current limitation is that no more than 12 profiles can currently be selected .

FUTURE DIRECTIONS

Using the new SVS Commands would provide more than 12 automatic profile options.

NOTES

The HRM-2218F has excellent MiSTer DirectVideo DV1 SPD Infoframe compatibility.

LICENSE

This software is licensed under the MIT License.

About

Automatic RetroTINK 4K Profile Switching

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages