Skip to content

Repository files navigation

TYT TH-9800 CAT Control via Remote Head Serial Protocol

*** Check out the new ESP32_Rewrite branch for a MicroPython port of this software (Runs on an ESP32!) ***

Research

There was no documentation on the remote radio head protocol so I had to reverse engineer it. Here is what I used:

  • Hardware:
  • Software
    • Logic software used with the Logic Analyzer to decode packets to/from radio
    • SerialTool software used to capture, modify and replay packets
  • Issues
    • You can NOT connect 2 TX pins together (radio head + USB adapter) at the same time since they both will be a normally high state (5v). You will need a TX switch or another type of circuit if you want to control radio from both devices.

Required

Software Buy Me A Coffee

  • Python (written in v3.13)
  • Python modules (Install using "pip install -r requirements.txt" for Windows + Linux x64):
    • setuptools (required for DearPyGui build on ARM64)
    • asyncio
    • pySerial-asyncio
    • DearPyGui
      • If you're running an ARMv7/ARMv8 processor (Common in SBCs), you will have to manually build the DearPyGui module.
        (Grab some coffee, the build can take a while on lower end boards)

        apt update
        apt install git cmake python3 python3-pip python3-dev python3-setuptools libglu1-mesa-dev libgl1-mesa-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev
        git clone --recursive https://github.com/hoffstadt/DearPyGui
        cd DearPyGui
        
        #Build for ARMv7 (Ex: Raspberry Pi 2)
        python3 -m setup bdist_wheel --plat-name linux_armv7l --dist-dir ../dist
        pip install ../dist/dearpygui-2.0.0-cp312-cp312-linux_armv7l.whl
        
        #Build for ARMv8 (Raspberry Pi 3 and above, also works on my Orange Pi Zero 3)
        python3 -m setup bdist_wheel --plat-name linux_aarch64 --dist-dir ../dist
        pip install ../dist/dearpygui-2.0.0-cp312-cp312-linux_aarch64.whl
        

How to Run

  • For Windows + Linux, install Python3 and then run "pip install -r requirements.txt".
  • Linux systems can also run the provided installer (install.sh) created by ukbodypilot.
    • This installer is recommended for ARM64 processors due to the more complex install process - See note above for DearPyGui module on ARM64 Linux.
  • Open command line, CD to the directory, and run "python TH9800_CAT.py".

Known Issues

  • On the older Raspberry Pis (32-bit ARM processors), the application GUI may not start due to the legacy OpenGL version.
    Error: "Glfw Error 65543: GLX: Failed to create context: GLXBadFBConfig"
    Fix: Execute the application with these extra args: "MESA_GL_VERSION_OVERRIDE=4.5 MESA_GLSL_VERSION_OVERRIDE=450 ./run.sh"
    • You can also comment the 1st line and uncomment the 2nd line in the run.sh file for armv6l

Hardware Setup

Logic Analyzer

TH9800 Serial USB Setup

RJ12 Pinout at Radio Body

TH9800 Serial USB Closeup

74LS157 - Quad 2-Input Multiplexer IC Setup (Software TX Switch using RTS pin)

74LS157 TX Switch

Screenshots of Python App

Serial Connection Window

Screenshot 2025-04-22 214317 Screenshot 2025-05-02 010311

Radio Interface with All Labels Enabled

Screenshot 2025-05-02 010658

Regular Radio Interface

Screenshot 2025-05-02 010505

Python App Demo

TH9800.CAT.Demo.mp4

Disclaimer

This software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software.

Use at your own risk.

About

CAT control for the TYT TH-9800 radio using the serial protocol between the radio body and the radio head.

Resources

Stars

10 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages