Category Archives: scanner

UniTrunker Automated File Merge

I’ve put together some tools to analyze UniTrunker data.  The details can be found here: UniTrunker file merge.

These tools are great, but fairly labor-intensive. So in an effort to automate the process and spend more time viewing the files and less time processing them, I recompiled the merging program and wrote a Linux script to do the work.

This processing could be done on a Windows machine using scripts and tools there, but I decided that I’d rather work in Linux for file viewing and processing.  This leaves my Windows machines to run  UniTrunker and create the logfiles, and my Linux machine to copy that logfiles and do the processing.

There are a few manual tasks that I had to perform initially.  These include:

1. Export the system.xml file from UniTrunker and run either msxsl.exe or xslproc to extract group and user information into a .txt file.
2. Set up the folders and file hierarchy in advance
3. Mount the shared file location of the UniTrunker-logfile on the Windows computer

Once these tasks were done, I created a script for each system I was going to export and a cron job to run them each night shortly after midnight after UniTrunker had created and zipped the daily logfiles.

A link to the Linux version of UTC to merge logfiles with user and group data can be found here: UTC file

An example of the script I created:
utcopyexample.sh

!/bin/bash
datestring=$(date +%Y%m%d)
yesterday=$(date --date="yesterday" +%Y%m%d)
yearmonth=$(date --date="yesterday" +%Y%m)
processfile=~/your/path/here/$yearmonth/SystemName/UTM$yesterday.txt
processpath=/your/path/here/$yearmonth/SystemName/
filestring=UniTrunker-$yesterday.log.Z #Name of logfile created by UniTrunker
filestring2=UT$yesterday.log.Z #Shorten filename for ease
#Copy logfile from Windows machine to Linux machine for unzipping:
cp /mnt/nameofwindows/computerRunning/unitrunker/S00000031/$filestring ~/Documents/UTSort/raw/$filestring2
gunzip /home/parallels/Documents/UTSort/raw/UT$yesterday.log.Z #unzip logfile
#Move unzipped file to log storage location:
mv /home/parallels/Documents/UTSort/raw/UT$yesterday.log /home/parallels/Documents/UTSort/$yearmonth/Davis/UT$yesterday.log
#Run UTC sort/merging program to add user names and group names to logfile in addition to UID and GID numbers
#Note: Prior to running this script, it is necessary to export the System.xml file in UT and then run MSXSL.exe in Windows
#or xsltproc in Linux to create users.txt and a groups.txt files to be used by the UTC sort/merging program
UTC /your/path/here/$yearmonth/SystemName/UT$yesterday.log /your/path/here/users.txt /your/path/here/groups.txt $processfile
#Below are examples of searches/sorts that I do on the logfiles to sort via talkgroups or users or find unknowns.
#Place your talkgroup IDs or search terms in the field after grep and create folders and change filenames to be relevant
#to your local groups and users:
more $processfile | grep ,X | grep -v XP >${processpath}/WXPD/WXPD$yesterday.txt #WX PD
more $processfile | grep 10816 >${processpath}/Ops5/Ops5$yesterday.txt #Davis County Ops 5
more $processfile | grep 10848 >${processpath}/Ops6/Ops6$yesterday.txt #Davis County Ops 6
more $processfile | grep 8544 >${processpath}/BountPD1/BountPD1$yesterday.txt #Bountiful PD 1
more $processfile | grep '9440\|9408' >${processpath}/DavisLaw/DavisLaw$yesterday.txt #Davis Law 1 and 2
more $processfile | grep 9952 >${processpath}/DavisService/DavisService$yesterday.txt #Davis Service
more $processfile | grep 17600 >${processpath}/NRegional/NRegional$yesterday.txt #Northern Regional
more $processfile | grep 18464 >${processpath}/Event2/Event2$yesterday.txt #Event 2
more $processfile | grep  ', ,G' >>${processpath}/Unknown/DavisUnknown$yearmonth.txt  #unknown users
more $processfile | grep 'G,.*, ,'>>${processpath}/Unknown/DavisUnknownTGID$yearmonth.txt #unknown talkgroups
sort -u -t, -k8,8 ${processpath}/Unknown/SLCUnknownTGID$yearmonth.txt | cut -d, -f8 | sort -n>${processpath}/Unknown/SLCUnknownTGIDSorted$yearmonth.txt #List unknown TGID numbers
sort -u -t, -k5,5 ${processpath}/Unknown/SLCUnknownUID$yearmonth.txt | cut -d, -f5 |sort -n>${processpath}/Unknown/SLCUnknownUIDSorted$yearmonth.txt #List unknown UID numbers

If you’re interested in compiling the UTC program yourself, email me and I’ll get you the source code.

Python Script to Update Icecast Metadata With METAR and TAF Data

Python Script to Update Icecast Aviation Audio Feeds with METAR and TAF Data

Here are two scripts to retrieve airport METAR and TAF data from the National Weather Service website and then send this data to an Icecast server to update stream metadata.

You can get the scripts here (use wget from a Linux command line):

http://www.k7bbr.net/files/imetarkslcExample.py
http://www.k7bbr.net/files/itafkslcExample.py

Save them with whatever names you’d like (probably imetar[AirportName].py). In each script enter the server/stream information and modify the script to download your desired station name. Then run a cron job every hour (or whatever interval you choose) to update your stream metadata with the airport METAR and TAF data.

BC890XLT Discriminator Tap

 

BC890XLT Discriminator Tap

Last week I bought a used Uniden BC890XLT scanner and added a discriminator audio tap.  Here’s how I did it:
The first thing to do was open the case.  The outer sleeves come apart on the top and the bottom.  There are 2 screws on each side and one screw on the back that I removed.  I took both the top and bottom sleeves off to explore the inside, and discovered I only needed to remove the top to tap the discriminator audio.  Once inside I found the location of the discriminator audio which is pin #10 of IC #3, 3359DA.  Pin #10 is on the top right corner of the chip:

Rather than solder to the chip, I preferred to solder to the lead to the resistor at TP3 which is connected directly to PIN #10 of the IC.  I put a 10K ohm resistor in series with a 10 Î¼F tantalum capacitor. 

I wanted this modification to be removable so I didn’t drill a hole in the case. Rather, I ran a connected wire to the outside of the case through an opening in the side of the case. 


I then ran the wire in the space between the case and the outer sleeve on the side.  I then ran it around the corner to the back of the scanner.  I connected the ground wire to the chassis via the screw that holds the accessory RCA jack.  I put heat shrink tubing on the outside of the wires and connected them to a 1/8″ mono phone jack.  

Radio Shack Part Numbers:
1/4-Watt 10K ohm resistors – #271-1335
10μF Tantalum Capacitor – #272-1436
1/8″ Mono In-line Phone Jack – #274-0333
Assorted Heat Shrink Tubes – #278-1627

Bash Script to Download TAF Data From NWS

Linux Bash Script to Download TAF Data from the NWS to Display in the Console

 

Usage:
taf [ICAO STATION ID]
Example: $taf kslc

Save the following in a file called taf:

#!/bin/bash
station=$(echo "$1" | tr '[:lower:]' '[:upper:]')
wget -q -O /home/$USER/taftmp http://weather.noaa.gov/pub/data/forecasts/taf/stations/$station.TXT
echo " "
more /home/$USER/taftmp
echo " "
rm /home/$USER/taftmp

Maxtroller and Maxduino

After learning about the Arduino microcontroller and hearing how it had been used to turn an old Motorola Maxtrac radio into a trunking scanner, I wanted to try it out for myself.  It’s a project that combines both hardware and software aspects.  I would have an opportunity to practice my soldering skills as well as some programming skills.  It had been years since I took a C programming class in college, so I was looking forward to dusting off some of the things I learned.
 

Instructions for the project written by GroundLoop can be found here:

Instructions Update
Original Unmodified Code
Code Modified to Use Maxtroller Squelch
Code for Maxtroller Discrimator Audio Parking

I won’t repeat these instructions here since they are well-written. There were a few differences between my 5-pin Maxtrac radios and the 16-pin Maxtrac radios used in the instructions, but the differences were resolved by comparing my radio’s board and the pictures of the16-pin’s board.  The biggest software change I made was to wire the CSQ “squelch” circuit to the Arduino and use it to mute and unmute the Maxtrac.  Without this change I was getting very long squelch tails (up to 2 seconds) that were fairly intolerable.  Now the squelch tail is fairly tight and a lot less noticeable.

For my first attempt at building the Maxdunio, I crudely cut a slot in the back of the radio and ran the wires out to the Arduino.  The second time I placed an RJ-45 jack in the side of the front cover next to the speaker.  This allowed for an easy, clean connection to the Arduino or my homebuilt Maxtroller with an ethernet cable.

The original intent of the Arduino code is to interface the Arduino with Unitrunker software to receive tuning commands, process them, and forward them to the Maxtrac.  I also wanted to be able to manually tune an second Maxtrac with an Arduino and use it to feed discriminator audio to my PC and Unitrunker software.  In order to do this I built a small box using a Radio Shack project box.  It allows me to press a button and toggle through various control channel frequencies and output the audio from the Maxtrac to my computer.  I modified the Arduino code to not look for external tuning commands from Unitrunker, but cycle through a set of predefined frequencies when a button is pushed.

Here is the base of my Maxtroller box with a Radio Shack “Dual General-Purpose IC PC Board.”  I used this for both the button circuit and the discriminator audio circuit to add a resistor and capacitor inline with the audio.  

 

For the connection between the Maxtrac and the Arduino I used an ethernet cable.  It was readily available, contained just the right number of wires, and was a neat solution which allowed for easily connecting and disconnecting the box and radio.  Since this box is a stand-alone box without need to interface with the computer, I mounted the Arduino with the USB connection away from the edge of the box for ease of fitting.  A 9v battery fits underneath the Arduino for power.  Since this photo was taken, I have added an external power jack through the side of the box.

Here is my completed “Maxtroller”with the controller box connected to the Maxtrac via ethernet cable. The discriminator audio passes through an onboard resistor and capacitor and out of the box via a mini audio jack.

 

This was a fun project to put together.  I had frustrations and success in making both the hardware and software work.  I love having the capabilities of an expensive scanner wrapped in a couple of very inexpensive business radios and a couple of microcontrollers.  The audio of the Maxtracs is superior to my other scanners.  And the ability to prioritize talkgroups in Unitrunker provides a lot of functionality in monitoring.
 
Radio Shack Parts List:
 
Project enclosure 5×2.5×2 – #270-1803
Dual general-purpose IC PC board – #276-159
1/4-watt 10K ohm resistors – #271-1335
10 μF tantalum capacitor -#272-1436
Size M panel-mount power jack – #274-1582
1/8″ Mono panel-mount audio jack – #274-251
Metal standoffs – #276-195
Push button – #275-1566
9v snap connectors – #270-324