start_tx.sh¶
Lives on: the Hackerman Pi, at ~/Desktop/hackrf project/start_tx.sh
(see Hackerman for how to reach that Pi).
What it does¶
Takes signal.iq (written by generate_signal.py) and feeds it to
the HackRF hardware for transmission, using the hackrf_transfer command-line tool.
#!/bin/bash
hackrf_transfer -t signal.iq -f 915000000 -s 2000000 -x 40 -a 1 -R
Walkthrough¶
hackrf_transfer is the standard command-line tool for driving HackRF hardware (from the
hackrf-tools package). Each flag:
| Flag | Value | Meaning |
|---|---|---|
-t signal.iq |
— | Transmit mode: read samples from signal.iq and send them. |
-f 915000000 |
915 MHz | Center frequency. This matches the frequency called out in the KPP memo for the RFD900x target signal. |
-s 2000000 |
2 MHz | Sample rate. This has to match sample_rate in generate_signal.py — if they don't match, the tone lands at the wrong offset frequency or plays back at the wrong speed. |
-x 40 |
40 dB | TX VGA gain — how much the HackRF amplifies the outgoing signal before transmission. |
-a 1 |
on | Enables the HackRF's onboard RF amplifier. |
-R |
— | Repeat mode — loops the file continuously instead of transmitting it once. |
That last flag, -R, is why Hackerman's notes
say the HackRF keeps transmitting until you press Ctrl+C — the script never stops on its
own, it just loops signal.iq forever.
Creating/editing this file¶
The script was created with a heredoc:
cat > start_tx.sh << 'EOF'
#!/bin/bash
hackrf_transfer -t signal.iq -f 915000000 -s 2000000 -x 40 -a 1 -R
EOF
chmod +x start_tx.sh
cat > start_tx.sh << 'EOF' ... EOF writes everything between the two EOF markers
straight into start_tx.sh. chmod +x then makes it executable, which is what lets you
run it as ./start_tx.sh instead of bash start_tx.sh.