USBAudio — CM108 USB Sound Card PTT Controller + SA818/SR-FRS Programming Tool
The USBAudio project is a Windows command-line tool for amateur radio applications, built around a CM108-family USB sound card and a CH340 USB-serial adapter. It provides PTT control and radio programming for SA818 / SR-FRS modules in a single, self-contained executable.
What It Does
This tool combines two essential ham radio functions:
- PTT Control — monitors the playback volume of a USB sound card and automatically keys the radio transmitter (PTT) via CM108 GPIO
- Radio Programming — programs frequency, tone, squelch and volume on SA818 / SR-FRS modules over a CH340 serial port
It's implemented with pure Win32 APIs (WASAPI / HID / SetupAPI / serial port). No DLLs required — just a single static executable.
Key Features
| Feature | Description |
|---|---|
| Auto mode | Detects hardware and picks the right mode automatically |
| PTT control | WASAPI loopback capture, real-time volume monitoring |
| Frequency setup | Interactive setup for SA818 and SR-FRS modules |
| CTCSS / DCS | Full tone configuration for both module types |
| Recorder | Record audio from USB mic, saves WAV + waveform |
| Single file | Statically linked, no external dependencies |
Modes
| Command | Mode | Description |
|---|---|---|
recorder.exe | Auto mode (default) | Picks mode based on detected hardware |
recorder.exe -f | Frequency setup | Find CH340 adapter, program SA818/SR-FRS |
recorder.exe -t | Test mode | Record 5s → normalize → play 5s (verifies PTT chain) |
recorder.exe -r | Recorder mode | Continuous recording from USB mic |
recorder.exe -h | Help | Show all options |
How PTT Mode Works
The PTT mode uses WASAPI loopback to monitor audio output in real-time:
USB sound card plays audio (e.g. AFSK/FT8 from digimode software)
│
▼ WASAPI loopback capture of the render endpoint
Real-time volume monitoring (every 100ms, with a level bar)
│
volume > 5% ──> PTT ON (GPIO3 high, minimum 3s hold)
volume ≤ 5% ──> PTT OFF (after the 3s hang time)
│
▼
CM108 HID report → GPIO3 → radio PTT
GPIO Mapping
| GPIO | Pin | Function |
|---|---|---|
| GPIO3 | bit 2 | PTT control — volume > 5% keys the transmitter with 3s hang time |
| IO4 | bit 3 | Blue COS LED — driven high for 5s at startup, then low |
Live status example:
[ 3.2s] TX vol [########------] 35% PTT:ON 'q' quit
⚠ Note: When using the "incoming radio signal triggers on volume decrease" feature, please remove the diode on the board.
Frequency Setup Mode
The CH340 serial adapter is found automatically and the module type is auto-detected:
| SA818 | SR-FRS | |
|---|---|---|
| Version command | AT+VERSION | AT+DMOVERQ |
| Set-group command | AT+DMOSETGROUP=bw,tx,rx,tx_tone,sq,rx_tone | AT+DMOSETGROUP=bw,tx,rx,tone,sq,tone,1 |
| Tone encoding | 4 digits (CTCSS 0008 / DCS 023N) | 2 digits (CTCSS 08) |
Interactive Setup Flow
- Program detects the CH340 serial port (e.g. COM23)
- Sends
AT+VERSIONto identify the module type (SA818 or SR-FRS) - Prompts you for TX/RX frequency, bandwidth, tone, and squelch
- Sends the
AT+DMOSETGROUPcommand to program the module - Optionally saves channel to memory slot
Supported AT Commands (SA818)
| Command | Purpose |
|---|---|
AT+DMOSETGROUP | Set frequency group (TX/RX, tone, squelch) |
AT+DMOSETVOL | Set volume level |
AT+VERSION | Query firmware version |
AT+SMSG | Send SMS message |
AT+RMSG | Read SMS message |
AT+DMOCONNECT | Connect to repeater |
Dependencies
- Windows 10 or later
- CM108 USB sound card (
USB\VID_0D8C&PID_0012) - CH340 USB-serial adapter (
USB\VID_1A86&PID_7523)
Getting Started
-
Clone the repository:
git clone https://github.com/jumbo5566/sa818.git -
Open in Visual Studio and build (static linking, no external DLLs)
-
Run
recorder.exe— the tool auto-detects hardware and picks the correct mode -
For frequency setup, connect the CH340 adapter and run:
recorder.exe -f
Use Cases
Digi Mode PTT Control
Use it with FT8, JS8Call, or any digimode software that outputs audio to a USB sound card — the tool automatically keys PTT when audio is playing.
SA818/SR-FRS Programming
Quickly configure your SA818 or SR-FRS radio modules without needing a programming cable or vendor software.
Field Day / Portable Setup
Single-file distribution makes it easy to carry on a USB drive for portable operations.
Project: github.com/jumbo5566/sa818
