Sunday, May 6, 2018

APRS receive only iGate using a Raspberry Pi and an RTL-SDR dongle




Gambar diatas adalah Igate yang saya buat berdasarkan step dibawah. Saya ikut 100% langkah-langkah dibawah dan ianya berhasil. Terima Kasih diucapkan kepada G6NHU kerana menulis dengan detail tutorial dibawah. Jika anda berminat, anda bolehlah mencubanya. 


A guide to setting up an APRS receive only iGate using a Raspberry Pi and an RTL-SDR dongle

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
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 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
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.

No comments:

Radio frequency monitoring : Kuala Perlis

Kuala Perlis Kuala Perlis terletak di hujung sekali pantai barat semenanjung Malaysia, iaitu ke arah utara pantai barat semenanjung Ma...