rpitx is an amazing piece of software by F5OEO that allows you to experiment with transmitting RF using only a Raspberry Pi. rpitx includes many different modes, such as:
This document will help you set up a Raspberry Pi for rpitx, convert a sound file to M17 baseband, and then transmit it from the Raspberry Pi.
You will need the following:
That’s pretty much it!
First, log into your Raspberry Pi via SSH. We will be doing all this work via SSH, due to a few users stating that the HDMI output has a tendency to disappear when transmitting. I have not experienced this myself, due to only working on a headless RPi, but all of the programs are run from the command line anyway, so there’s no need for a full Raspberry Pi OS desktop install.
Next, we need to install some tools. We’ll start with codec2.
Get a few tools for getting source code and compiling
sudo apt install git build-essential cmake
Install sox - will need this later for generating baseband audio
sudo apt install sox
Create a working folder for source code
mkdir git && cd git
git clone https://github.com/drowe67/codec2.git
cd codec2
mkdir build_linux && cd build_linux
cmake ..
make
sudo make install
cd ../..
sudo ldconfig
sudo apt install libboost-program-options1.67-dev libgtest-dev
git clone https://github.com/mobilinkd/m17-cxx-demod.git
cd m17-cxx-demod
mkdir build && cd build
cmake ..
make
make test
sudo make install
cd ../..
This install will take a while, it pulls in many dependencies and self-installs. Get yourself a cup of coffee while you wait.
git clone https://github.com/F5OEO/rpitx
cd rpitx
./install.sh
When finished compiling, you will see this prompt:
In order to run properly, rpitx need to modify /boot/config.txt. Are you sure (y/n)
Be sure to accept (press Y and Enter) in order for the proper boot options to be set. Then, finally reboot the Raspberry Pi
sudo reboot
Jumper wires with female Dupont connectors Cut a wire to a length that’s appropriate for the frequency you wish to transmit on. rpitx reportedly can transmit on frequencies from 5 KHz up to 1500 MHz. For example, I used a spare jumper wire with female Dupont connectors on it. As I hold a license for ham radio, I cut the wire for the 70cm band, about 150cm-160cm long. If you do not have a ham radio license, cut the wire for an acceptable ISM band for your location.
While the Raspberry Pi may not have a lot of transmitting power using rpitx, I strongly suggest staying off any licensed land mobile or broadcast frequencies. Better safe then sorry.
Now that we have all the tools and programs installed, it’s time to generate a file that contains M17 baseband audio. We will use m17-mod for this.
From the m17-cxx-demod GitHub README:
m17-cxx-mod — This program reads in an 8k sample per second, 16-bit, 1 channel raw audio stream from STDIN and writes out an M17 4-FSK baseband stream at 48k SPS, 16-bit, 1 channel to STDOUT.
Using this information, you can either create your own audio file or use an existing audio file that fits the requirements. I use Audacity to create files for my use. You could also download a speech sample file from the Open Speech Repository.
Let’s create a working directory to use for playing with M17 stuff.
cd
mkdir m17 && cd m17
Place your audio file in the working directory. We will now use m17-mod in order to generate the M17 baseband audio.
sox <filename> -t raw - | m17-mod -S <callsign> > m17baseband.wav
Replace
The command as entered does the following:
The process of generating the baseband audio may take a few seconds to a minute or two, depending on the length of the original audio file.
Great, you should now have a new file with the generated baseband audio. Now, it’s time to send that through rpitx. Run the following command:
cat m17baseband.wav | csdr convert_i16_f | csdr gain_ff 4200 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f <frequency>
Change
FURTHER EXPLANATION OF COMMANDS NEEDED HERE
This command will take the baseband audio that you generated, do some DSP magic on it, and then transmit it all through GPIO 4 (Pin 7) on the Raspberry Pi.
Congratulations, you’ve transmitted M17 using only a Raspberry Pi!
Use an RTL-SDR dongle or similar SDR receiver to listen to the baseband audio, or pipe the received baseband into m17-demod to diagnose, test, and listen to your transmission!