OP25 on a Raspberry Pi (part 3)

In my last part I set the Pi up to stream to Broadcastify.  In this one we are just going to pump audio out through the headphone jack.

I’m doing this with an old generic black RTL-SDR and it works and it works fine but it is kind of susceptible to heat and cold and the ppm correction drifts a bit.  I really recommend getting a v3 RTL-SDR or a NESDR Smart as they seem more stable.  At any rate it doesn’t matter, you’ll just have to deal with the drift if you have any.

My assumption here is that you have Raspbian installed on at least a Pi 3.  I haven’t tried it on a lesser Pi but I had it on a Pi 3 B + and then I found a couple Pi 3 B’s laying around and figured I’d reclaim my B+ for another project on another day.  OP25 runs fine on the Pi 3.

With Raspbian ensure that you are all up to date.  Make sure you are FEEDING THE BEAST AT LEAST 2AMPS.  YOUR RTL WILL PULL A LITTLE MORE CURRENT THAN JUST THE PI DOES.  You could get dropped audio, crashes, etc. if you don’t have enough power supplied to the Pi.  2 amps is enough.

sudo apt-get update
sudo apt-get upgrade

Now lets install op25.

git clone https://github.com/boatbod/op25.git
cd op25
./install.sh
sudo apt-get install gnuplot-x11

Now lets make sure the volume is up on the Pi.  Not the SYSTEM volume but rather the BCM2835 device volume.

alsamixer

Should look like this except your volume will be way down.  Hit the shift key and the + key to increase to max volume.

Now go to this directory:

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

Now run this command.  Bear in mind you MUST KNOW THE FREQUENCY OF THE CONTROL CHANNEL YOU WANT TO FOLLOW AND CHANGE THE -f PART TO THE CORRECT FREQUENCY.

./rx.py --args 'rtl' -N 'LNA:47' -S 2400000 -f 857.2625e6 -o 25000 -q -2

This box will pop up.  Notice the top line has a bunch of zeros in it.  This indicates YOU ARE NOT TUNED TO THE CONTROL CHANNEL

You have to adjust the -q -2 part until you see numbers filled in.  For example I had to add -q 2 (not -2) to my command to get it to lock in.   THIS DEPENDS ON YOUR INDIVIDUAL SDR.  You many have to play around to find it and GNUPLOT can help with this.

Note that not only am I tuned correctly to the control channel it is already picking up voice transmissions.

NOTE:  WITH THIS OLD GENERIC RTL I CAN START USING -q 2 HOWEVER, IF I RUN FOR A WHILE, SHUT IT DOWN AND TRY TO START BACK UP IT IS HOT AND NOW REQUIRES -q 8 TO START.  WHAT AN AMAZING PAIN THAT WOULD BE.  I STRONGLY RECOMMEND GETTING A NEWER, BETTER, FASTER V3 STICK THAT IS VERY STABLE AND HAS LESS DRIFT.

Now we can add to our commands.  You need to have a trunk.tsv file set up and you need a talk group file set up.  I talk about that here. 

Now add to your last command the following:

-T trunk.tsv -V -2 -U 2> stderr-stream0.2

That makes the entire command: (remember to get your -q -whatever correct. Removing it completely can also work)

./rx.py --args 'rtl' -N 'LNA:47' -S 2400000 -f 857.2625e6 -o 25000 -q 2 -T trunk.tsv -V -2 -U 2> stderr-stream0.2

Provided your trunk.tsv file and talk group tsv file are configured correctly sound should now be coming out of your headphone jack.

28 thoughts on “OP25 on a Raspberry Pi (part 3)

  1. Randy

    I followed the install instructions and everything went OK, no errors. But when I issue the following script, (with my local control freq inserted) I just get a blank screen with OP25 at the top and the function commands at the bottom. I don’t even get the NAC ……Sysid with all zeroes line like you show in the tutorial.

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

    Any pointers?

    Reply
    1. Alex Bowman

      Looks like the command you are using has the author’s local control frequency. Unless you are access the same site, you’ll need to change the frequency to your control channel. If you are on the correct frequency play with the -q. My setup works with -q 1, it’ll usually be different for every setup

      Reply
  2. Brian

    Thank you very much for these tutorials. I was able to get everything working except that the alpha tags are not flowing over to broadcasting and then through my feed. Any suggestions?

    Reply
  3. Robert Fisher

    Any tips for troubleshooting audio decoding on a RPi 3B? It looks like i’m successfully capturing and decoding the talkgroups, but for the life of me I cannot get any audio output either through streaming the output or through directly piping the audio to the headphones with -O plughw:0,1. I’ve confirmed my audio actually works (headphones and streaming both!) w/ speaker-test, and have tried both -D fsk4 and cqpsk. I’m running a 2.4A power brick, so power isn’t an issue…..

    Reply
    1. SoundGuyBW

      I have the same issue with the RPi 3B (non-plus). I’ve tried everything you have and still cannot get any sound from op25. I can hear playback via an mp3 and speaker-test through the headphone jack. I have also tried -D fsk4 and cqpsk in the command line and in my trunk.tsv file. I can see P25 Phase 2 transmissions and the various talkgroups come up. It looks like it’s decoding fine. I’m at -q 6. I am running a 2.5A power supply so power shouldn’t be an issue. Linux 4.14.79-v7+ #1159 . ALSA mixer is at 100% and not muted. Tried all the various combinations of -O to try forcing the various hardware outputs.
      Here’s my command:
      ./rx.py –args ‘rtl’ -N ‘LNA:47’ -S 1800000 -f 770.43125e6 -o 25000 -q 6 -T trunk.tsv -V -2 -U 2> clarindaerr.2

      It’s very frustrating, but I haven’t given up yet. If anyone has any ideas to try, let me know. Thanks!

      Reply
      1. SoundGuyBW

        I figured it out! I was NOT tuned correctly. Using “-q 6” was too far out of range to actually decode traffic, but it WAS tuned just enough for op25 to see the control channel. A -q value of -1 or 0 was what solved my issue. I was then able to see the 4 tight dots on the constellation plot, 4 distinct lines at 3, 1, -1 and -3 on the symbol plot, and see just exactly how close I was to center in the mixer plot.
        Now that I figured it out, my advice if you have the same issue or can’t see the plots is to guess how close you are initially by the indicated ‘tsbks’ number. When I started working with op25, I was seeing 1-5 tsbks per second. Once my -q value was set properly, I was seeing 40+ per second. This makes sense because If op25 can’t get enough data packets to decode an audio stream, it simply won’t produce one. It gets enough packets from the control frequency to see the talkgroups and transmit frequency, but isn’t tuned accurately enough to decode the audio stream.
        The frequency (where it initially says 000.00000/000.00000) and System ID (starts as 0x) in the command window should populate almost immediately after starting your op25 command if you’re tuned/centered correctly. If op25 doesn’t populate those values and start seeing a decent tsbks number, you are not tuned accurately enough yet so try another -q value.
        More experienced users may wish to chime in and correct me and I welcome it! We need much more troubleshooting documentation on this amazingly free software. I’m sure it will come with time as P25 Phase 2 adoption is really just getting started.
        It’s frustrating, but don’t give up!

        Reply
        1. John Hagensieker Post author

          Awesome. I literally tried every month or so for a year with a little sit down session with OP25 for an hour here and there before I got it. My whole goal with this page was to make it easier and compile a lot of the info in one place to get it up and running. Glad to see you got it.

          Reply
    2. SoundGuyBW

      I have the same issue with the RPi 3B (non-plus). I’ve tried everything you have and still cannot get any sound from op25. I can hear playback via an mp3 and speaker-test through the headphone jack. I have also tried -D fsk4 and cqpsk in the command line and in my trunk.tsv file. I can see P25 Phase 2 transmissions and can see the various talkgroups pop up. It looks like it’s decoding fine. I’m at -q 6. I am running a 2.5A power supply so power shouldn’t be an issue. Linux 4.14.79-v7+ #1159 . ALSA mixer is at 100% and not muted. Tried all the various combinations of -O to try different hardware outputs.

      ./rx.py –args ‘rtl’ -N ‘LNA:47’ -S 1800000 -f 770.43125e6 -o 25000 -q 6 -T trunk.tsv -V -2 -U 2> clarindaerr.2

      It’s very frustrating, but I haven’t given up yet. If anyone has any ideas to try, let me know. Thanks!

      Reply
  4. Jason

    Great tutorial, all is working as described/expected EXCEPT audio out sounds like a super slow talking synthesised robot. Any hints on the cause? Using Raspberry Pi 3 Model B Rev 1.2

    Reply
  5. Jeremy Goodin

    my issue after executing on a RPi 3, RTL2832U R820T2

    pi@feed1:~/op25/op25/gr-op25_repeater/apps $ ./rx.py –args ‘rtl’ -N ‘LNA:47’ -S 2400000 -f 774.78125 -o 25000 -q -2

    Traceback (most recent call last): File “./rx.py”, line 52, in
    import op25
    ImportError: No module named op25

    Reply
    1. NerbleFlerger

      Try sudo after you clone the git, like ‘sudo ./install.sh’ instead of just ‘./install.sh’.

      Reply
  6. theycallmeshua

    i seem to have set everything up correctly on a pi 3b (no +) but im having the same audio issue as a few others. the problem is from what i can tell is AM tuned properly, i can only see the control frequency when i launch with -q removed or at 0. im getting plenty of tsbks and i can see my control frequency and talk groups show up. i just cant get any audio. if i play audio from a sound file i can hear it just fine so i know the volume is up and functioning. ive also tried both of the modulation options for the .tsv setting. im all out of ideas. any suggestions on where to start poking around are appreciated.

    thanks for the tutorial

    Reply
  7. Brennon

    On Rpi 4 with blaster, I got everything up and running but I was having issues getting audio over the headphone jack, no indications of muted or anything. HDMI Worked just fine. Stupid simple fix for me, right click the speaker icon in the upper right on the task bar, select analog. All fixed.

    Reply
  8. Huskerswon

    Greetings of Great Joy! I have a Pi3B+ and i have everything working after 12 plus hours of tweeking. i was so excited to get the script to run just like was in the TUT. Thanks again for documentation. My Issues and still are issues: I can’t get the Plot to work. I wish I could.
    I was so excited to get this thing running and then i heard my first audio….it sounds like a slow speaking robot… Do I have a setting wrong?? Or is my town PD in Missouri have some kind of voice encoder??
    This is what the reference guide says.. https://www.radioreference.com/apps/db/?sid=6847
    https://dps.mo.gov/dir/programs/intercomm/
    Can I get some clarification???

    Reply
  9. Frank A Thomas

    I’m trying to receive Bedford Virginia which on Radioreference.com shows 12 control channels. Which one do I use?

    Reply
    1. John Hagensieker Post author

      Use a program for SDR receiving and find out which one is transmitting. Control channel noise is unmistakable.

      Reply
  10. Scott

    Had this running for several months; works awesome! But occasionally the audio stream would go silent after a few days even though it would still be streaming “silence” to Broadcastify. A reboot of the pie would fix this; I setup a Crontab to reboot at 4am; and finally after 3 days of pulling my hair out I got it to auto start Darkice and OP25… Here’s what I did.
    Edit the global autostart…
    sudo nano ~/etc/xdg/lxsession/LXDE-pi/autostart
    Add…
    @lxterminal -e /home/pi/op25.sh
    @lxterminal -e /home/pi/dark.sh

    Where the above are my two script files. So now it reboots at 4am and automatically relaunches both programs. Love it!!

    Reply
  11. Kevin E. BEDORE

    I am so happy to find this site and the post comments. I have had varying success in trying to shrink from a laptop running OP25 down to a (semi) headless pi configuration / setup utilizing a battery pack, to have a seriously ready to go portable version of it.

    Basically I want to complete this project with a custom cased Pi3b+ (or less of a Pi if possible) and have a control head (ya the semi headless aspect that might be a bit of contradiction of terms lol) consisting of a {{ 1602 LCD Keypad Shield LCD1602 LCD 1602 Module Display For Arduino ATMEGA328 ATMEGA2560 raspberry pi UNO blue screen}}

    My case can be designed and built easy enough by using our shop laser cutter and 3d printers etc to develop the smallest and yet coolest design I can do of a radio enclosure or even build a ‘dummy radio’ to contain it – the options are limitless and that stuff is the easy part for me. The actual computer stuff is the hard stuff I am new to.

    I want to have the Pi boot immediately into op25 when powered on and the display scrolling TGID info in the limited way it might be able to do on the LCD shield (if even possible). If that isn’t feasible, then even LED(s) indicator(s) of it running would be sufficient. The buttons on the LCD shield would be for S(skip) B(Blacklist) of encrypted and perhaps a power on, off volume etc…

    The LCD shield would be nice because of the onboard buttons, but just as using an LCD function indicator I wouldn’t be opposed to using a few external buttons for Blocking, skipping and power on/off and so on.

    My thinking is portability and keeping it as simple and as physically small as possible.

    Unfortunately I do not have even the slightest idea how to integrate the LCD shield or if not that – the LED(s) and external buttons explained above to accomplish this. I have attempted to understand some similar arrangements done with internet radio Pi projects and what not, but do not see much if anything relating to OP25 control head use (I know in a very limited way) with this kind of arrangement.

    Admittedly I am a noob to most of this stuff but am really enjoying all that I learn. I have almost no coding or programing skill and rely on good tutorials such as this for the small but steady accomplishments I have achieved thus far.

    I pretty well am just copy and paste command line commands and keep trying stuff until it works or not. Usually I end up having to wipe out everything and start over multiple times to get it working. Audio problems of OP25 from laptop down to Pi set-ups seems to be the most common difficulties I have getting OP25 to work and I am hoping the information here might be a better way than what I have played around with so far.

    Furthermore… I have generally had to use a command line not utilizing the trunk information I have tried so many times and failed to get to work too many times to admit.. From Radio Reference, the line I use is:

    (Local Audio) ./rx.py –args ‘rtl’ –gains ‘lna:49’ -f 860.7875e6 -t -q 0 -S 1000000 -D cqpsk -2 -V -U 2> stderr.2

    I would be very pleased if anybody has any thoughts or ideas on how I might be able to accomplish some of the things above and provide any other information, such as how to use my trunk information I cant seem to get working. Thanks for the insights into the audio fixes suggested in this posted comments.

    Sorry that the questions here-in are overlapping, but I think they are relevant and don’t want to begin a specific ‘help me discussion’ for things I suspect are easy and familiar in the knowledge base of those who frequent this site.

    Thank you very much. Sorry if anybody here reading this has a head ache from it running on and on. Its just that I am very excited playing around with this toward my final goal of small and portable op25 receiver.

    Reply
  12. Kevin E. BEDORE

    Today after posting the last message I tried re-installing OP25 on a small net book that I have used for it in the past. I did a fresh install because the frequency in trunk.tsv and my command line which is 139.245 or 139.400 end up appearing as 0.000139 and I thought I had a bug in my program. With the fresh install I am getting the same result. Hitting F and entering the proper frequency results in the program showing TGIDs and playing audio nearly instantly and flawlessly. It just is a pain to have to hit F and enter the frequencies when they appear to be entered correctly in the appropriate spots. Perhaps I am missing something or entering something in error. Obviously if running a ‘semi’ headless auto bootable portable OP25 device is the final aim of my target project the 0.000XXX frequency problem is something that would need to be fixed as a first priority. Anybody know what might be causing this and how it can be fixed. Thanks.

    Reply
  13. Kevin E. BEDORE

    Concerning a previous couple of posts about my command line and trunk.tsv causing the wrong frequency to show when op25 starts and wanting a reliable autostart headless setup..

    I wasn’t noticing that all my attempts at tuning, etc that I inadvertently omitted the e6 from the end of the command line and this was the direct cause of the frequency 139.245mhz having additional zeroes and showing up as 000.139xxx. Getting the e6 back in the command line immediately fixed the problem. No more need to manually enter the frequency.

    Headless operation and auto start was fixed by a friend configuring the op25 on a Rpi3b+ and it works so well that no buttons or visual feedback are even necessary. You simple power it up and it “AUTO-MAGICALLY” works – every time – all of the time.

    Reply

Leave a Reply

Your email address will not be published.