Any other RTL-SDR rtl_fm feeds?

Status
Not open for further replies.

radef

Member
Joined
Feb 8, 2008
Messages
40
Hello,
I've started a feed using an RTL-SDR receiver on a Raspberry Pi 2. The feed receives using the rtl_fm application (piped to lame piped to ezstream). I'm having some issues that I'm wondering if other folks have run into...

Any signal that I pick up (I'm scanning 3 frequencies) sounds like there's an interfering carrier underneath at a lower level. I've even tried with a strong NWS signal - and you can make out a "beating" signal in the background. Has anyone else run into this?

I've run a spectrum analyzer routine (osmocom_fft) and I don't see anything on the spectrum display. I suspect that there's a configuration option for rtl_fm that I'm missing.

Just curious if others are having good quality audio from rtl_fm on their feeds?

Thanks!
 

blantonl

Founder and CEO
Staff member
Super Moderator
Joined
Dec 9, 2000
Messages
11,095
Location
San Antonio, Whitefish, New Orleans
The problem is almost certainly your ppm adjustment setting - the beating signal you are hearing means you are slightly off frequency - you need to make sure you've got this set to the ppm adjustment for your dongle (the -p option). In my experience, dongles with the 820T tuner usually have a ppm between 58-70 and dongles with the 820T2 tuner are around 25-35. I would set your ppm in the middle of those ranges depending on which tuner you have to start.


Sent from my iPad using Tapatalk
 

radef

Member
Joined
Feb 8, 2008
Messages
40
The problem is almost certainly your ppm adjustment setting - the beating signal you are hearing means you are slightly off frequency - you need to make sure you've got this set to the ppm adjustment for your dongle (the -p option). In my experience, dongles with the 820T tuner usually have a ppm between 58-70 and dongles with the 820T2 tuner are around 25-35. I would set your ppm in the middle of those ranges depending on which tuner you have to start.


Sent from my iPad using Tapatalk

Hi Lindsay,

Thanks for getting back to me on this.

I do have the -p option set. I have done calibration with both the kal program (which uses GSM basestations to determine the frequency offset) and the rtl_test -p option as well.

I do notice if I have a bad value of -p, things sound much worse. So I thought I was experiencing something other than offset.

I'm guessing you have had success with rtl_fm decoding things clearly? I notice a modified version for AM is being used for feeds (I haven't tried any AM settings...).

A bit more about my set up:
My Pi has two RTL-SDR sticks (one with 820T and the other with 820T2). One is receiving ADS-B traffic for FlightAware, the other for my RR feed. I've even tried swapping from one RX to the other, and they both show this same "beating" effect.

Here's another question/observation. If I use rtl_fm to tune to a quiet frequency and set squelch to 0, I don't hear traditional static. It's like I'm picking up that interferer that's beating with the good channels. Should I hear static like I do on a standalone FM receiver?

This whole thing sort of sounds like I'm picking up the DC component of the RX (especially since it's on every frequency I tune to), but according to the docs, rtl_fm tunes off frequency and adjusts in demod to remove the DC component.

I've got another setup I'm going to experiment with. I have a sig gen that I'll use to better characterize what's going on vs the over the air (and eliminate that variable).
 

blantonl

Founder and CEO
Staff member
Super Moderator
Joined
Dec 9, 2000
Messages
11,095
Location
San Antonio, Whitefish, New Orleans
Couple other things to try:

1) Try a higher bandwidth filter for FM. maybe around 16 KHz instead of 12 KHz

Code:
/usr/local/bin/rtl_fm -d 0 -M fm -f 461.4M -p 69 -l 65 -g 50 -t 2 -E pad -s 16k |
/usr/bin/lame -r -s 16 --resample 22.05 -m m -b 16 --cbr --lowpass 4 - - |
/usr/bin/ezstream -c /etc/ezstream_bcfy.xml > /var/log/bcfy2.log 2>&1 &

2) Try plugging both sticks into a powered hub to see if there are possible voltage drops to the sticks?

3) What happens if you just run one stick at a time?

4) Try enabled the "no-dc: disable dc blocking filter" and the "deemp: enable de-emphasis filter"
Code:
 -E no-dc -E deemp

5) Try turning down the gain
Code:
-g 25
 

radef

Member
Joined
Feb 8, 2008
Messages
40
Couple other things to try:

1) Try a higher bandwidth filter for FM. maybe around 16 KHz instead of 12 KHz

Code:
/usr/local/bin/rtl_fm -d 0 -M fm -f 461.4M -p 69 -l 65 -g 50 -t 2 -E pad -s 16k |
/usr/bin/lame -r -s 16 --resample 22.05 -m m -b 16 --cbr --lowpass 4 - - |
/usr/bin/ezstream -c /etc/ezstream_bcfy.xml > /var/log/bcfy2.log 2>&1 &

Only a slight change here. Maybe more fidelity in the signal, but no change in the "beating" signal.

As a side note, I've added
Code:
--highpass 0.25
to the lame command to remove the PL remnants.

2) Try plugging both sticks into a powered hub to see if there are possible voltage drops to the sticks?
The set up is at a remote location, so it will be some time before I can try this. Good thought, though.

3) What happens if you just run one stick at a time?
I did try one stick at a time previously and did not see an improvement. Even with one stick, I had the beating signal present.

4) Try enabled the "no-dc: disable dc blocking filter" and the "deemp: enable de-emphasis filter"
Code:
 -E no-dc -E deemp
No noticeable change with this.

5) Try turning down the gain
Code:
-g 25
I was at 40 initially... I backed it down to 33 then to 25. As gain was decreased the desired signal starts to degrade (but the beating signal seems almost always at the same level).

As a side note, if I exceed 45 for gain, I start getting holes in the recovered audio.

I have another Pi and RTL-SDR sitting next to me that I'm going to build up and try here on the bench.

Is it safe to say that you think something is wrong with the audio in the sample.mp3 file I posted above?

Thanks for the support.
 

radef

Member
Joined
Feb 8, 2008
Messages
40
I've been scanning three frequencies since first setting up the feed. I just added two more. One of the two I added seems much less susceptible to the beating signal. All are 450-460 MHz. Maybe this isn't happening on all frequencies, I just got really unlucky with my first three choices... Still investigating.
 

DC31

Member
Feed Provider
Joined
Feb 19, 2011
Messages
1,545
Location
Massachusetts
Likewise, I have been experimenting with using RTL_SDR as the source for a feed. I have not yet hit upon the magic combination that gives a good quality feed. Lots of other noise. I am using a RPi2 with the R820T dongle. Using GQRX on the laptop I established that the ppm correction was 76. I have tried single digits up and down from there and have found about 72 to give me the best. I have tried changing antennas, changing power supplies, changing equipment location and nothing seems to affect the noise. The attached audio clip is about the best that I have gotten. Can anyone guide me toward a solution?

Here is the command I use to start it:

sudo /usr/local/bin/rtl_fm -d 0 -M fm -f 453.075M -p 72 -l 45 -g 50 -t 2 -E pad -s 16k | /usr/bin/lame -r -s 16 --resample 22.05 -m m -b 16 --cbr --lowpass 4 - - | /usr/bin/ezstream -c /etc/ezstream_bcfy.xml > /home/pi/bcfy2.log 2>&1 &

Here is a link to the audio:

https://drive.google.com/file/d/0B9sLdBjMInCVRTBkd0NicTNrR2M/view?usp=sharing


Thanks for the help.
 

blantonl

Founder and CEO
Staff member
Super Moderator
Joined
Dec 9, 2000
Messages
11,095
Location
San Antonio, Whitefish, New Orleans
Here is the command I use to start it:

sudo /usr/local/bin/rtl_fm -d 0 -M fm -f 453.075M -p 72 -l 45 -g 50 -t 2 -E pad -s 16k | /usr/bin/lame -r -s 16 --resample 22.05 -m m -b 16 --cbr --lowpass 4 - - | /usr/bin/ezstream -c /etc/ezstream_bcfy.xml > /home/pi/bcfy2.log 2>&1 &

Try turning your gain down to stay, 20, and then work up from there.

sudo /usr/local/bin/rtl_fm -d 0 -M fm -f 453.075M -p 72 -l 45 -g 20 -t 2 -E pad -s 16k | /usr/bin/lame -r -s 16 --resample 22.05 -m m -b 16 --cbr --lowpass 4 - - | /usr/bin/ezstream -c /etc/ezstream_bcfy.xml > /home/pi/bcfy2.log 2>&1 &
 
Last edited:

jazzbassNick

Member
Feed Provider
Joined
Jul 3, 2012
Messages
184
Location
San Gabriel CA
I tried this (the RPi + Dongle with lame and ezstream) a couple of months ago and the thing that was killing me was the squelch in rtl_fm just wasn't up to the task. I'm sure it's related to the fact that the system I feed has "busy tones", but I ended up having to go back to an old scanner and use the Pi just for feeding audio.
 

DC31

Member
Feed Provider
Joined
Feb 19, 2011
Messages
1,545
Location
Massachusetts
Try turning your gain down to stay, 20, and then work up from there.

sudo /usr/local/bin/rtl_fm -d 0 -M fm -f 453.075M -p 72 -l 45 -g 20 -t 2 -E pad -s 16k | /usr/bin/lame -r -s 16 --resample 22.05 -m m -b 16 --cbr --lowpass 4 - - | /usr/bin/ezstream -c /etc/ezstream_bcfy.xml > /home/pi/bcfy2.log 2>&1 &

Thank you for the help, Lindsay. I have tried lowering the gain to 20 and about all points between 20-50. Still, the best i can do is with it set at 50 and sounding like the recording that i posted. With it set lower, all that i hear is noise. Sometimes you might be able to detect a little audio but it is unintelligible.

Today, i downloaded your preconfigured image, with no change in results. I tried using Kalibrate-RTL in the new image to check the ppm. It runs but gives me no scan results? Command is kal -s GSM850.
 

radef

Member
Joined
Feb 8, 2008
Messages
40
Still struggling with my feed, too. Some frequencies are clear as a bell, and other just sound like trash. All in the 450-465 is range (both the good and bad).

I'd like to do some evaluations on the bench, but haven't gotten around to it yet. Anyone else hook one of these up to a signal generator and evaluate things like sensitivity and audio quality in the UHF band?
 

radef

Member
Joined
Feb 8, 2008
Messages
40
I've got a sig gen (HP 8647A) attached to the RTL SDR (NooElec R820T2 NESDR Mini 2). I'm listening to the audio live (no streaming). I'm injecting an FM modulated signal (1 kHz tone, 3 kHz deviation). Varying the amplitude.

Note that I'm using an identical setup (but different hardware) than what I'm streaming with.

I've run rtl_test -p and have determined a ppm offset of 93.

I'm testing on 454.025 MHz, one of the frequencies I'm having problems with.

Trying this string to start with:
rtl_fm -d 0 -p 93 -M fm -f 454.025M -s 12k | play -r 12k -t raw -e s -b 16 -c 1 -V1 -

With that command, there's no level squelch, and no gain adjustment.

I'm setting the amplitude, then injecting the signal (so it's an abrupt on/off signal, not a ramp up).

amplitude (dBm), audio observation
no signal, static
-100, not quite full quieting
-80, full quieting
-60, a little distortion to the 1kHz tone
-40, same as -60
-20, same as -60

Now trying:
rtl_fm -d 0 -p 93 -g 20 -M fm -f 454.025M -s 12k | play -r 12k -t raw -e s -b 16 -c 1 -V1 -
(that's with the gain fixed at 20)

amplitude (dBm), audio observation
no signal, no static - sounds like a weak on channel signal is present
-100, sounds like my carrier is mixing with the "signal" from above
-80, can hear the 1kHz tone, but sounds like its mixing with another carrier
-60, full quieting - little distortion in the 1 kHz tone
-40, same as -40
-20, more distortion on 1 kHz tone

The interesting thing with fixed gain (which is what I use on my radio reference feed) is the presence of a carrier of sorts when there's no RF applied to the input of the receiver. This causes very distorted and unintelligible audio at low to medium RF levels.


Now trying:
rtl_fm -d 0 -p 93 -g 40 -M fm -f 454.025M -s 12k | play -r 12k -t raw -e s -b 16 -c 1 -V1 -
(that's with the gain fixed at 40)

amplitude (dBm), audio observation
no signal, no static - sounds like a weak on channel signal is present
-100, sounds like my carrier is mixing with the "signal" from above
-80, full quieting - little distortion in the 1 kHz tone
-60, full quieting
-40, full quieting - little distortion in the 1 kHz tone
-20, more distortion on 1 kHz tone



Yeah, I realize it's tough to really make much out of my text descriptions here of the audio I'm hearing... But I do see that fixed gain settings on the rtl_fm command result in a "mixing" signal of sorts at low amplitudes which sounds like the "interference" I get on my feed.

More to follow...
 

radef

Member
Joined
Feb 8, 2008
Messages
40
Now doing some squelch testing...

rtl_fm -d 0 -p 93 -l 50 -M fm -f 454.025M -s 12k | play -r 12k -t raw -e s -b 16 -c 1 -V1 -
(results in static with no signal present - 'open squelch')

rtl_fm -d 0 -p 93 -l 55 -M fm -f 454.025M -s 12k | play -r 12k -t raw -e s -b 16 -c 1 -V1 -
(results in no static with no signal present - 'closed squelch')

Using the -l 55 setting, I'm injecting signals as before:

amplitude (dBm), observation
-100, can hear 1kHz tone - squelch opens
-80, can hear 1kHz tone but it's choppy like the squelch is open for a few seconds and closes for 1/2 second or so
-60, nothing - squelch does not open - hear a quick blip of 1kHz tone when the RF is turned off
-40, same as -60
-20, hearing the 1kHz tone every once in a while (sounds like morse code at about 10 wpm)

It would appear the squelch level is erratic and tied to something other than RF amplitude (which is what I expected based on the documentation). I saw some notes somewhere in the source that future plans would be to tie squelch to something similar to how radios do it (like a HPF on the audio and look at the spectral content above a few kHz, etc).
 
Last edited:

DC31

Member
Feed Provider
Joined
Feb 19, 2011
Messages
1,545
Location
Massachusetts
Kepp up the good work radef! We are all ears even if you don't see a response. Obviously you know much more about this than i do. My experimenting was all trial and error that led me nowhere.
 

radef

Member
Joined
Feb 8, 2008
Messages
40
I'm digging into the rtl_fm program. After messing around for a couple days, adding debug statements, etc, I see a couple things of interest.

The function that computes RMS power of the signal has an issue. It has discontinuities as I sweep the power from -100 dBm up. There are some power levels that result in RMS power reported as 0 (meaning no signal in that case). I'm still trying to reverse engineer something on that front... The function appears to square all the I & Q data together... To calculate RMS correctly, it needs to be handling I and Q data separately in the math. It's the "rms" function if anyone is interested (https://github.com/keenerd/rtl-sdr/blob/master/src/rtl_fm.c). I believe this is the root cause of the erratic squelch behavior.

I have some prototype stuff going that might help with a better RF level squelch. I believe I'm correctly computing the RMS power level now and see good correlation between known RF input and the RMS computed power.

Still have lots to learn and figure out...

And no firm leads yet on the "interference" with fixed gains called out. Although as I dig in, I'm getting a few ideas of places where to look.

As many issues as I'm seeing - I wonder who has gotten this to work successfully and with good audio? Is there a hardware issue with my R820T2 receivers (I have several showing the same problems). Does another flavor of RTL dongle have better results?
 
Last edited:

radef

Member
Joined
Feb 8, 2008
Messages
40
Soooo...after messing around for a while with the squelch, I've come up with something others might want to try. I've forked keenerd's code to make my own changes.

Assuming you have already gotten keenerd's code working...try downloading & compiling my version with the modified squelch.

I'd recommend starting by creating a new folder to store this build of code (folder name of radef used in the sample here).

Code:
cd ~
mkdir radef
cd radef

Now pull the source code & compile
Code:
git clone https://github.com/radef/rtl-sdr/
cd rtl-sdr/
mkdir build
cd build
cmake ../
make
sudo make install

The command line options are all the same. I've just modified how the squelch level is handled and how RMS power in the passband is calculated. It's a kludge right now - you'll need to use this lookup below to help you set the squelch level. It's a logrithmic scale.

The range for squelch (the -l parameter) is 0 to about 3500 on my dongle. 0 means there's no squelch. Lower numbers indicates a weaker squelch. The value of squelch changes with gain settings. The following assumes you are using a 12k sample rate. The numbers below are what my RTL dongle measured on the bench - yours may vary. I suspect these will be good starting point numbers for you.

If your gain is 10...
For a squelch level of -70 dBm, set the level parameter to a value of 41
For a squelch level of -60 dBm, set the level parameter to a value of 125
For a squelch level of -50 dBm, set the level parameter to a value of 323

If your gain is 20...
For a squelch level of -80 dBm, set the level parameter to a value of 32
For a squelch level of -70 dBm, set the level parameter to a value of 93
For a squelch level of -60 dBm, set the level parameter to a value of 292
For a squelch level of -50 dBm, set the level parameter to a value of 930

If your gain is 30...
For a squelch level of -90 dBm, set the level parameter to a value of 33
For a squelch level of -80 dBm, set the level parameter to a value of 97
For a squelch level of -70 dBm, set the level parameter to a value of 305
For a squelch level of -60 dBm, set the level parameter to a value of 965
For a squelch level of -50 dBm, set the level parameter to a value of 3045

If your gain is 40...
For a squelch level of -100 dBm, set the level parameter to a value of 33
For a squelch level of -90 dBm, set the level parameter to a value of 96
For a squelch level of -80 dBm, set the level parameter to a value of 305
For a squelch level of -70 dBm, set the level parameter to a value of 963
For a squelch level of -60 dBm, set the level parameter to a value of 3025

If your gain is 50...
For a squelch level of -100 dBm, set the level parameter to a value of 66
For a squelch level of -90 dBm, set the level parameter to a value of 201
For a squelch level of -80 dBm, set the level parameter to a value of 635
For a squelch level of -70 dBm, set the level parameter to a value of 1996

Yeah, I'll work out the algorithm later to make it easier to use. :) If I had a larger sample set of RTL dongles, I might be able to figure out a dBm scale that works across the board. For now, just know that increasing squelch level values requires a stronger signal to open the squelch.

More to follow...
 

radef

Member
Joined
Feb 8, 2008
Messages
40
Note these changes haven't fixed the "interference" sounding issue, but have resolved the erratic squelch behavior.

I'm working with a command line string like this now for my feed:
Code:
/usr/local/bin/rtl_fm -d 0 -f 454.0250M -l 30 -g 35 -p 50 -t 10 -E pad -s 12k |
/usr/bin/lame -r -s 12 --resample 22.05 -m m -b 16 --cbr --lowpass 4 --highpass .25 - - |
/usr/bin/ezstream -c /etc/ezstream_bcfy.xml

I'm still toying with gain adjustments to get the best sound from my receiver. I suspect too much gain causes the front end to be clobbered. Not enough gain causes the receiver to not be sensitve enough to pick up the desired signal.
 
Status
Not open for further replies.
Top