OP25 on Raspberry Pi Part 1

Lately, my obsession with scanner listening was re-ignited thanks to another blogger at https://www.hagensieker.com/wordpress/. With the help of his tutorials I was able to create a Trunked P25 Phase 1 scanner with the famous credit card sized Linux computer Raspberry Pi and a cheap RTL-SDR USB dongle. I know have the unit streaming to Broacastify at https://www.broadcastify.com/listen/feed/29533 and I use my mobile phone to listen to the stream so I can hear what is happening in my community wherever I am with an internet connection.

With the help of the steps posted on the Hagenseiker blog I was able to recreate my set-up while writing my own tutorial, making my own tweaks along the way. I will show you how to get started with OP25 and on Raspberry Pi (and should work on Ubuntu and other Linux distros with little alterations to the steps) to play either to your speakers or TV/Monitor via HDMI. Broadcastify and Icecast servers will be discussed in part 2.

Equipment Used:

Raspberry Pi 3 Model B – $35.00

RTL-SDR RTL2832U V3 – $25.00

Raspberry Pi Case – $5.00

8GB Micro SD Card – $5.00

From a fresh image of the latest Raspbian OS (I am using Stretch) power your system on. First, we need to allow for VNC and SSH so you can control your pi, in case you have issues while you are away.

If prompted to change your password in any of these steps, change your password whichever way you’d like (it’s recommended you change your password from default)

Click on the raspberry button (top right corner), Preferences, Raspberry Pi Configuration:

On the System Tab select Resolution set a resolution you would like (I have selected DMT mode 82 1920×1080 60Hz 16:9)

On the Interfaces Tab enable SSH and VNC

On the Localization tab select the appropriate time zone (important for crontab processes)

If prompted to reboot, reboot. If system does not prompt reboot, or system doesn’t reboot, open a terminal

sudo reboot

After reboot, open a terminal

sudo nano /boot/config.txt

Scroll down to:

# uncomment if hdmi display is not detected and composite is being output

# hdmi_force_hotplug=1

Remove the “# ” from hdmi_force_hotplug=1 it should look like this:

# uncomment if hdmi display is not detected and composite is being output

hdmi_force_hotplug=1

You should see a VNC icon in the top left side. Click on it and either sign in or sign up with a RealVNC account (this is a free service for non-commercial use). You will now be able to access your pi from anywhere you have internet service, by using a VNC Viewer Application.

Now for the radio aspect of the installation.

Install GQRX. GQRX is not absolutely required, but it allows for ease of use, as GQRX will retrieve all of the RTL-SDR driver. GQRX will also be helpful retrieving the signals from the control channel if you are unable to locate on a site like radio reference.

sudo apt update

sudo apt install gnuradio libvolk1-bin libusb-1.0-0 gr-iqbal

sudo apt install qt5-default libqt5svg5 libportaudio2

sudo cp udev/*.rules /etc/udev/rules.d/

Make a new directory and download GQRX to the newly created directory.

cd

mkdir gqrx

cd gqrx

wget https://github.com/csete/gqrx/releases/download/v2.11.5/gqrx-sdr-2.11.5-linuxrpi3.tar.xz

Go to the directory you just created /home/pi/gqrx, and right click on the zipped file and select extract here.

You will now need to install OP25. OP25 is a program that decodes P25 Phase 1 and Phase 2, both CQPSK and C4FM modulations. If you are trying to decode P25 Phase 2 communications, there is a probability that the transmissions are encrypted, but in my arear we have a few more years until the NC VIPER system is converted over.

OP25 is the best for ease of install and usability in my opinion, others will guide you to use DSD+ (I am not a fan of DSD+).

Download OP25 from the GitHub repository, the download will make a folder named OP25.

git clone https://github.com/boatbod/op25.git

Change directories to OP25 and install the program

cd op25

./install.sh

During the install it will ask you to install GNUPlot. GNUPlot is very handy in visualizing the signals while monitoring the control channel. GNU Plot is also very helpful in determining the frequency offset of your particular SDR dongle. Install GNUPlot by typing the following:

sudo apt-get install gnuplot-x11

Plug in your SDR device, I am using an RTL-SDR V3 ($24 dollars on Amazon)

In Terminal go to the /gr-op25_repeater/apps/ directory

cd /home/pi/op25/op25/gr-op25_repeater/apps

Now enter the following command change the highlighted to the control channel frequency. You can find the control channel on Radio Reference most of the time. For the NCVIPER system (I am setting up for the Oxford NC site) the control channel is indicated by red font followed by a (c).

./rx.py –args ‘rtl’ -N ‘LNA:47’ -S 2400000 -f 852.9750e6 -o 25000 -q 1

If you have errors change the “q” option to another number -1 -2 1 2 3 -8, keep adjusting numbers depending on your SDR. If you have another USB dongle type you can define it after –args.

You’ll know when you have the right command when you see something of the sorts of (it will not be exact; this is unique to each site):

NAC 0x1f2 WACN 0xbee00 SYSID 0x1fc 852.975000

Copy the NAC, in my case 0x1f2, and open the file explorer. Go to /home/pi/op25/op25/gr-op25_repeater/apps/ and open up a file named “trunk.tsv”. You will need to enter your user specific information.

Please note the .tsv and .wlist are CaSe SeNsItIvE since they are filenames.

Save the “trunk.tsv” file as Text CSV Format.

While in Libre Office, create a new .csv named {yoursitename}.tsv, same as the TGID Tags File in the trunk.tsv file. Add all the TGID’s in column A and the Alpha Tag Name in column B. Do not use headers. Add all the Talkgroups you’d like. Talkgroups are unique to the site, you can find this information on radio reference, as a premium subscriber you can download direct exports (much worth the $$$) Your {yoursitename}.tsv should look like this:

I have a large file for the TGIDs, for instructional purposes only I will not put the whole file here, but it can be as large or small as you would like. Save the file as you labeled in the trunk.tsv file as a CSV. go back to the file explorer and remove the .csv file extension ie: it should read oxford.tsv not oxford.tsv.csv.

Broadcastify does not allow for Tactical, Investigative or Op channels to be streamed, because of this we need to create a whitelist, only allowing certain transmissions to be decoded and streamed based off the TGIDs. This is also a good Idea if you receive a lot of unwanted traffic, ie traffic from surrounding unit’s/counties.

Create another .CSV in Libre Office, this time is will be labeled {yoursitename}.wlist. Just like you added the TGID tags, add your TGID you want to be decoded and streamed. TGID in column A and Alpha Tag Name in Column B. Your file should look like this:

Again make this file as large or small as you’d like, but keep in mind that the more TGIDs you have the more traffic your device will decode, possibly missing any doubling transmissions, ie: if EMS Dispatch and Fire Dispatch are TXing at the same time, the device will decode the first hear TG, leaving out the other transmission. Once you are done with this, save the file (in the same /apps/ folder as the trunk.tsv and oxford.tsv) as {yoursitename}.wlist and remove the.csv file extension ie: it should read oxford.wlist not oxford.wlist.csv.

Now all the user defined parameters have been set open the terminal go to the /op25/op25/gr-op25_repeater/apps directory and execute the command to start decoding traffic.

cd /op25/op25/gr-op25_repeater/apps

./rx.py –args ‘rtl’ -N ‘LNA:47’ -S 2400000 -f 852.9750e6 -o 25000 -q 1 -T trunk.tsv -V -2 -U

Make sure that your frequency and q is set according to your setup.

If everything is installed properly plug in speakers (preferably powered) in the audio jack, you should be able to see the traffic and TGIDs in the terminal and hear the output via speakers. Don’t worry if the audio quality is poor. If you have your HDMI enabled TV, you should hear the audio from the TV/Monitor speakers.

If you have issues re-read tutorial and check for any mistakes and spell/case issues.

To save yourself time to start the service up without having to type any commands open terminal:

cd

cd op25

sudo nano op25.sh

Paste this information into the file (changing the highlighted info to meet your needs):

#! /bin/sh

cd /op25/op25/gr-op25_repeater/apps

./rx.py –args ‘rtl’ -N ‘LNA:47’ -S 2400000 -f 852.9750e6 -o 25000 -q 1 -T trunk.tsv -V -2 -U

Press the following keys [CTRL]+[X], then [Y], then [ENTER]

Next we need to make out script file executable:

sudo chmod +x op25.sh

In the op25 directory (/home/pi/op25) you can simply by typing ./op25.sh in the terminal, but we will make it easier than that by creating an alias.

Let’s create an alias. Open a terminal:

sudo nano .bashrc

Paste the following lines in the bottom (if you have followed all of this tutorial from a fresh install your directory will be the same, if not you will need to make the necessary corrections):

#OP25 alias

alias op25=’bash /home/pi/op25/op25.sh’

Press the following keys [CTRL]+[X], then [Y], then [ENTER]

Now whenever you open a terminal you should be able to start your service by simply typing “op25” (no quotes) no changing directories :).

Raspberry Pi audio jack is poor, but you should still be able to hear the traffic. If you don’t have powered speakers or the audio is too light you can install a DAC (Digital to Analog Convertor). If you want to output to your speakers and not stream to Broadcastify you can leave as is.

That’s it! Continue to monitor the P25 site and add or redact from your whitelist file as you see fit. The OP25 Software will decode (and play over the speakers) the first signal with a talkgroup that is listed in the whitelist. If you have too many talkgroups in the WL, there’s a possibility that you will miss communications from other units.

img_3864

One comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s