Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A Scan feature? #103

Open
pclov3r opened this issue Nov 3, 2017 · 10 comments
Open

A Scan feature? #103

pclov3r opened this issue Nov 3, 2017 · 10 comments

Comments

@pclov3r
Copy link

pclov3r commented Nov 3, 2017

Curious what people think of a scan feature that would scan the FMBC band for stations that have HD service.

Basically it would scan the FMBC band and output which frequencies that it found HD service for.

Unsure how much work it would be the implement but it could be useful for new users.

@ghost
Copy link

ghost commented Nov 3, 2017

https://hdradio.com/stations

It's reasonably accurate. They claim I should be able to get a 6 kW (analog ERP) station 23 miles away, which is ... debatable. I can't even see the station in GQRX. But other than the subchannel info being outdated on a very few entries, it seems fine.

@pclov3r
Copy link
Author

pclov3r commented Nov 3, 2017

@ClassicFM that list is extremely inaccurate for my area at least.

@ghost
Copy link

ghost commented Nov 4, 2017

Sometimes it returns a list for somewhere completely different, probably due to a buggy reverse proxy. Refresh a couple times if that happens. You can also give it location access, no idea if that helps in larger metros. It looks to me like it's based on FCC and/or Arbitron 'media market' rather than any reception parameters.

It wouldn't be so bad if nrsc5 ran through 88-108 MHz and printed some basic metadata once it got a lock. Much as the HDHomeRun does for digital TV: when it locks it prints out the info gleaned from the ATSC TVCT table, like "program 3: 9.2 MeTV"

ATSC A/65 and ISO MPEG-TS are rather strict about how often things like TVCT and the PAT structure must appear, to aid in exactly this kind of application. I gather NRSC-5 is not that way, though in practice the delay might not be so intolerable.

@awesie
Copy link
Contributor

awesie commented Feb 12, 2019

I've experimented with this a bit in the past. The challenge is making the process fast. In general a full scan seems to take around 4 minutes in my area.

For each possible frequency we need to iterate over the different gain values and determine if the frequency likely has a station. This part needs to be as fast as possible. Once a frequency is identified as potentially having a station, we can dedicate 15 seconds or so to brute force the best gain setting and then wait for the decoder to find a valid PIDS frame.

To make the first half fast, I've experimented with using a goertzel filter to try to detect the analog FM stereo pilot. My assumption is that every HD radio station (in the real world) will have a stereo pilot signal, and that trying to detect this pilot is faster and more reliable than detecting the HD radio signal. I then paired this with the same basic algorithm we use for finding the ideal gain setting, except I skip over gain values so we only test every 10 dB of gain or so.

Honestly, in the end, I'm not sure the stereo pilot detection was useful. The digital side bands are fairly easy to detect. I also experimented with trying to use the rtlsdr's built-in AGC, but it's performance was miserable, likely due to my location downtown with lots of stations and inside of an apartment.

tl;dr how long should the scan take and how accurate does it need to be?

@pclov3r
Copy link
Author

pclov3r commented Feb 12, 2019

My assumption is that every HD radio station (in the real world) will have a stereo pilot signal

In my area there is a NPR affiliated station with HD and not running stereo for their analog signal. This might be an edge case tho.

@awesie
Copy link
Contributor

awesie commented Feb 12, 2019

I am moderately surprised. Does it have RBDS?

@pclov3r
Copy link
Author

pclov3r commented Feb 12, 2019

@awesie I know and yes it does.

@ab1jx
Copy link

ab1jx commented May 2, 2019

4 minutes seems fine, it's not something I'd do often. Scanning for ATSC TV channels is probably about that long, haven't done it in over a year. Is there a possibility to make searches of different "depths" like zenmap does when it port scans? Some number on the command line. I tried the link above, even with entering a zip code it shows 6 stations which don't include one I'd already found. Something like https://www.tvfool.com/?option=com_wrapper&Itemid=29 would be better. Oh, try http://www.fmfool.com/ I think it uses something like splat so it takes terrain into account, but it doesn't show only HD. They could add that since it comes out of a database. You could use rtl_power to scan the FM band then try each for digital content.

You could maybe also use rtl_power to sample about 10 frequencies per channel then look for the blocks that are the digital information. You'd need to have a replacement for heatmap.py that analyzes the data and outputs center frequencies of the found ones. I just tried the strongest 10 stations here by fmfool and only one has usable HD.
HDRadio
Those blocks can't be that hard to spot.

@ab1jx
Copy link

ab1jx commented May 6, 2019

Yes, I think that will work at least in areas with a low density of HDFM stations. I'm working on a program to make it more civilized, but here I ran rtl_power to get 1 data point every 5 kHz.
waqy_102 1

Here the only station I've found so far with nrsc5 is at 102.1. You can see a bunch of stuff within a short spectral distance of that frequency. I don't see many such stations, but I made this plot 8000 pixels wide to see them better.
nrs2

The actual scan took about 11 seconds.

I seem to have another station at 90.3, even though that's not divisible by 0.2. 90.2 doesn't work, or 90.4, but I'm listening to 90.3. Tcxo oscillator in this dongle so I don't think it's far off. Yes, it's WAMC. https://www.wamc.org/

@ab1jx
Copy link

ab1jx commented May 6, 2019

OK, I put my program on Sourceforge https://sourceforge.net/projects/fmplot/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants