A web-based application for encoding and transmitting POCSAG pager messages through VHF amateur radio repeaters.
- Web Interface: User-friendly web interface for message encoding
- POCSAG Encoding: Full implementation of POCSAG protocol with BCH error correction
- FSK Modulation: Generates audio signals for radio transmission
- CTCSS Support: Adds CTCSS tones for repeater access
- Audio Output: Direct transmission through sound card to radio or WAV file generation
- Testing Tools: Built-in encoder/decoder testing
- Install system dependencies:
sudo apt update
sudo apt install python3 python3-pip
# Optional: for audio transmission
sudo apt install python3-pyaudio- Install Python dependencies:
pip install -r requirements.txtStart the web server:
python app.pyOpen your browser to http://localhost:5000 and use the web form to:
- Enter pager RIC and message
- Configure transmission parameters
- Generate WAV files for download
- Transmit audio directly (requires PyAudio)
- Test encoding/decoding
The original command-line interface is still available:
python main.py -a 123456 -m "Hello World"See below for full command-line options.
-a, --address: Pager RIC (default: 123456)-m, --message: Message to send (required)-b, --baud: Baud rate (512, 1200, 2400; default: 1200)-s, --sample-rate: Audio sample rate (default: 48000)-d, --deviation: FSK deviation in Hz (default: 4500)-c, --ctcss: CTCSS tone frequency-o, --output-device: Audio output device index--list-devices: List available audio devices--test: Test encoding without transmission--save-wav: Save audio to WAV file
-
Radio Configuration:
- Set radio to VHF band (144-148 MHz for 2m)
- Enable external audio input/modulation
- Set modulation to wide/narrow FM as appropriate
- Ensure proper power and antenna setup
-
Audio Connection:
- Connect computer audio output to radio's mic/data input
- Adjust audio levels to prevent overmodulation
- Use shielded cables to reduce interference
-
Repeater Access:
- Tune to repeater input frequency
- Use appropriate CTCSS tone if required
- Monitor repeater output for confirmation
# Generate test audio
python main.py -a 123456 -m "Test" --save-wav test.wav
# Decode with multimon-ng (if installed)
sox test.wav -t raw -esigned-integer -b16 -r 48000 - | \
multimon-ng -t raw -a POCSAG1200 -- Start with low power
- Transmit test message
- Listen on repeater output frequency
- Verify message reception on pager
- Amateur Radio License: Ensure you have appropriate license for transmission
- Frequency Compliance: Only transmit on authorized frequencies
- Power Limits: Respect power restrictions for your license class
- Repeater Courtesy: Follow repeater usage guidelines
- Emergency Channels: Never interfere with emergency communications
pocsag.py: Core POCSAG encoder, decoder, and modulator classesapp.py: Web interface using Flaskmain.py: Legacy command-line interface and audio transmissionrequirements.txt: Python dependenciestemplates/: HTML templates for the web interface
- Baud Rates: 512, 1200, 2400 bps
- Modulation: 2-FSK with ±4.5 kHz deviation
- Error Correction: BCH (31,21,5) code
- Message Format: 7-bit ASCII with ETX termination
- Check audio device selection with
--list-devices - Verify audio levels and connections
- Test with
--save-wavto confirm signal generation
- Adjust radio modulation settings
- Check antenna and power setup
- Verify frequency and CTCSS settings
- Try different baud rates
- Ensure correct baud rate matching
- Check for interference on frequency
- Verify pager RIC programming
The application is modular and extensible:
- Add new modulation schemes
- Implement additional error correction
- Add network interfaces for remote paging
- Integrate with SDR hardware
- POCSAG specification (ITU-R M.584)
- GNU Radio documentation
- Amateur radio repeater directories
POCSAG (Post Office Code Standardization Advisory Group) is a protocol for one-way paging systems. Key characteristics:
- Uses 2-FSK modulation (Frequency Shift Keying)
- Common baud rates: 512, 1200, 2400 bps
- Messages are encoded in batches of 16 codewords
- Each codeword is 32 bits (21 data + 10 CRC + 1 parity)
- Supports both numeric and alphanumeric messages
- Uses preamble for synchronization
- VHF Amateur Radio Transceiver: Capable of transmitting on 144-148 MHz (2m band) or 430-440 MHz (70cm band)
- Must have audio input for modulation (mic input or data port)
- Examples: Baofeng UV-5R, Yaesu FT-60R, Kenwood TH-D74A
- Computer: Linux-based system (Ubuntu 20.04+ recommended)
- Sound card or audio interface for modulation input
- Antenna: Appropriate for chosen frequency band
- Power Supply: For radio transceiver
- Software Defined Radio (SDR): HackRF One, LimeSDR, or similar TX-capable SDR
- RF Amplifier: Low-power amplifier for extended range (if needed)
- GPS Disciplined Oscillator: For frequency accuracy (optional)
- pocsag (PyPI): POCSAG message encoding library
- Handles protocol encoding, CRC calculation, and message formatting
- Install:
pip install pocsag
- numpy: Numerical computations for signal processing
- scipy: Signal processing for FSK modulation generation
- pyaudio: Audio output for radio modulation
- pyserial: Radio control via serial/CAT interface (optional)
- gnuradio (GNU Radio): For SDR-based transmission
- Provides FSK modulation blocks and SDR control
- librpitx: For Raspberry Pi-based transmission (alternative)
- SoX: Audio processing utilities
- rtl-sdr: For testing reception (optional)
- gqrx: SDR receiver for monitoring transmissions
- multimon-ng: POCSAG decoder for testing
- Message Encoder: Convert text to POCSAG protocol format
- Modulation Generator: Create FSK audio signal from bitstream
- Audio Output: Send modulation to radio's audio input
- Radio Control: PTT (Push-To-Talk) and frequency management
- Repeater Interface: Handle CTCSS tones and repeater access
Text Message → POCSAG Encoder → Bit Stream → FSK Modulator → Audio Signal → Radio → Repeater → Pager
-
Install Dependencies
sudo apt update sudo apt install python3 python3-pip python3-numpy python3-scipy python3-pyaudio sudo apt install gnuradio gnuradio-dev sudo apt install sox rtl-sdr gqrx multimon-ng pip install pocsag
-
Verify Hardware
- Connect radio to computer audio output
- Test audio levels and PTT control
- Verify radio frequency and modulation settings
-
Basic Message Encoding
import pocsag # Create encoder encoder = pocsag.Encoder() # Encode message for address 123456 with function bits 3 message = "HELLO WORLD" encoded_data = encoder.encode(123456, message, function_bits=3) # encoded_data contains the POCSAG bitstream
-
Advanced Encoding Features
- Support for numeric messages
- Multiple repeat transmissions
- Custom baud rates (512/1200/2400)
-
Generate FSK Audio
import numpy as np from scipy import signal def generate_fsk(bits, baud_rate=1200, deviation=4500, sample_rate=48000): # Convert bits to symbols (-1, 1) symbols = 2 * np.array(list(bits)) - 1 # Generate FSK signal t = np.arange(len(symbols) * sample_rate // baud_rate) / sample_rate phase = 2 * np.pi * deviation * np.cumsum(symbols) / baud_rate audio = np.sin(phase[:len(t)]) return audio.astype(np.float32)
-
Add CTCSS Tone (for repeaters)
def add_ctcss(audio, ctcss_freq=67.0, sample_rate=48000): t = np.arange(len(audio)) / sample_rate ctcss = 0.1 * np.sin(2 * np.pi * ctcss_freq * t) return audio + ctcss
-
Audio Output Setup
import pyaudio def transmit_audio(audio_data, sample_rate=48000): p = pyaudio.PyAudio() stream = p.open(format=pyaudio.paFloat32, channels=1, rate=sample_rate, output=True) # Key PTT (if available) # transmit_ptt(True) stream.write(audio_data.tobytes()) # Unkey PTT # transmit_ptt(False) stream.stop_stream() stream.close() p.terminate()
-
Radio Control Integration
- Serial/CAT interface for frequency control
- GPIO control for PTT on Raspberry Pi
- Audio level adjustment
-
CTCSS Tone Generation
- Standard CTCSS frequencies: 67.0, 71.9, 74.4, 77.0, 79.7, 82.5, 85.4, 88.5, 91.5, 94.8, 97.4, 100.0, 103.5, 107.2, 110.9, 114.8, 118.8, 123.0, 127.3, 131.8, 136.5, 141.3, 146.2, 151.4, 156.7, 162.2, 167.9, 173.8, 179.9, 186.2, 192.8, 203.5, 210.7, 218.1, 225.7, 233.6, 241.8, 250.3
-
Repeater Access Sequence
- Generate CTCSS tone
- Wait for repeater hang time
- Transmit POCSAG signal
- Allow repeater timeout
-
GNU Radio Flowgraph
- File Source → Throttle → FSK Mod → Osmocom Sink
- Configure for appropriate frequency and deviation
-
Python GNU Radio Integration
from gnuradio import gr, analog, blocks import osmosdr class PocsagTransmitter(gr.top_block): def __init__(self, frequency, audio_file): # Setup flowgraph for POCSAG transmission pass
-
Local Testing
- Use rtl-sdr to receive and decode transmissions
- Verify message integrity with multimon-ng
-
Repeater Testing
- Start with low power
- Monitor repeater frequency for proper operation
- Test with known pager addresses
-
Performance Metrics
- Transmission success rate
- Message decode accuracy
- Repeater access reliability
radio:
frequency: 146.520e6 # Repeater input frequency
ctcss: 67.0 # CTCSS tone frequency
baud_rate: 1200
deviation: 4500
audio_device: "hw:0,0"
pocsag:
default_address: 123456
function_bits: 3
repeat_count: 3
preamble_length: 576
system:
sample_rate: 48000
ptt_delay: 0.5
repeater_hang_time: 2.0-
Amateur Radio Licensing
- Ensure proper amateur radio license for transmission
- Operate within authorized frequency bands
- Respect repeater access rules
-
Transmission Etiquette
- Test transmissions at low power first
- Avoid interfering with ongoing communications
- Use appropriate timing between transmissions
-
Power and Interference
- Start with minimum necessary power
- Monitor for interference
- Use proper antenna systems
- Web Interface: REST API for remote paging
- Database Integration: Store messages and delivery status
- Multi-Channel Support: Support multiple repeaters/frequencies
- Encryption: Secure message transmission
- GPS Integration: Location-based paging
- Network Protocols: Integration with existing paging networks
- No Audio Output: Check audio device configuration
- Radio Not Transmitting: Verify PTT control and audio levels
- Messages Not Received: Check frequency, CTCSS, and modulation
- Repeater Not Responding: Verify access tones and timing
- Oscilloscope for audio signal verification
- SDR receiver for RF signal analysis
- POCSAG decoder for message validation
- ITU-R Recommendation M.584-2: POCSAG specification
- GNU Radio documentation
- rpitx project (https://github.com/F5OEO/rpitx)
- POCSAG encoder library (https://pypi.org/project/pocsag/)
This plan provides a comprehensive foundation for implementing a POCSAG paging system. The modular design allows for incremental development and testing at each phase.