Go wrapper that runs rpitx modules without the hassle.
Tired of wrestling with raw C binaries that print a usage line and die when you get one argument wrong? gorpitx wraps rpitx so you hand it a module name and a JSON blob. It checks every field, builds the command line, and runs the transmitter as a child process with a timeout, a graceful stop and live output. One transmission at a time, because the Pi has one transmitter.
Runs 12 rpitx programs through one API, with dev mode (a harmless shell loop instead of the transmitter, for tests and laptops) and production mode (actual RF, as root).
| Module | What it sends | Frequency unit |
|---|---|---|
pifmrds |
FM broadcast with RDS station name and radiotext | MHz |
tune |
A plain carrier | Hz |
pichirp |
A carrier sweep | Hz |
morse |
Morse code | Hz |
pocsag |
Pager messages | Hz |
spectrumpaint |
A picture on a waterfall display | Hz |
pift8 |
FT8 | Hz |
pisstv |
SSTV pictures, Martin 1 | Hz |
pirtty |
RTTY | Hz |
fsk |
FSK text through minimodem and sox | Hz |
audiosock-broadcast |
Audio from a unix socket as FM, AM, DSB, USB, LSB or raw | Hz |
sendiq |
Raw I/Q samples, with run-time control over shared memory | Hz |
go get github.com/psyb0t/gorpitxpackage main
import (
"context"
"encoding/json"
"log"
"time"
"github.com/psyb0t/gorpitx"
)
func main() {
rpitx := gorpitx.GetInstance()
args, err := json.Marshal(gorpitx.MORSE{
Frequency: 14070000, // Hz
Rate: 20, // dits per minute
Message: "CQ CQ DE N0CALL",
})
if err != nil {
log.Fatal(err)
}
err = rpitx.Exec(
context.Background(),
gorpitx.ModuleNameMORSE,
args,
30*time.Second,
)
if err != nil {
log.Fatal(err)
}
}Try it anywhere with ENV=dev go run .: the module still validates its arguments, then a shell loop prints the command it would have run until the timeout hits and Exec returns commonerrors.ErrTimeout. On the Pi, run it as root with GORPITX_PATH pointing at your rpitx checkout.
- A Raspberry Pi that rpitx supports, with rpitx installed.
- Root in production mode.
GetInstancepanics otherwise. GORPITX_PATHset to the directory with the rpitx binaries, as an absolute path. The default,$HOME/rpitx, is used literally and does not work.minimodemandsoxforfsk,socatandcsdrforaudiosock-broadcast.
The getting started guide walks through all of it.
The full documentation lives at https://psyb0t.github.io/gorpitx/.
| Section | What's in it |
|---|---|
| Getting started | rpitx install, extra tools, dev mode, first real transmission |
| Configuration | GORPITX_PATH, ENV, the root check, files written to /tmp |
| Running modules | Exec, timeouts, Stop, output streaming, concurrency |
| Modules | Every field, rule and example for all 12 modules |
| Errors | The sentinels to match with errors.Is |
| Troubleshooting | Real failures with the exact message and the fix |
| Architecture | How a call becomes a process |
| Development | Make targets, tests, CI, adding a module |
make lint # go fix -diff, golangci-lint, shellcheck
make test-coverage # tests with the 90% coverage gate
make docs # build the docs site into .testing/docs-siteNo test needs a Pi or root. See Development for the rest, and CHANGELOG.md for what changed in each release.
RF transmission is regulated. Get the license before you transmit. This software is for licensed amateur radio operators, low-power experiments in bands you may use, and education. An unfiltered Pi also radiates harmonics far from the frequency you picked, so put a filter on it.
Absolutely NOT for broadcasting without authorization. The fines are severe.
MIT License, see LICENSE. Use responsibly.
