Actions

Difference between revisions of "RTL SDR multiple FM channels"

From The RadioReference Wiki

Line 1: Line 1:
This page describes how to use a single RTL-SDR dongle on a Raspberry Pi to simultaneously monitor multiple FM radio channels at the same time.  The demodulated audio from each radio channel can be sent to a speaker or headphones for listening, or can be sent to downstream applications such as TwoToneDetect.
+
This page describes how to use a single RTL-SDR dongle on a Raspberry Pi to simultaneously monitor multiple FM radio channels at the same time.  The demodulated audio from each radio channel can be sent to a speaker or headphones for listening, or can be sent to downstream applications such as TwoToneDetect. Because this method uses PulseAudio to route audio between programs, it can be used on a Raspberry Pi or other Linux systems running PulseAudio, but does not apply to Windows (on Windows, programs like Virtual Audio Cable can be used instead of PulseAudio).
 +
 
 +
                        |--->frequency 1 demodulated audio --->pulse audio sink--->pulse audio monitor source-->TwoToneDetect Instance 1
 +
RTL-SDR -> rtl-airband |--->frequency 2 demodulated audio --->pulse audio sink--->pulse audio monitor source-->TwoToneDetect Instance 2
 +
                        |--->frequency 3 demodulated audio --->pulse audio sink--->pulse audio monitor source-->TwoToneDetect Instance 3
 +
 
 +
                        |--->frequency 1 demodulated audio --->pulse audio sink--->pulse audio monitor source-->\
 +
RTL-SDR -> rtl-airband |--->frequency 2 demodulated audio --->pulse audio sink--->pulse audio monitor source--> |--->pulse audio default sink (via loopback)
 +
                        |--->frequency 3 demodulated audio --->pulse audio sink--->pulse audio monitor source-->/
  
 
== Background ==
 
== Background ==
RTL-SDR dongles are capable of monitoring a ~2.2 MHz while chunk of radio spectrum in the VHF and UHF bands.  The rtl-airband software can be used to create multiple FM "tuners" at different frequencies within this 2.2 MHz wide swath of spectrum.  Unlike a traditional scanner that switches between multiple frequencies but can only listen to one at a time, an RTL-SDR is capable of simultaneously demodulating multiple frequencies at the same time as long as they are all within the RTL-SDR's ~2.2 MHz bandwidth.   
+
RTL-SDR dongles are capable of monitoring a ~2.2 MHz wide chunk of radio spectrum in the VHF and UHF bands.  The rtl-airband software can be used to create multiple FM "tuners" at different frequencies within this 2.2 MHz wide swath of spectrum.  Unlike a traditional scanner that switches between multiple frequencies but can only listen to one at a time, an RTL-SDR is capable of simultaneously demodulating multiple frequencies at the same time as long as they are all within the RTL-SDR's ~2.2 MHz bandwidth.   
  
 
====Example====
 
====Example====
Line 12: Line 20:
 
   sudo apt-get install pavucontrol
 
   sudo apt-get install pavucontrol
  
====Terminology====
+
====PulseAudio Terminology====
 
In PulseAudio, a '''source''' is a source of audio such as a sound card line input or microphone.  A '''sink''' is a place to send audio such as a sound card headphone output.   
 
In PulseAudio, a '''source''' is a source of audio such as a sound card line input or microphone.  A '''sink''' is a place to send audio such as a sound card headphone output.   
  
Line 20: Line 28:
  
 
==Setup Instructions==
 
==Setup Instructions==
These instructions summarize how to set up an RTL-SDR to stream multiple FM radio channels to multiple instances of TwoToneDetect.  However, this method is not limited to TwoToneDetect, but can be used with any downstream software capable of using PulseAudio (pulse) as the input audio source.   
+
These instructions summarize how to set up an RTL-SDR to stream multiple FM radio channels to multiple instances of TwoToneDetect.  However, this method is not limited to TwoToneDetect, but can be used with any downstream software capable of using PulseAudio (pulse) as the input audio source.  These instructions assume that PulseAudio, rtl-airband, and TwoToneDetect are already installed on the Raspberry Pi.
  
# Use [https://github.com/szpajder/RTLSDR-Airband rtl-airband] to receive one or more FM frequencies from an RTL-dongle
+
# Use [https://github.com/szpajder/RTLSDR-Airband rtl-airband] to receive one or more FM frequencies from an RTL-dongle.  If sending audio to TwoToneDetect, be sure to use [https://github.com/szpajder/RTLSDR-Airband/wiki/Configuring-channels-for-multichannel-mode multichannel mode], not scan mode.
# Use pacmd to create a null sink in pulse audio for each instance of TwoToneDetect:
+
# Use pacmd to create a null sink in pulse audio for each frequency being monitored:
 
   pacmd load-module module-null-sink sink_name=myfreq1sink
 
   pacmd load-module module-null-sink sink_name=myfreq1sink
 
   pacmd load-module module-null-sink sink_name=myfreq2sink
 
   pacmd load-module module-null-sink sink_name=myfreq2sink
Line 30: Line 38:
 
   pacmd update-sink-proplist myfreq2sink device.description=myfreq2sink
 
   pacmd update-sink-proplist myfreq2sink device.description=myfreq2sink
 
# Use pacmd to update the descriptions of the corresponding (automatically created) pulse audio monitor sources:
 
# Use pacmd to update the descriptions of the corresponding (automatically created) pulse audio monitor sources:
   pacmd update-source-proplist myfreq1sink.monitor device.description=myfreq1sink
+
   pacmd update-source-proplist myfreq1sink.monitor device.description=myfreq1monitor
   pacmd update-source-proplist myfreq2sink.monitor device.description=myfreq2sink
+
   pacmd update-source-proplist myfreq2sink.monitor device.description=myfreq2monitor
 
# For each instance of TwoToneDetect, set the pulse audio source to use when starting from the command line (use the .monitor corresponding to the sink previously created):
 
# For each instance of TwoToneDetect, set the pulse audio source to use when starting from the command line (use the .monitor corresponding to the sink previously created):
 
   PULSE_SOURCE=myfreq1sink.monitor /home/pi/TTD1/TwoToneDetect73g
 
   PULSE_SOURCE=myfreq1sink.monitor /home/pi/TTD1/TwoToneDetect73g
   PULSE_SOURCE+myfreq2sink.monitor /home/pi/TTD2/TwoToneDetect73g
+
   PULSE_SOURCE=myfreq2sink.monitor /home/pi/TTD2/TwoToneDetect73g
 +
# For any frequency that you want to listen to via the Pi's speaker output (in addition to or instead of sending the audio to TwoToneDetect), use pacmd to create a loopback from the null sink monitor to the speakers:
 +
  pacmd load-module module-loopback source=myfreq2sink.monitor sink=default (or whatever sink you want to send it to)
 
# In the rtl-airband configuration for the corresponding frequency, [https://github.com/szpajder/RTLSDR-Airband send the audio to pulse audio] with the sink name created above:
 
# In the rtl-airband configuration for the corresponding frequency, [https://github.com/szpajder/RTLSDR-Airband send the audio to pulse audio] with the sink name created above:
outputs: (
+
outputs: (
 
   {
 
   {
 
     type = "pulse";
 
     type = "pulse";
Line 45: Line 55:
 
     sink = "myfreq2sink";
 
     sink = "myfreq2sink";
 
   }
 
   }
);
+
);

Revision as of 21:17, 29 March 2021

This page describes how to use a single RTL-SDR dongle on a Raspberry Pi to simultaneously monitor multiple FM radio channels at the same time. The demodulated audio from each radio channel can be sent to a speaker or headphones for listening, or can be sent to downstream applications such as TwoToneDetect. Because this method uses PulseAudio to route audio between programs, it can be used on a Raspberry Pi or other Linux systems running PulseAudio, but does not apply to Windows (on Windows, programs like Virtual Audio Cable can be used instead of PulseAudio).

                       |--->frequency 1 demodulated audio --->pulse audio sink--->pulse audio monitor source-->TwoToneDetect Instance 1
RTL-SDR -> rtl-airband |--->frequency 2 demodulated audio --->pulse audio sink--->pulse audio monitor source-->TwoToneDetect Instance 2
                       |--->frequency 3 demodulated audio --->pulse audio sink--->pulse audio monitor source-->TwoToneDetect Instance 3
                       |--->frequency 1 demodulated audio --->pulse audio sink--->pulse audio monitor source-->\
RTL-SDR -> rtl-airband |--->frequency 2 demodulated audio --->pulse audio sink--->pulse audio monitor source--> |--->pulse audio default sink (via loopback)
                       |--->frequency 3 demodulated audio --->pulse audio sink--->pulse audio monitor source-->/

Background

RTL-SDR dongles are capable of monitoring a ~2.2 MHz wide chunk of radio spectrum in the VHF and UHF bands. The rtl-airband software can be used to create multiple FM "tuners" at different frequencies within this 2.2 MHz wide swath of spectrum. Unlike a traditional scanner that switches between multiple frequencies but can only listen to one at a time, an RTL-SDR is capable of simultaneously demodulating multiple frequencies at the same time as long as they are all within the RTL-SDR's ~2.2 MHz bandwidth.

Example

An RTL-SDR whose center frequency is tuned to 156.000 MHz could simultaneously demodulate and "listen" to FM two-way radio transmissions on 155.430 MHz and 156.800 MHz.

PulseAudio

PulseAudio is a sound server used on the Raspberry Pi. The latest Raspberry Pi OS includes PulseAudio by default. If not already installed, it can be installed with:

 sudo apt-get install pulseaudio

It's also helpful to install the pavucontrol GUI for PulseAudio:

 sudo apt-get install pavucontrol

PulseAudio Terminology

In PulseAudio, a source is a source of audio such as a sound card line input or microphone. A sink is a place to send audio such as a sound card headphone output.

Whenever PulseAudio creates a sink, it also automatically creates a corresponding 'monitor' source that can be used to listen to the sink.

In the instructions below, we'll set up two PulseAudio sinks to send demodulated audio from two different FM frequencies to using rtl-airband. We'll then configure two different instances of TwoToneDetect (or any other program) to use the 'monitor' sources of those newly created sinks as audio input sources.

Setup Instructions

These instructions summarize how to set up an RTL-SDR to stream multiple FM radio channels to multiple instances of TwoToneDetect. However, this method is not limited to TwoToneDetect, but can be used with any downstream software capable of using PulseAudio (pulse) as the input audio source. These instructions assume that PulseAudio, rtl-airband, and TwoToneDetect are already installed on the Raspberry Pi.

  1. Use rtl-airband to receive one or more FM frequencies from an RTL-dongle. If sending audio to TwoToneDetect, be sure to use multichannel mode, not scan mode.
  2. Use pacmd to create a null sink in pulse audio for each frequency being monitored:
 pacmd load-module module-null-sink sink_name=myfreq1sink
 pacmd load-module module-null-sink sink_name=myfreq2sink
  1. Use pacmd to update the descriptions of the null sinks so that they show up as something helpful in pavucontrol for debugging:
 pacmd update-sink-proplist myfreq1sink device.description=myfreq1sink
 pacmd update-sink-proplist myfreq2sink device.description=myfreq2sink
  1. Use pacmd to update the descriptions of the corresponding (automatically created) pulse audio monitor sources:
 pacmd update-source-proplist myfreq1sink.monitor device.description=myfreq1monitor
 pacmd update-source-proplist myfreq2sink.monitor device.description=myfreq2monitor
  1. For each instance of TwoToneDetect, set the pulse audio source to use when starting from the command line (use the .monitor corresponding to the sink previously created):
 PULSE_SOURCE=myfreq1sink.monitor /home/pi/TTD1/TwoToneDetect73g
 PULSE_SOURCE=myfreq2sink.monitor /home/pi/TTD2/TwoToneDetect73g
  1. For any frequency that you want to listen to via the Pi's speaker output (in addition to or instead of sending the audio to TwoToneDetect), use pacmd to create a loopback from the null sink monitor to the speakers:
 pacmd load-module module-loopback source=myfreq2sink.monitor sink=default (or whatever sink you want to send it to)
  1. In the rtl-airband configuration for the corresponding frequency, send the audio to pulse audio with the sink name created above:
outputs: (
 {
   type = "pulse";
   sink = "myfreq1sink";
 },
 {
   type = "pulse";
   sink = "myfreq2sink";
 }
);