RTL-SDR : AFSK modem between two linux box

We are going to use a Raspberry Pi as a transmitter and a RTL-SDR setup to decode the signal. We will use AFSK with minimodem for encoding the data.

TL;DR: Here is a video showing ascii transmission over the air @ 9600bps and 1200bps

Important notice: always ‘turn off’ the pifm transmitter after usage:

pi$ touch /tmp/empty && sudo ./pifm /tmp/empty

In a nutshell :

Here is a pseudo blockdiagram:pifm_afsk

  • minimodem will do the encoding in a flac or in a wav format
  • we send the audio file with Pifm.
  • On the reciever we send the audio to minimodem for decoding

Find a Raspberry Pi and set up a Pifm transmitter as described on the Imperial College Robotics Society Wiki page

Install minimodem with alsa support on your RTL-SDR (receiver) and minimodem 0.8.1 with wav file support on your Raspberry Pi (transmitter).

Here are the principales commandes :

sudo apt-get update
sudo apt-get install minimodem
pi$ minimodem --tx -f test.wav 1200
pi$ sudo ./pifm test.wav
receiver$ multimode.py  ; # use the recording check box for saving the audio to test.wav
receiver$ minimodem --rx -f test.wav 1200

Putting it all together on the transmitter (raspeberry pi)

We will send the value hello afsk world with the current date, here are the setting for sending the 48k wav file from minimodem as a 1200bps 8b AFSK signal  on 80 MHz:

pi$ echo -e "hello afsk world : `date +%c`" | minimodem --tx -f -8 1200 -f send.wav && sudo ./pifm send.wav 80.0 48000

For sending the data every 4sec :

pi$ while true ; do echo -e "hello afsk world : `date +%c`" | minimodem --tx -f -8 1200 -f send.wav &&  sudo ./pifm send.wav 80.0 48000 ; sleep 4;done

Put it all together on the receiver

Fire up you best FM receiver software (you can use sdr#, gqrx , multimode , etc … see RTL-SDR Receiving) and tune to the frequencies previously set on the Raspberry Pi i.e. 80 MHz) :

AFSK Signal

All eyes all ears , you can monitor the signal on the receiver.

Now , we have to decode the audio

We can save the audio file .. or we can make a clever use of pulseaudio  : just set the default capture device to the monitor of your output device from the fm reciever , i.e. : minimodem is capturing the sound that is played trough a specific sound card

Start minimodem with the alsa [1] flag ‘-A’ and the same setting used on the transmitter

receiver$ minimodem -A -8 1200

Start pavucontrol to connect the audio of minimodem and watch the AFSK being decoded by minimodem.

You can also use rtl_fm (no gui for a lower cpu overhead) to decode the fm sample to the default alsa device.

receiver$ rtl_fm -f 80.0e6 -W -s 200000 -r 48000 -o 6 | aplay -r 48k -f S16_LE

AFSK Signal rtl_fm

You can also do the same RTTY transmission with AFSK and arduino and use the sound channel of your fpv rig.

No gnuradio block was involved in this whole process.

1 : you can use the ‘default’ alsa hook with pulseaudio, no need to set a specific hdw , see https://wiki.debian.org/en/PulseAudio#Installing_PulseAudio. You may want to increase the default value when using pulesaudio and gnuradio , ex :

#cat ~/.gnuradio/config.conf
 period_time = 0.020 # in seconds
 nperiods = 30 # total buffering = period_time * nperiods
 verbose = true
Posted in Blog Tagged with: , ,
6 comments on “RTL-SDR : AFSK modem between two linux box
  1. ad says:

    French Video … that’s stupid

  2. Dirk says:

    I imagine you’re annoyed with the French “audio” rather than the French “video”.
    As I imagine you probably meant to say “that’s unfortunate since I don’t understand French” rather than “that’s stupid”.
    But then again, I often imagine people are courteous and well-educated; my mistake :-)

    Great video and thanks for the detailed write-up
    -and I understood the French perfectly-

  3. Tom says:

    Amazing work – well done. I am sucessfully talking to myself through thin air!
    Anyone got any idea about using modes other than WFM?



  4. Zak Zebrowski says:

    Awesome, thank you for the information! I will be playing with this soon.

  5. Imran says:

    wow..does this work for text also?

1 Pings/Trackbacks for "RTL-SDR : AFSK modem between two linux box"
  1. […] had yet combined this cheap radio dongle with the ability to transmit radio from a Raspberry Pi. [Marc] combined these two builds and came up with the cheapest portable radio modem for the Raspberry […]

Leave a Reply

Your email address will not be published. Required fields are marked *