Skip to main content

Overview

This guide provides complete, practical examples of transferring various types of data using minimodem. Whether you’re sending text over a radio link, transferring files via telephone, or creating an acoustic coupler, these workflows demonstrate real-world data transfer scenarios.

Text Transfer

Simple Text Message

The most basic use case - sending and receiving text messages:
# Send a simple message
echo "Hello World" | minimodem --tx 1200

# Send multi-line text
cat message.txt | minimodem --tx 1200

# Interactive typing
minimodem --tx 1200
# Type your message and press Ctrl+D when done

Reliable Text Transfer

Add error detection and correction:
1

Prepare message with checksum

# Create message with MD5 checksum
MESSAGE="Important data here"
CHECKSUM=$(echo -n "$MESSAGE" | md5sum | cut -d' ' -f1)
echo "${MESSAGE}|${CHECKSUM}"
2

Transmit with verification

# Send message with checksum
echo "${MESSAGE}|${CHECKSUM}" | minimodem --tx 1200
3

Receive and verify

# Receive message
RECEIVED=$(minimodem --rx 1200 --quiet 2>/dev/null)

# Split message and checksum
DATA=$(echo "$RECEIVED" | cut -d'|' -f1)
RECV_CHECKSUM=$(echo "$RECEIVED" | cut -d'|' -f2)

# Verify
CALC_CHECKSUM=$(echo -n "$DATA" | md5sum | cut -d' ' -f1)
if [ "$RECV_CHECKSUM" = "$CALC_CHECKSUM" ]; then
    echo "Verified: $DATA"
else
    echo "ERROR: Checksum mismatch"
fi

File Transfer

Binary File Transfer

Transfer any file using Base64 encoding:
# Encode and transmit
base64 document.pdf | minimodem --tx 1200

# With progress indication (requires pv)
cat document.pdf | base64 | pv | minimodem --tx 1200

# Save transmission to audio file
base64 document.pdf | minimodem --tx 1200 -f transfer.wav

Compressed File Transfer

Reduce transfer time with compression:
# Transmit compressed
gzip -c largefile.txt | base64 | minimodem --tx 1200

# Receive and decompress
minimodem --rx 1200 --quiet 2>/dev/null | base64 -d | gunzip > largefile.txt

# Calculate transfer time
FILE_SIZE=$(wc -c < largefile.txt)
BAUD_RATE=1200
TRANSFER_TIME=$((FILE_SIZE * 10 / BAUD_RATE))  # 10 bits per byte
echo "Estimated transfer time: ${TRANSFER_TIME} seconds"

Chunked Transfer

Transfer large files in chunks with verification:
#!/bin/bash
# chunked-transfer.sh - Transfer file in verified chunks

FILE="$1"
CHUNK_SIZE=1024  # bytes
BAUD=1200

# Split file
split -b $CHUNK_SIZE "$FILE" chunk_

# Transmit each chunk
for chunk in chunk_*; do
    echo "Sending $chunk..."
    (
        echo "CHUNK:$(basename $chunk)"
        cat "$chunk" | base64
        echo "MD5:$(md5sum $chunk | cut -d' ' -f1)"
        echo "END"
    ) | minimodem --tx $BAUD
    
    # Wait for acknowledgment (implement as needed)
    sleep 1
done

echo "Transfer complete"
rm chunk_*
Receiver script:
#!/bin/bash
# receive-chunks.sh - Receive and verify chunks

BAUD=1200
OUTPUT="received_file"

while true; do
    # Receive chunk
    DATA=$(minimodem --rx $BAUD --rx-one --quiet 2>/dev/null)
    
    # Extract chunk info
    CHUNK_NAME=$(echo "$DATA" | grep "^CHUNK:" | cut -d: -f2)
    CHUNK_DATA=$(echo "$DATA" | sed -n '/^CHUNK:/,/^MD5:/p' | grep -v "^CHUNK:" | grep -v "^MD5:")
    CHUNK_MD5=$(echo "$DATA" | grep "^MD5:" | cut -d: -f2)
    
    # Decode and verify
    echo "$CHUNK_DATA" | base64 -d > "$CHUNK_NAME"
    CALC_MD5=$(md5sum "$CHUNK_NAME" | cut -d' ' -f1)
    
    if [ "$CHUNK_MD5" = "$CALC_MD5" ]; then
        echo "$CHUNK_NAME verified OK"
        cat "$CHUNK_NAME" >> "$OUTPUT"
        rm "$CHUNK_NAME"
    else
        echo "$CHUNK_NAME FAILED verification"
        # Request retransmit
    fi
    
    # Check for end
    echo "$DATA" | grep -q "^END$" && break
done

echo "File received: $OUTPUT"

Two-Way Communication

Half-Duplex Communication

Simple back-and-forth communication:
# Send message
echo "This is Station A, over" | minimodem --tx 300

# Wait for reply
echo "Listening..."
minimodem --rx 300 --rx-one

Full-Duplex Simulation

Simulate full-duplex using different frequencies:
# Terminal 1: Transmit on 1200 Hz, receive on 2200 Hz
(
    minimodem --rx 300 --mark 2270 --space 2070 &
    minimodem --tx 300 --mark 1270 --space 1070
)

# Terminal 2: Transmit on 2200 Hz, receive on 1200 Hz  
(
    minimodem --rx 300 --mark 1270 --space 1070 &
    minimodem --tx 300 --mark 2270 --space 2070
)

Radio Communication

HF Radio Transfer

Optimized for shortwave radio conditions:
# Transmit at 300 baud (more reliable for HF)
echo "CQ CQ CQ DE W1ABC" | minimodem --tx 300

# Receive with auto-carrier (handles frequency drift)
minimodem --rx 300 --auto-carrier --confidence 1.0

# RTTY mode for amateur radio
echo "DE W1ABC" | minimodem --tx rtty
minimodem --rx rtty --auto-carrier

VHF/UHF Radio Transfer

Higher speed for VHF/UHF FM:
# Transmit at 1200 baud (APRS/Packet radio speeds)
echo "Data packet" | minimodem --tx 1200

# With continuous carrier (important for FM radio)
cat data.txt | minimodem --tx 1200 --tx-carrier

# Receive with tight bandwidth
minimodem --rx 1200 --bandwidth 200

Weather Radio Reception

Decode NOAA SAME alerts:
# Receive SAME headers
minimodem --rx same --auto-carrier > alerts.txt

# From recorded audio
minimodem --rx same -f weather-recording.wav > decoded-alerts.txt

# Parse SAME message
# Format: ZCZC-ORG-EEE-PSSCCC+TTTT-JJJHHMM-LLLLLLLL-

Telephone/Modem Transfer

Classic Modem Emulation

Emulate a classic dial-up modem:
# Bell 103 (300 baud) - Original modem standard
echo "Data" | minimodem --tx 300
minimodem --rx 300

# Bell 202 (1200 baud) - Faster modem standard
echo "Data" | minimodem --tx 1200  
minimodem --rx 1200

# V.21 (300 baud) - International standard
echo "Data" | minimodem --tx 300 --mark 980 --space 1180
minimodem --rx 300 --mark 980 --space 1180

Caller ID Decoding

Decode telephone caller ID:
# Record caller ID from phone line
minimodem --rx callerid -f phone-recording.wav

# Real-time caller ID (if you have phone line connected)
minimodem --rx callerid

Acoustic Coupling

Speaker-to-Microphone Transfer

Transfer data acoustically between devices:
1

Position devices

Place speaker of transmitting device near microphone of receiving device
2

Calibrate volume

# Transmitter: Test tone
echo "TEST" | minimodem --tx 300 --volume 0.7

# Receiver: Monitor levels
minimodem --rx 300
# Adjust transmit volume until carrier is detected reliably
3

Transfer data

# Transmitter
cat data.txt | minimodem --tx 300 --volume 0.7

# Receiver
minimodem --rx 300 > received.txt
Acoustic Coupling Tips:
  • Use 300 baud for better reliability
  • Minimize background noise
  • Use medium volume (0.5-0.7) to avoid distortion
  • Keep devices stable and close together

Air-Gapped Transfer

Transfer data between isolated systems:
# Isolated system (transmit)
cat secret-data.txt | base64 | minimodem --tx 300 -f transfer.wav

# Physically move audio file (USB stick, etc.)

# Connected system (receive)
minimodem --rx 300 -f transfer.wav --quiet 2>/dev/null | base64 -d > secret-data.txt

Specialized Protocols

RTTY for Amateur Radio

# Transmit RTTY (45.45 baud, 1.5 stop bits)
echo "CQ CQ CQ DE W1ABC W1ABC K" | minimodem --tx rtty

# Receive RTTY with custom shift
minimodem --rx rtty --mark 2125 --space 2295

# TDD mode (45.45 baud, 2.0 stop bits)
echo "GA" | minimodem --tx tdd
minimodem --rx tdd

UIC Train Communication

Decode European train-to-ground communication:
# Train-to-ground decoder
minimodem --rx uic-train -f train-recording.wav

# Ground-to-train decoder  
minimodem --rx uic-ground -f ground-recording.wav

Custom Protocols

Create custom framing:
# Custom start/stop bits
echo "DATA" | minimodem --tx 1200 \
    --startbits 2 \
    --stopbits 2.0

minimodem --rx 1200 \
    --startbits 2 \
    --stopbits 2.0

# Custom frequencies
echo "DATA" | minimodem --tx 1200 \
    --mark 1000 \
    --space 2000

minimodem --rx 1200 \
    --mark 1000 \
    --space 2000

# Raw binary (no framing)
echo "DATA" | minimodem --tx 1200 \
    --startbits 0 \
    --stopbits 0 \
    --binary-raw 8

Performance Optimization

Speed vs Reliability

# 300 baud, narrow bandwidth, high threshold
echo "Critical data" | minimodem --tx 300
minimodem --rx 300 --bandwidth 50 --confidence 2.0

# Use for:
# - Noisy environments
# - Long-distance HF radio
# - Acoustic coupling
# - Low signal strength

Transfer Time Estimation

#!/bin/bash
# estimate-transfer-time.sh

FILE="$1"
BAUD="${2:-1200}"

# Calculate file size
FILE_SIZE=$(wc -c < "$FILE")

# Account for Base64 encoding (33% overhead)
ENCODED_SIZE=$((FILE_SIZE * 4 / 3))

# Account for framing (10 bits per 8 data bits)
TOTAL_BITS=$((ENCODED_SIZE * 10))

# Calculate transfer time
TRANSFER_SECONDS=$((TOTAL_BITS / BAUD))
MINUTES=$((TRANSFER_SECONDS / 60))
SECONDS=$((TRANSFER_SECONDS % 60))

echo "File: $FILE"
echo "Size: $FILE_SIZE bytes"
echo "Encoded size: $ENCODED_SIZE bytes"
echo "Baud rate: $BAUD"
echo "Estimated transfer time: ${MINUTES}m ${SECONDS}s"
Usage:
./estimate-transfer-time.sh document.pdf 1200
# File: document.pdf
# Size: 102400 bytes
# Encoded size: 136533 bytes
# Baud rate: 1200
# Estimated transfer time: 18m 58s

Error Handling

Retry on Failure

#!/bin/bash
# retry-transfer.sh - Retry transmission until successful

FILE="$1"
MAX_RETRIES=3
BAUD=1200

# Calculate checksum
CHECKSUM=$(md5sum "$FILE" | cut -d' ' -f1)

for ((i=1; i<=MAX_RETRIES; i++)); do
    echo "Attempt $i of $MAX_RETRIES..."
    
    # Transmit file with checksum
    (
        base64 "$FILE"
        echo "CHECKSUM:$CHECKSUM"
    ) | minimodem --tx $BAUD
    
    # Wait for acknowledgment
    echo "Waiting for acknowledgment..."
    ACK=$(timeout 30 minimodem --rx $BAUD --rx-one --quiet 2>/dev/null)
    
    if echo "$ACK" | grep -q "^OK:$CHECKSUM$"; then
        echo "Transfer successful!"
        exit 0
    else
        echo "Transfer failed, retrying..."
        sleep 2
    fi
done

echo "Transfer failed after $MAX_RETRIES attempts"
exit 1

Automatic Error Correction

# Use forward error correction (FEC) with par2
par2create -r10 file.bin

# Transmit file and parity
cat file.bin | base64 | minimodem --tx 1200
cat file.bin.par2 | base64 | minimodem --tx 1200

# Receive and repair
minimodem --rx 1200 --quiet 2>/dev/null | base64 -d > received.bin
minimodem --rx 1200 --quiet 2>/dev/null | base64 -d > received.bin.par2
par2repair received.bin

Monitoring and Debugging

Transfer Monitoring

# Monitor transfer with statistics
minimodem --rx 1200 | tee received.txt

# Log status messages
minimodem --rx 1200 > received.txt 2> transfer.log

# Parse logs for statistics
grep "NOCARRIER" transfer.log | awk '{print $4, $5, $6}'

Audio Debugging

# Record transmitted audio for analysis
echo "TEST" | minimodem --tx 1200 -f test.wav

# Analyze with spectral view
ffmpeg -i test.wav -lavfi showspectrumpic=s=1024x512 spectrum.png

# Or use sonic-visualizer, audacity, etc.
audacity test.wav

See Also

Build docs developers (and LLMs) love