Skip to content

PIrateRF is a fucking badass software-defined radio (SDR) transmission platform that turns your Raspberry Pi Zero W into a portable RF signal generator with a sleek web interface. This beast enables you to transmit various types of radio signals including FM radio broadcasts, Morse code, carrier waves, and even spectrum painting.

License

Notifications You must be signed in to change notification settings

psyb0t/piraterf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

17 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ΄β€β˜ οΈ PIrateRF - Software-Defined Radio Transmission Platform

PIrateRF is a fucking badass software-defined radio (SDR) transmission platform that turns your Raspberry Pi Zero W into a portable RF signal generator with a sleek web interface. This beast enables you to transmit various types of radio signals including FM radio broadcasts, Morse code, carrier waves, and even spectrum painting - all controlled through your browser like a proper pirate! πŸ“‘βš‘

πŸ“‹ Table of Contents

🎯 What the Fuck Does This Thing Do?

PIrateRF transforms your Pi Zero into a standalone RF transmission station that can:

  • 🎡 FM Radio Broadcasting: Transmit audio with full RDS (Radio Data System) metadata including station names, radio text, and PI codes
  • πŸ“» Morse Code Transmission: Send CW (continuous wave) Morse code signals
  • πŸŽ›οΈ Carrier Wave Generation: Simple tone generation for testing and tuning
  • 🎨 Spectrum Painting: Transmit images as RF spectrum patterns (because why the fuck not?)
  • 🎧 Audio Processing: Upload files or record via microphone through the browser
  • πŸ“± Web-based Control: Full-featured HTML5 interface with live WebSocket updates

All of this runs on a Pi Zero W configured as a WiFi access point, making it a completely standalone, portable RF transmission platform that you can take anywhere and control from any device with a browser.

πŸ—οΈ Architecture & Technology Stack

Core Components

  • Backend: Go 1.24.6 with ARM cross-compilation for Pi Zero efficiency
  • RF Engine: gorpitx - Go wrapper for the legendary rpitx C library
  • Web Framework: Custom HTTP server with WebSocket support via aichteeteapee
  • Frontend: Modern HTML5/CSS3/JavaScript with real-time communication
  • Audio Processing: Sox and FFmpeg for professional audio conversion and manipulation
  • Service Framework: Custom servicepack framework for project structure and deployment

Service Architecture

PIrateRF is a single Go service with modular components:

  • RF Transmission Engine: Core logic for generating FM, Morse, and spectrum signals
  • Execution Manager: Handles RF transmission execution with atomic state control preventing concurrent transmissions
  • WebSocket Hub: Real-time bidirectional communication with the frontend interface
  • HTTP Server: Serves the web interface and handles secure file uploads
  • Audio/Image Processing: Automatic format conversion and optimization pipelines

πŸš€ Quick Fucking Setup

Prerequisites

  • Raspberry Pi Zero W
  • SD Card (8GB+ recommended)
  • Docker for development
  • Basic knowledge of RF regulations in your area (don't be a fucking idiot)

🚨 IMPORTANT: Pi Zero Setup First!

Before you do ANYTHING else, you need to get your fucking Pi Zero W connected and accessible via SSH. Follow this tutorial that actually fucking works:

πŸ‘‰ Pi Zero W USB Connection Tutorial

This will get your Pi Zero connected via USB with SSH access so you can actually deploy PIrateRF to the bastard. Don't skip this step or you'll be fucked trying to connect to your Pi later!

Credentials setup: During the Pi Zero setup tutorial, I used username fucker, hostname piraterf.local, password FUCKER. Use these same credentials if you don't want to get confused with the rest of this tutorial - otherwise go ahead and set up some lame ass shit with your own credentials.

🌐 INTERNET SHARING REQUIRED: After USB connection is working, you MUST share internet from your computer to the Pi Zero. The setup scripts need to download packages and dependencies. Your Pi Zero connects via USB but has no internet unless you share it from your host computer.

Set up internet sharing on Ubuntu/Linux (complete fucking setup):

  1. Set connection to shared: In Ubuntu Network Settings, find the USB connection (usually shows as usb0 or similar), click on it, go to IPv4 settings, and change the method from "Link-Local Only" to "Shared to other computers". This is fucking critical!

  2. Stop Docker services (they fuck with networking):

sudo systemctl stop docker.socket
sudo systemctl stop docker
  1. Restart NetworkManager:
sudo systemctl restart NetworkManager
  1. Configure iptables rules (replace usb0 and enp5s0 with your actual interfaces):
sudo iptables -A INPUT -i lo -j ACCEPT
sudo iptables -A OUTPUT -o lo -j ACCEPT
sudo iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
sudo iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
sudo iptables -A FORWARD -i usb0 -o enp5s0 -j ACCEPT
sudo iptables -A FORWARD -i enp5s0 -o usb0 -j ACCEPT
sudo iptables -t nat -A POSTROUTING -s 10.42.0.0/24 -o enp5s0 -j MASQUERADE
sudo iptables -P INPUT ACCEPT
sudo iptables -P FORWARD ACCEPT
sudo iptables -P OUTPUT ACCEPT
  1. Test it: SSH into your Pi and run ping 8.8.8.8 - if it works, you're fucking golden!

Find your interfaces: Use ip link show to see usb0 (Pi connection) and your main internet interface (usually eth0, wlan0, enp0s3, etc.). Without this internet sharing setup, the dependency installation will fail because the Pi can't reach package repositories!

πŸ”Œ ANTENNA SETUP

Connect your fucking antenna to the Pi Zero:

GPIO Connection: Connect your antenna cable to GPIO 4 (Physical Pin 7) on the Pi Zero W. This is your RF output pin.

Antenna Options:

  1. Short wire (~10-20cm): Best for indoor testing and learning. Keeps power low and legal.
  2. 75cm wire: Longer range but too much signal leaks outside your property - use this ONLY indoors
  3. Proper antenna with low pass filter: Build or buy a proper antenna system with SMA connector and appropriate low pass filter for your frequency

⚠️ IMPORTANT: The 75cm antenna is a fucking liability outdoors - your signal will travel way beyond your property and you'll be violating regulations. Stick to short wires for testing or build proper filtered antenna systems for serious use.

⚠️ USE A FUCKING LOW PASS FILTER! The Pi GPIO outputs square waves which generate harmonics across the entire spectrum. Without proper filtering, you'll spray RF energy all over the fucking place and violate spurious emission regulations. Always use an appropriate low pass filter for your transmission frequency!

1. Initial Pi Setup and Configuration

Flash Raspberry Pi OS Lite to your SD card and enable SSH. Then:

# Clone this badass project
git clone https://github.com/psyb0t/piraterf.git
cd piraterf

Edit scripts/pi_config.sh and modify these values to match your Pi:

export PI_USER="fucker"              # Pi username
export PI_HOST="piraterf.local"      # Pi hostname/IP
export PI_PASS="FUCKER"             # Pi password

2. Complete Automated Setup

Run the full setup pipeline that configures everything automatically:

make complete

This fucking command will:

  1. Install dependencies (rpitx, sox, ffmpeg, etc.)
  2. Configure WiFi Access Point (SSID: "πŸ΄β€β˜ οΈπŸ“‘", Password: "FUCKER!!!")
  3. Setup system branding (MOTD, terminal aliases, pirate theme)
  4. Build and deploy the PIrateRF application
  5. Install systemd service for auto-start
  6. Reboot the Pi into pirate mode

3. Connect and Use

After reboot:

  1. Connect to WiFi: "πŸ΄β€β˜ οΈπŸ“‘" with password "FUCKER!!!"
  2. Open browser: Navigate to https://piraterf.local (or whatever hostname you configured)
  3. Start transmitting: Upload audio, configure RDS, and broadcast like a proper pirate!

⚠️ IMPORTANT: Use the HTTPS hostname for full functionality. The fucking microphone recording feature requires HTTPS with a proper hostname to work due to browser security restrictions.

πŸŽ‰ Pirate Crew Mode: Connect multiple devices to the same WiFi network and all access the web interface simultaneously! While only one transmission can run at a time (because GPIO doesn't fucking share), all connected devices see real-time transmission status, output logs, and can take turns controlling the RF transmissions. Perfect for fucking around with friends in a radio wave gangbang! πŸ“‘πŸ’₯

πŸ› οΈ Development Workflow

Local Development

# Run locally in development mode
make run-dev

# Format and lint code
make lint-fix

# Run tests with coverage
make test-coverage

# Build for production
make build

Pi Development Cycle

# Cross-compile for Pi
make build

# Deploy to Pi
make deploy

# Install service
make install

# SSH into Pi for debugging
make ssh

# View logs
make ssh
# Then: sudo journalctl -fu piraterf

Individual Pi Setup Commands

If you want to run setup steps individually:

make pi-setup-deps      # Install rpitx and dependencies
make pi-setup-ap        # Configure Pi as WiFi access point
make pi-setup-branding  # System branding setup
make deploy             # Copy files to Pi
make install            # Install as systemd service
make pi-reboot          # Reboot Pi
make uninstall          # Remove PIrateRF from Pi

πŸ“‘ RF Transmission Modes

FM Radio Broadcasting (PIFMRDS)

  • Audio Support: MP3, WAV, FLAC, and more (auto-converted to 48kHz/16-bit/mono)
  • RDS Metadata: Station name, radio text, and PI codes
  • Playlist Mode: Create playlists with intro/outro support
  • Play Once Mode: Single play with automatic timeout calculation
  • Microphone Recording: Record audio directly through the browser interface

Morse Code (CW)

  • Text to Morse: Automatic conversion with configurable WPM (words per minute)
  • CW Transmission: Continuous wave RF transmission

Tune Mode

  • Carrier Wave: Simple tone generation for testing and frequency verification

Spectrum Painting

  • Image Upload: Convert images to RF spectrum patterns
  • Format Support: JPEG, PNG, GIF with automatic YUV conversion
  • Visual RF: Turn your images into radio art (because pirates love art too)

🌐 Network Configuration

The make pi-setup-ap command configures the Pi as a standalone WiFi access point. Access point settings (SSID, password, IP ranges, etc.) are configured in scripts/make/pi_setup_ap.sh.

πŸ“ Project Structure

piraterf/
β”œβ”€β”€ cmd/                    # Main application entry points
β”œβ”€β”€ internal/pkg/services/
β”‚   └── piraterf/          # Core PIrateRF service implementation
β”‚       β”œβ”€β”€ piraterf.go    # Main service logic
β”‚       β”œβ”€β”€ http_server.go # Web server and API
β”‚       β”œβ”€β”€ websocket*.go  # Real-time communication
β”‚       β”œβ”€β”€ audio_*.go     # Audio processing pipeline
β”‚       β”œβ”€β”€ image_*.go     # Image processing for spectrum paint
β”‚       └── execution_*.go # RF transmission management
β”œβ”€β”€ scripts/
β”‚   └── make/              # Build and deployment scripts
β”‚       β”œβ”€β”€ build.sh       # Cross-compilation for Pi
β”‚       β”œβ”€β”€ pi_setup_*.sh  # Pi configuration scripts
β”‚       β”œβ”€β”€ deploy.sh      # Deployment automation
β”‚       └── servicepack/   # Framework scripts
β”œβ”€β”€ html/                  # Web interface templates
β”œβ”€β”€ static/                # CSS, JavaScript, images
β”œβ”€β”€ files/                 # Audio and image file storage
β”œβ”€β”€ uploads/               # Temporary upload staging
β”œβ”€β”€ Makefile              # Main build configuration
└── Makefile.servicepack  # Framework integration

🧰 Make Targets Reference

Development

  • make run-dev - Run locally with development setup
  • make build - Cross-compile for ARM/Pi Zero
  • make lint-fix - Format code and fix linting issues
  • make test-coverage - Run tests with coverage analysis

Pi Management

  • make pi-setup-deps - Install rpitx and system dependencies
  • make pi-setup-ap - Configure WiFi access point
  • make pi-setup-branding - Setup system branding and accounts
  • make deploy - Copy built files to Pi
  • make install - Install and start systemd service
  • make complete - Run full setup pipeline
  • make ssh - SSH into the Pi
  • make pi-reboot - Reboot the Pi
  • make uninstall - Remove PIrateRF from Pi

Utilities

  • make tls - Generate TLS certificates
  • make clean - Clean build artifacts
  • make help - Show all available targets

πŸ”§ Configuration

Pi Connection Settings

The Pi connection settings are defined in scripts/pi_config.sh (configured in setup step 1).

Service Configuration

The PIrateRF service uses environment variables for configuration. See scripts/piraterf.sh for all available configuration options and their default values.

🎡 Audio Processing Pipeline

PIrateRF automatically processes uploaded audio through a sophisticated pipeline:

  1. Format Detection: Supports MP3, WAV, FLAC, OGG, and more
  2. Conversion: Automatically converts to 48kHz, 16-bit, mono WAV using Sox
  3. Validation: Ensures audio meets RF transmission requirements
  4. Storage: Organizes files in /files/audio/uploads/ and /files/audio/sfx/
  5. Playlist Support: Create playlists with intro/outro and repeat modes

πŸ–ΌοΈ Image Processing for Spectrum Painting

Images are processed for RF spectrum transmission:

  1. Format Support: JPEG, PNG, GIF automatically detected
  2. Conversion: Converted to YUV format for RF transmission
  3. Optimization: Resized and optimized for spectrum display
  4. Storage: Organized in /files/images/uploads/

πŸ΄β€β˜ οΈ Legal and Safety Notice

IMPORTANT: This software enables RF transmission. You are responsible for complying with your local RF regulations and licensing requirements.

  • Ensure you have proper licenses for your transmission frequency and power levels
  • Some frequencies require amateur radio licenses
  • Respect power limitations and spurious emission requirements
  • Don't interfere with emergency services or licensed operators
  • When in doubt, consult your local RF regulatory authority

⚠️ USE A FUCKING LOW PASS FILTER! The Pi GPIO outputs square waves which generate harmonics across the entire spectrum. Without proper filtering, you'll spray RF energy all over the fucking place and violate spurious emission regulations. Always use an appropriate low pass filter for your transmission frequency!

PIrateRF is designed for educational, experimental, and licensed amateur radio use. The developers are not responsible for any misuse or regulatory violations.

🀝 Contributing

Want to make this pirate ship even more badass?

  1. Fork the repository
  2. Create a feature branch
  3. Make your fucking awesome changes
  4. Test on actual Pi hardware
  5. Submit a pull request with a clear description

Development Guidelines

  • Follow the existing code style (use make lint-fix)
  • Write tests for new features
  • Update documentation for any new functionality
  • Test on real Pi Zero W hardware before submitting

πŸ“ License

This project is licensed under WTFPL (Do What The Fuck You Want To Public License).

πŸ”— Dependencies

  • rpitx - The legendary RF transmission library that makes this all possible
  • servicepack - The framework that keeps this project organized and deployable
  • aichteeteapee - The HTTP server framework powering the web interface
  • gorpitx - Go wrapper for rpitx that makes RF transmission elegant

Built with spite using https://github.com/psyb0t/servicepack


Now get out there and start broadcasting like the RF pirate you were meant to be! πŸ΄β€β˜ οΈπŸ“‘

About

PIrateRF is a fucking badass software-defined radio (SDR) transmission platform that turns your Raspberry Pi Zero W into a portable RF signal generator with a sleek web interface. This beast enables you to transmit various types of radio signals including FM radio broadcasts, Morse code, carrier waves, and even spectrum painting.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published