首页 > 其他分享 >使用树莓派3B、RTL-SDR、OpenWebRX搭建无线电监测站

使用树莓派3B、RTL-SDR、OpenWebRX搭建无线电监测站

时间:2023-01-24 20:55:07浏览次数:69  
标签:树莓 name SDR RTL start rate freq VHF

方案介绍:

OpenWebRX是一个国外开源项目,基于Python语言编写,配合SDR设备使用,能将SDR接收软件Web化,通过网络实现多用户远程访问,无需安装任何客户端软件,功能非常强大,支持:DMR、D-Star、NXDN、YSF、APRS、Pocsag、FT8等数字信号,后台自动解码,并存储解码内容上传APRS-IS、PSKreporter及WSPRNet,是一种理想的解决方案。

说通俗一些就是:1台电脑1个SDR,通过这个软件搭建一个频谱监测网站,只要能上网有浏览器的设备就能访问,随时随地查看频谱和守听,还支持多人同时使用,是不是很爽?你还在家用台子扫频吗?出门揣个便携SDR到处寻找制高点吗?来吧,利用手头的SDR,建立一个OpenWebRX基地监测站,享受业余无线电的乐趣。

这是一些老外们建设的OpenWebRX站点,可以先去体验一下。

https://www.receiverbook.de/?type=openwebrx

博主自己也搭建了一个OpenWebRX,覆盖:业余短波段、业余VU段。说到这里博主要提醒大家了:请勿触及敏感波段,特别是在互联网上!!

需要具备的条件:

  1. 技能:网络基础知识(IP地址)和Linux基本命令(别问我为什么,好玩的东西都是Linux……..需要学会:SSH连接、目录操作、vim编辑器)
  2. 服务器:64位ARM或X86的CPU,推荐使用树莓派(2B以上,Zero不行)、S905盒子(N1),X86 NUC,博主使用的是家中已有的树莓派。
  3. SDR:推荐使用RTL-SDR,要么就买老外的RTL-SDR Blog v3,要么就国产电视棒子,博主用的是前者,其优点在于频偏小,金属外壳屏蔽和散热好,25刀(160软妹币)的价格也相对60包邮的电视棒子高一些。淘宝上那些100+的RTL-SDR就别看了,都是智商税,国人连板子都懒得抄,直接换壳加忽悠;此外其它SDR(SDRPlay、AIRSPY。。。)效果会更好,价位也就更贵了,对服务器硬件要求更高。
  4. IP地址:远程访问需要的条件,但国内IPv4资源紧缺,多数家用宽带都没有公网IP地址。可以向运营商索要试试,或者做内网穿透,
  5. 天线:有条件的可以准备两根,短波和UV各一根,这样就可以全覆盖了,当然SDR也就相应是两个。

满足条件就可以开工了

选择适合的安装方式:

安装方式分为:手动编译、镜像刷入、Docker,可以根据你的服务器类型选择:

树莓派相对简单一些,此处下载镜像直接刷入,然后SSH连进去修改配置文件即可(跳过部署,直接看下文的配置文件说明),相对Docker省去了前面几步,很适合新手;

盒子较难,但其优点在于价格便宜性能强劲,咸鱼购买刷好Armbian系统的S905盒子,然后手动编译Docker部署

这里讲一下如何docker部署

主机开机并插入SDR,使用SSH客户端连入,安装好Docker工具。(群晖自带Docker套件)

curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun

 

拉取镜像

docker pull jketterl/openwebrx:latest

 

创建外部映射目录并建立容器(

“/dev/bus/usb”是Linux下USB设备目录,SDR就包含在其中;“/date/openwebrx/conf:/etc/openwebrx”里前者是预先创建的外部目录,后者是容器内部目录,目的是将配置文件映射出来,方便以后修改配置;“8073:8073”同理是内外端口,默认即可。

 
mkdir -pv /date/openwebrx/conf
docker run -d --name="openwebrx" --privileged -v /dev/bus/usb:/dev/bus/usb -v /date/openwebrx/conf:/etc/openwebrx -p 8073:8073 jketterl/openwebrx:latest

此时容器就已经跑起来了,浏览器输入http://主机IP:8073就可以看到OpenWebRX的界面了。

如果界面出现“No SDR Devices available”错误,这是因为部分系统的内核自动加载SDR,而Docker容器会因宿主机占用SDR无法对其调用。解决的方法就是将SDR列入内核黑名单中。

创建黑名单文件

nano /etc/modprobe.d/rtlsdr.conf

写入如下内容(以下是RTL-SDR,其它SDR可自行百度),完成后Ctrl+x按y保存并重启系统。

blacklist dvb_usb_rtl28xxu

接下来就是编辑配置文件了,OpenWebRX的主要配置文件有:bands.json、config_webrx.py、bookmarks.json。

bands.json:频段范围配置,供后台解码服务使用,JSON语法。”lower_bound”和”upper_bound”为该频段的起始和截止频点,”frequencies”为可选参数,是频段内的特殊频点。

注意:bands.json和config_webrx.py中每个频段的划分大小根据设备的带宽决定,尽量用最少的条目创建频段,不同的SDR设备带宽不一样,可参照下表:

业余UHF段的频宽是10M(430M~440M),RTL-SDR的最佳工作带宽是2.4M,Airspy的最佳工作带宽是10M,因此Airspy仅需划分一个频段,而RTL-SDR则需要划分4个来回切换。

配置实例:业余VHF频段144M~148M,共4M,RTL-SDR需要切分成两部分。

 

 

config_webrx.py:主配置文件,Python语法+JSON语法,如果需要可以根据官方注释结合官方文档研究:

 

SDR设备参数部分:

此处定义SDR的相关参数,需要仔细研究,由于篇幅太多博主无法一一说明,需要注意的是站点页面可视的频宽范围和SDR带宽相关,和bands.json的配置类似,一段不够就切分成多段,切换显示。

 

"sdrs": {
        "rtlsdr": {
            "name": "RTL-SDR USB Stick",
            "type": "rtl_sdr",
            "profiles": {
                "70cm": {
                    "name": "70cm Repeaters",
                    "center_freq": 438800000,
                    "rf_gain": 29,
                    "samp_rate": 2400000,
                    "start_freq": 439275000,
                    "start_mod": "nfm"
                },
                "2m": {
                    "name": "2m",
                    "center_freq": 145000000,
                    "rf_gain": 29,
                    "samp_rate": 2048000,
                    "start_freq": 145725000,
                    "start_mod": "nfm"
                },
                "VHF FM Broadcast - 01": {
                    "name": "VHF FM Broadcast - 01",
                    "center_freq": 77200000,
                    "start_freq": 77000000,
                    "start_mod": "wfm",
                    "samp_rate": 2400000,
                    "initial_squelch_level": -55,
                    "rf_gain": 15
                },
                "VHF FM Broadcast - 02": {
                    "name": "VHF FM Broadcast - 02",
                    "center_freq": 79600000,
                    "start_freq": 79400000,
                    "start_mod": "wfm",
                    "samp_rate": 2400000,
                    "initial_squelch_level": -55,
                    "rf_gain": 15
                },
                "VHF FM Broadcast - 03": {
                    "name": "VHF FM Broadcast - 03",
                    "center_freq": 82000000,
                    "start_freq": 81800000,
                    "start_mod": "wfm",
                    "samp_rate": 2400000,
                    "initial_squelch_level": -55,
                    "rf_gain": 15
                },
                "VHF FM Broadcast - 04": {
                    "name": "VHF FM Broadcast - 04",
                    "center_freq": 84400000,
                    "start_freq": 83750000,
                    "start_mod": "wfm",
                    "samp_rate": 2400000,
                    "initial_squelch_level": -55,
                    "rf_gain": 15
                },
                "VHF FM Broadcast - 05": {
                    "name": "VHF FM Broadcast - 05",
                    "center_freq": 86800000,
                    "start_freq": 87800000,
                    "start_mod": "wfm",
                    "samp_rate": 2400000,
                    "initial_squelch_level": -55,
                    "rf_gain": 15
                },
                "VHF FM Broadcast - 06": {
                    "name": "VHF FM Broadcast - 06",
                    "center_freq": 89200000,
                    "start_freq": 89600000,
                    "start_mod": "wfm",
                    "samp_rate": 2400000,
                    "initial_squelch_level": -55,
                    "rf_gain": 15
                },
                "VHF FM Broadcast - 07": {
                    "name": "VHF FM Broadcast - 07",
                    "center_freq": 91600000,
                    "start_freq": 91600000,
                    "start_mod": "wfm",
                    "samp_rate": 2400000,
                    "initial_squelch_level": -55,
                    "rf_gain": 15
                },
                "VHF FM Broadcast - 08": {
                    "name": "VHF FM Broadcast - 08",
                    "center_freq": 94000000,
                    "start_freq": 93100000,
                    "start_mod": "wfm",
                    "samp_rate": 2400000,
                    "initial_squelch_level": -55,
                    "rf_gain": 15
                },
                "VHF FM Broadcast - 09": {
                    "name": "VHF FM Broadcast - 09",
                    "center_freq": 96400000,
                    "start_freq": 96400000,
                    "start_mod": "wfm",
                    "samp_rate": 2400000,
                    "initial_squelch_level": -55,
                    "rf_gain": 15
                },
                "VHF FM Broadcast - 10": {
                    "name": "VHF FM Broadcast - 10",
                    "center_freq": 98800000,
                    "start_freq": 98800000,
                    "start_mod": "wfm",
                    "samp_rate": 2400000,
                    "initial_squelch_level": -55,
                    "rf_gain": 15
                },
                "VHF FM Broadcast - 11": {
                    "name": "VHF FM Broadcast - 11",
                    "center_freq": 101200000,
                    "start_freq": 101100000,
                    "start_mod": "wfm",
                    "samp_rate": 2400000,
                    "initial_squelch_level": -55,
                    "rf_gain": 15
                },
                "VHF FM Broadcast - 12": {
                    "name": "VHF FM Broadcast - 12",
                    "center_freq": 103600000,
                    "start_freq": 104300000,
                    "start_mod": "wfm",
                    "samp_rate": 2400000,
                    "initial_squelch_level": -55,
                    "rf_gain": 15
                },
                "VHF FM Broadcast - 13": {
                    "name": "VHF FM Broadcast - 13",
                    "center_freq": 106000000,
                    "start_freq": 105500000,
                    "start_mod": "wfm",
                    "samp_rate": 2400000,
                    "initial_squelch_level": -55,
                    "rf_gain": 15
                },
                "VHF 2m Flight - 1": {
                    "name": "VHF 2m Flight - 1",
                    "center_freq": 119000000,
                    "start_freq": 119900000,
                    "start_mod": "am",
                    "samp_rate": 2400000,
                    "initial_squelch_level": -61,
                    "rf_gain": 25
                },
                "VHF 2m Flight - 2": {
                    "name": "VHF 2m Flight - 2",
                    "center_freq": 122000000,
                    "start_freq": 122850000,
                    "start_mod": "am",
                    "samp_rate": 2400000,
                    "initial_squelch_level": -61,
                    "rf_gain": 25
                },
                "VHF 2m Flight - 3": {
                    "name": "VHF 2m Flight - 3",
                    "center_freq": 124000000,
                    "start_freq": 125100000,
                    "start_mod": "am",
                    "samp_rate": 2400000,
                    "initial_squelch_level": -61,
                    "rf_gain": 25
                },
                "VHF 2m Flight - 4": {
                    "name": "VHF 2m Flight - 4",
                    "center_freq": 126000000,
                    "start_freq": 125900000,
                    "start_mod": "am",
                    "samp_rate": 2400000,
                    "initial_squelch_level": -61,
                    "rf_gain": 25
                },
                "VHF 2m Flight - 5": {
                    "name": "VHF 2m Flight - 5",
                    "center_freq": 128000000,
                    "start_freq": 127450000,
                    "start_mod": "am",
                    "samp_rate": 2400000,
                    "initial_squelch_level": -61,
                    "rf_gain": 25
                },
                "VHF 2m Flight - 6": {
                    "name": "VHF 2m Flight - 6",
                    "center_freq": 130000000,
                    "start_freq": 130450000,
                    "start_mod": "am",
                    "samp_rate": 2400000,
                    "initial_squelch_level": -61,
                    "rf_gain": 25
                },
                "VHF 2m Flight - 7": {
                    "name": "VHF 2m Flight - 7",
                    "center_freq": 132000000,
                    "start_freq": 132730000,
                    "start_mod": "am",
                    "samp_rate": 2400000,
                    "initial_squelch_level": -61,
                    "rf_gain": 25
                },
                "VHF 2m Flight - 8": {
                    "name": "VHF 2m Flight - 8",
                    "center_freq": 134000000,
                    "start_freq": 133050000,
                    "start_mod": "am",
                    "samp_rate": 2400000,
                    "initial_squelch_level": -61,
                    "rf_gain": 25
                },
                "VHF 2m Flight - 9": {
                    "name": "VHF 2m Flight - 9",
                    "center_freq": 135500000,
                    "start_freq": 135250000,
                    "start_mod": "am",
                    "samp_rate": 1024000,
                    "initial_squelch_level": -61,
                    "rf_gain": 25
                },
                "VHF 2m - 1": {
                    "name": "VHF 2m - 1",
                    "center_freq": 145000000,
                    "start_freq": 144500000,
                    "start_mod": "nfm",
                    "samp_rate": 2400000,
                    "initial_squelch_level": -61,
                    "rf_gain": 25
                },
                "VHF 2m - 2": {
                    "name": "VHF 2m - 2",
                    "center_freq": 147000000,
                    "start_freq": 147950000,
                    "start_mod": "nfm",
                    "samp_rate": 2400000,
                    "initial_squelch_level": -61,
                    "rf_gain": 25
                },
                "UHF 70cm - 0": {
                    "name": "UHF 70cm - 0",
                    "center_freq": 409868700,
                    "start_freq": 409750000,
                    "start_mod": "nfm",
                    "samp_rate": 240000,
                    "initial_squelch_level": -62,
                    "rf_gain": 30
                },
                "UHF 70cm - 1": {
                    "name": "UHF 70cm - 1",
                    "center_freq": 431000000,
                    "start_freq": 431675000,
                    "start_mod": "nfm",
                    "samp_rate": 2400000,
                    "initial_squelch_level": -66,
                    "rf_gain": 30
                },
                "UHF 70cm - 2": {
                    "name": "UHF 70cm - 2",
                    "center_freq": 433000000,
                    "start_freq": 432500000,
                    "start_mod": "nfm",
                    "samp_rate": 2400000,
                    "initial_squelch_level": -66,
                    "rf_gain": 30
                },
                "UHF 70cm - 3": {
                    "name": "UHF 70cm - 3",
                    "center_freq": 435000000,
                    "start_freq": 434975000,
                    "start_mod": "nfm",
                    "samp_rate": 2400000,
                    "initial_squelch_level": -66,
                    "rf_gain": 30
                },
                "UHF 70cm - 4": {
                    "name": "UHF 70cm - 4",
                    "center_freq": 437000000,
                    "start_freq": 436795000,
                    "start_mod": "nfm",
                    "samp_rate": 2400000,
                    "initial_squelch_level": -66,
                    "rf_gain": 30
                },
                "UHF 70cm - 5": {
                    "name": "UHF 70cm - 5",
                    "center_freq": 439000000,
                    "start_freq": 438500000,
                    "start_mod": "nfm",
                    "samp_rate": 2400000,
                    "initial_squelch_level": -66,
                    "rf_gain": 30
                }
            },
            "always-on": true
        }
    }

OpenWebRX配置的精髓就在于此处,可实现多个SDR协同工作(博主有两个SDR:RTL-SDR Blog v3用于UV段、SDRPlay RSP1用于短波,打造全频段监测站)

大致结构:

【2~6行】单个SDR的设备ID、名称、设备类型、频偏等;

【7-10行】后台解码方式、时间段、扫描频段(bands.json中定义);

【其余】每个频段的的名称、中心频点、默认频点、默认制式、带宽、静噪、增益;

背景和图标自定义:

站点页面代码和图片在/opt/openwebrx/htdocs目录下,修改替换即可拥有自己的风格。

创建用户:

通过官方源安装的过程中会提示创建管理员并输入密码

而树莓派镜像有现成的“openwebrx”命令,SSH连入命令行执行命令创建管理员:

openwebrx admin adduser admin openwebrx admin enableuser admin

Docker则需执行Python脚本创建管理员,如下命令是进入容器和执行创建一气呵成:

docker exec -it openwebrx python3 /opt/openwebrx/openwebrx.py admin adduser admin

目前还没有授权方法,所以创建出的用户都是管理员,期待后续版本加入权限分配功能。更多说明请参考官方文档的用户管理部分。

结语:

以上就是博主对OpenWebRX的安装和配置的简单说明,希望各位友台们发掘出更多功能。有条件的友台也不要吝惜你的资源,监测站的搭建可以为更多的台友提供信号监听、传播分析、信标上传等服务,这类技术研究或者说基础设施建设,在方便自己和他人的同时也促进了圈子的繁荣、推动了业余无线电的发展、体现了我们爱好者的团结互助精神。

 

标签:树莓,name,SDR,RTL,start,rate,freq,VHF
From: https://www.cnblogs.com/HGNET/p/17066375.html

相关文章