使用 Raspberry Pi 和 RTL-SDR 加密狗设置 APRS 接收 iGate 的指南

** This is now outdated, I recommend the pre-built image from here rather than following these instructions.  I can not support this method any more **

I originally bought a Raspberry Pi back in October 2012 but as I didn’t have a specific purpose in mind for it, I quickly sold it again.  A few months ago I decided to play around with a Pi again and bought the latest model. Since then I’ve found a few uses including an ADS-B aircraft tracker and an adblocker for my whole house. In fact I’ve become quite fond of these little devices and now have a small fleet of them!

I’ve been looking at other things I can do and I tried a NOAA weather satellite receiver which, although it worked wasn’t particularly great with the aerial I used and I really didn’t need to put another antenna up outside.  I also looked at a 137MHz ship tracker but the less said about that, the better.

One thing I thought might be interesting to try was a receive only APRS iGate using a Raspberry Pi and cheap RTL-SDR dongle so I’ve set one up and it’s working really well.

I found everything I needed in two guides which are both very well written although there’s more in them than you need so I’m going to reproduce exactly what I did here.
Please note – I am not claiming originality for these instructions, I’m simply following what’s already available out there on the internet.  My two source documents are Raspberry Pi SDR IGate and Raspberry Pi Packet TNC.  I thoroughly recommend you download them both as they go into a lot more detail than just listing the commands.  It’s also worth grabbing the full Dire Wolf user guide.

If you want a pre-built image for this setup which only requires you to edit a maximum of three files, see my more recent blog entry here.

You will need a Raspberry Pi and an SDR dongle.  I’ve been using an RTL-SDR R820T2 RTL2832U 1PPM TCXO SMA Software Defined Radio (Dongle Only) device which is the latest model, complete with TCXO.
I have this running successfully on the smallest and cheapest Raspberry Pi currently available – The Raspberry Pi Zero.  I bought my Zero from Pimoroni along with a three port USB/Ethernet interface which ironically costs more than double the price of the actual Raspberry Pi Zero.  Typically the CPU usage sits around 30-35% on the Zero.

First download install your operating system.  I used the full latest version of Raspbian Jessie from here and the installation guide from here.  Because we’re going to be doing this install entirely by command line, before you plug the card into your Raspberry Pi, you’ll need to create a file called ‘ssh’ on the card to enable remote access.  In my case, on my Mac I simply right clicked on the mounted SD card, selected Services/New Terminal at Folder and then at the prompt typed the command
sudo touch ssh
I was then asked for my password, this created the file and I moved the SD card into my Raspberry Pi.

You will need to know what IP address your Raspberry Pi has on the network.  I do this by looking at my router and checking what devices have connected and then set up a DHCP reservation so each particular Raspberry Pi I own will always have the same address each time it reboots.

The next thing to do is some basic housekeeping which I do on all new installations.  Open up a terminal/dos prompt or whatever client software you’re going to use to connect to the Raspberry Pi and log in.  In my case, the Raspberry Pi is on 192.168.1.144 so I use the command
ssh pi@192.168.1.144
The default password is raspberry, one of the first things to do is change that via the Raspberry Pi configuration utility which you run now using sudo raspi-config

This is what you see when you open the config utility.

The Raspberry Pi software configuration tool

The Raspberry Pi software configuration tool

Select option 1, select OK and you’ll be returned to the screen above.
Select option 2 and following the prompts, change your password.
Select option 3 and first choose Desktop / CLI and then Desktop Autologin.  This is important because without this, the iGate will not be able to start automatically when you reboot the Raspberry Pi.
Select option 4 and configure your Timezone and Wi-fi country.  I generally don’t bother with Locale and Keyboard Layout.
Select option 7 and then choose Hostname.  Give your Raspberry Pi a name other than the default.

Once all these changes are done, use the tab key to move down to <Finish> and hit enter.  You’ll be prompted to reboot the Raspberry Pi.

The next thing to do is to make sure the Raspberry Pi software is fully up to date.  Issue the following commands:
sudo apt-get update
sudo apt-get dist-upgrade
Depending on which model Raspberry Pi you have and how old the image is, this may take some time to complete.
Then remove the Wolfram engine using the following three commands:
sudo apt-get purge wolfram-engine
sudo apt-get clean
sudo apt-get autoremove
Once this is all complete, reboot the Raspberry Pi and you’re ready for to start the actual installation.
sudo reboot now

Remove pulseaudio and reboot.
sudo apt-get remove --purge pulseaudio
sudo apt-get autoremove
rm -rf /home/pi/.pulse
sudo reboot now

Log back in and install the sound library.
sudo apt-get install libasound2-dev

Download the Dire Wolf source code.
cd ~
git clone https://www.github.com/wb2osz/direwolf

Compile and install Dire Wolf.
cd ~/direwolf
make
sudo make install
make install-rpi
make install-conf

Test
direwolf

This will fail with the following error because you haven’t configured any audio devices.

Now it’s time to install the software for the RTL-SDR dongle.
sudo apt-get update
sudo apt-get install cmake build-essential libusb-1.0-0-dev
cd ~
git clone git://git.osmocom.org/rtl-sdr.git
cd rtl-sdr
mkdir build
cd build
cmake ../ -DINSTALL_UDEV_RULES=ON -DDETACH_KERNEL_DRIVER=ON
make
sudo make install
sudo ldconfig

Now you need to complete the final configuration.  Use the APRS Passcode Generator at Magicbug to get your own passcode.
cd ~
sudo nano sdr.conf

On line eight, change the xxx to your callsign and required SSID.  I use -10 as my SSID so this line reads MYCALL G6NHU-10
In the section below, edit the line starting with IGSERVER to be the correct one for your region.  I’m in Europe so my line reads IGSERVER euro.aprs2.net
Scroll further down and you’ll find a line that starts with IGLOGIN.  Change the xxx to be the same as the callsign you entered above (including SSID) and then change the numbers 123456 to the passcode you obtained from the APRS Passcode Generator.

You now need to add an extra line at the bottom of the file.
PBEACON sendto=IG delay=0:30 every=15:00 symbol="igate" overlay=R lat=xx.xxxxxx long=yyy.yyyyyy COMMENT="zz iGate | DireWolf 1.3 on RPi+RTL-SDR"

Note that although it’s spanned over two lines above, you should enter this as one continual line in your file. Replace xx.xxxxxx with your latitude, yyy.yyyyyy with your longitude and zz with your callsign (including SSID). Be aware that there is a space between the lat and long values.

Reboot.
sudo reboot now
If you don’t reboot, you’re going to get errors.
It’s now time to test this.
Enter the following command (144.800 is the APRS frequency in the UK, change as required).
rtl_fm -f 144.80M - | direwolf -c sdr.conf -r 24000 -D 1 -

If all is well, you should see something like this.

Initial test of the Raspberry Pi and RTL-SDR Dongle APRS RX only iGate

Initial test of the Raspberry Pi and RTL-SDR Dongle APRS RX only iGate

You can see that it’s started up successfully, connected to euro.aprs2.net and I’ve already received an APRS packet from M0SDJ-9 relayed through MB7UH.  The magenta text shows that my own beacon has been sent to the internet and I can check that by searching for G6NHU-10 on aprs.fi.

If you’re using a Mac and connecting to your Raspberry Pi via the terminal you may notice the screen flashes badly.  You can fix this easily and quickly by going into the terminal Preferences/Profiles and make sure the box “Allow blinking text” is not ticked.

The last thing to do is to set everything to start automatically when you restart the Raspberry Pi.  To do this, edit dw-start.sh
cd ~
sudo nano dw-start.sh

Scroll down and look for this line

Edit it to remove the hash at the start and change the frequency to whatever is appropriate in your area.  In the UK, APRS is on 144.800 MHz so my line looks like this

Save the file and then run the following command to make the script executable.
sudo chmod +x dw-start.sh

Finally, add a line to cron which will run once a minute to check whether Dire Wolf is running and if not, it will restart it.
crontab -e

If this is the first time you’ve edited the crontab, you’ll get a prompt asking which editor to use – Just hit enter to select nano as the default.

Scroll down to the bottom and paste the following line.
* * * * * /home/pi/dw-start.sh >/dev/null 2>&1

Reboot your Raspberry Pi and once it’s restarted, it will automatically connect to the APRS network and operate as a receive only iGate. Nothing will be echoed to the display while it’s running like this so you can check the status on aprs.fi.

I hope this guide is straightforward enough to follow – It looks more complicated than it actually is, it’s really quite simple just to follow all the steps through.

Share this:

使用 Raspberry Pi 和 RTL-SDR 加密狗设置 APRS 接收 iGate 的指南

** 这已经过时了,我建议使用这里的预建图像,而不是按照这些说明操作。我不再支持这种方法 **

我最初在 2012 年 10 月买了一台Raspberry Pi,但由于我当时没有想好要用它做什么,所以很快就把它卖掉了。几个月前,我决定再次尝试 Pi,并买了最新型号。从那时起,我发现了它的一些用途,包括ADS-B 飞机跟踪器和整个房子的广告拦截器。事实上,我已经非常喜欢这些小设备了,现在我有一小批这样的设备!

我一直在寻找其他可以做的事情,我尝试了NOAA 气象卫星接收器,虽然它与我使用的天线配合得不是特别好,但我真的不需要在外面再放一个天线。我还看了一个 137MHz 船舶跟踪器,但关于它说得越少越好。

我认为有趣的一件事值得尝试,那就是使用 Raspberry Pi 和便宜的 RTL-SDR 加密狗来接收仅 APRS iGate,因此我设置了一个,并且它运行得非常好。

我在两本指南中找到了我需要的一切,这两本指南都写得非常好,尽管其中的内容比你需要的要多,所以我将在这里准确重现我所做的。
请注意 - 我并不声称这些说明是原创的,我只是遵循互联网上已有的内容。我的两个源文档是Raspberry Pi SDR IGateRaspberry Pi Packet TNC 。我强烈建议您下载它们,因为它们比仅仅列出命令更详细。完整的 Dire Wolf用户指南也值得一读。

如果您想要此设置的预建图像(仅需要您编辑最多三个文件),请参阅此处我的最新博客条目。

您将需要一个 Raspberry Pi 和一个 SDR 加密狗。我一直在使用RTL-SDR R820T2 RTL2832U 1PPM TCXO SMA 软件定义无线电(仅加密狗) 设备,这是最新型号,配有 TCXO。
我已在目前最小、最便宜的 Raspberry Pi(Raspberry Pi Zero)上成功运行了它。我从Pimoroni购买了 Zero  ,还买了一个三端口USB/以太网接口,但讽刺的是,它的价格是实际 Raspberry Pi Zero 的两倍多。通常,Zero 的 CPU 使用率约为 30-35%。

首先下载安装您的操作系统。我使用了此处的最新版本的 Raspbian Jessie此处 的安装指南。因为我们将完全通过命令行进行安装,所以在将卡插入 Raspberry Pi 之前,您需要在卡上创建一个名为“ssh”的文件以启用远程访问。就我而言,在我的 Mac 上,我只需右键单击已安装的 SD 卡,在文件夹中选择服务/新终端,然后在提示符下输入命令
sudo touch ssh,
然后系统要求我输入密码,这会创建文件,然后我将 SD 卡移入我的 Raspberry Pi。

您需要知道 Raspberry Pi 在网络上的 IP 地址。我通过查看路由器并检查已连接的设备,然后设置DHCP 预留,以便我拥有的每个 Raspberry Pi 每次重新启动时都将始终具有相同的地址。

接下来要做的是一些基本的日常管理工作,我在所有新安装的设备上都会这样做。打开终端/DOS 提示符或任何您要用来连接 Raspberry Pi 并登录的客户端软件。在我的例子中,Raspberry Pi 位于 192.168.1.144,因此我使用命令
ssh pi@192.168.1.144
默认密码是raspberry ,首先要做的一件事是通过您现在使用sudo raspi-config运行的 Raspberry Pi 配置实用程序更改该密码

这是您打开配置实用程序时所看到的内容。

Raspberry Pi 软件配置工具

Raspberry Pi 软件配置工具

选择选项 1,选择 OK,您将返回到上面的屏幕。
选择选项 2,然后按照提示更改密码。选择选项 3
,首先选择桌面/CLI,然后选择桌面自动登录。  这很重要,因为如果没有这个,iGate 将无法在您重新启动 Raspberry Pi 时自动启动。
选择选项 4 并配置您的时区和 Wi-fi 国家/地区。我通常不关心区域设置和键盘布局。
选择选项 7,然后选择主机名。为您的 Raspberry Pi 指定一个除默认名称以外的名称。

完成所有这些更改后,使用 tab 键向下移动到 <Finish> 并按回车键。系统将提示您重新启动 Raspberry Pi。

接下来要做的是确保 Raspberry Pi 软件完全更新。发出以下命令:
sudo apt-get update
sudo apt-get dist-upgrade

根据您拥有的 Raspberry Pi 型号以及映像的旧程度,这可能需要一些时间才能完成。
然后使用以下三个命令删除 Wolfram 引擎:
sudo apt-get purge wolfram-engine
sudo apt-get clean
sudo apt-get autoremove

完成所有操作后,重新启动 Raspberry Pi,您就可以开始实际安装了。
sudo reboot now

删除 pulseaudio 并重新启动。sudo apt-get autoremove rm -rf /home/pi/.pulse sudo reboot now
sudo apt-get remove --purge pulseaudio


 

重新登录并安装声音库。sudo
apt-get install libasound2-dev

下载 Dire Wolf 源代码。cd
~
git clone https://www.github.com/wb2osz/direwolf

编译并安装 Dire Wolf。cd
~/direwolf
make
sudo make install
make install-rpi
make install-conf

测试
冰原狼

由于您尚未配置任何音频设备,因此此操作将失败并出现以下错误。

现在是时候安装 RTL-SDR 加密狗的软件了。
sudo apt-get update
sudo apt-get install cmake build-essential libusb-1.0-0-dev
cd ~
git clone git://git.osmocom.org/rtl-sdr.git
cd rtl-sdr
mkdir build
cd build
cmake ../ -DINSTALL_UDEV_RULES=ON -DDETACH_KERNEL_DRIVER=ON
make
sudo make install
sudo ldconfig

现在你需要完成最后的配置。使用Magicbug 上的APRS 密码生成器获取你自己的密码。cd
~
sudo nano sdr.conf

在第八行,将 xxx 更改为您的呼号和所需的 SSID。我使用 -10 作为我的 SSID,因此此行显示为 MYCALL G6NHU-10
在下面的部分中,编辑以 IGSERVER 开头的行,使其适合您所在的区域。我在欧洲,所以我的行显示为 IGSERVER euro.aprs2.net进一步向下滚动,您将找到以 IGLOGIN 开头的行。将 xxx 更改为与您在上面输入的呼号相同(包括 SSID),然后将数字 123456 更改为您从APRS 密码生成器
获得的密码。

现在您需要在文件底部添加一行。
PBEACON sendto=IG delay=0:30 every=15:00 symbol="igate" overlay=R lat=xx.xxxxxx long=yyy.yyyyyy COMMENT="zz iGate | DireWolf 1.3 on RPi+RTL-SDR"

请注意,尽管上面跨越了两行,但您应该将其作为一行连续输入到文件中。将 xx.xxxxxx 替换为您的纬度,将 yyy.yyyyyy 替换为您的经度,将 zz 替换为您的呼号(包括 SSID)。请注意,纬度和经度值之间有一个空格。

重启。
sudo reboot now
如果不重启,就会出现错误。
现在是时候测试一下了。
输入以下命令(144.800 是英国的 APRS 频率,根据需要更改)。
rtl_fm -f 144.80M - | direwolf -c sdr.conf -r 24000 -D 1 -

如果一切顺利的话,你应该会看到类似这样的内容。

Raspberry Pi 和 RTL-SDR Dongle APRS RX 仅 iGate 的初步测试

Raspberry Pi 和 RTL-SDR Dongle APRS RX 仅 iGate 的初步测试

您可以看到它已成功启动,连接到 euro.aprs2.net,并且我已经从 M0SDJ-9 收到通过 MB7UH 中继的 APRS 数据包。洋红色文本显示我的信标已发送到互联网,我可以通过搜索aprs.fi上的 G6NHU-10 来检查这一点。

如果您使用的是 Mac 并通过终端连接到 Raspberry Pi,您可能会注意到屏幕闪烁严重。您可以轻松快速地修复此问题,只需进入终端首选项/配置文件并确保未勾选“允许闪烁文本”框即可。

最后要做的是将所有内容设置为在重新启动 Raspberry Pi 时自动启动。为此,请编辑 dw-start.sh
cd ~
sudo nano dw-start.sh

向下滚动并查找此行

编辑它以删除开头的哈希,并将频率更改为您所在地区合适的频率。在英国,APRS 为 144.800 MHz,所以我的线路如下所示

保存文件,然后运行以下命令使脚本可执行。sudo
chmod +x dw-start.sh

最后,在 cron 中添加一行,每分钟运行一次,检查 Dire Wolf 是否正在运行,如果没有,则重新启动它。crontab
-e

如果这是您第一次编辑 crontab,您将收到一个提示,询问使用哪个编辑器 - 只需按 Enter 键选择 nano 作为默认值。

向下滚动到底部并粘贴以下行。
* * * * * /home/pi/dw-start.sh >/dev/null 2>&1

重启 Raspberry Pi,重启后它将自动连接到 APRS 网络并作为仅接收 iGate 运行。运行时不会有任何内容回显到显示屏上,因此您可以检查 aprs.fi 上的状态。

我希望本指南足够简单易懂 - 它看起来比实际上更复杂,但只需遵循所有步骤就非常简单。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值