Home‎ > ‎

Scanner Over IP & Scanner Control Webpage

This page describes some tools and techniques that can be used to implement remote control of a scanner over the internet (scanner over IP).  While there are a number of programs available to stream scanner audio over the internet and even send the alpha tags, there are relatively few solutions available for remotely controlling the scanner.  Those remote control programs that do exist (such as ProScan) generally require a software program to be installed on the remote computer.  The methods described on this page can use a software program on the remote computer or can be used to set up a web interface for scanner control so that remote control can be established from anywhere that an internet connection is available.  The examples shown on this page are geared towards Uniden scanners, but the same thing could be applied to other brands with some coding changes to accommodate the different control protocols.

Caveat #1:  For the sake of simplicity, the examples on this page don't show any strong security. If you implement a system like this, it's strongly recommended to implement authentication and encryption or only allow access via VPN or SSH.

Caveat #2:  Since the remote control methods described on this page are separate from streaming audio, the two will not be synchronized.  Streaming audio is normally delayed due to stream buffering, and this delay can be variable.  Programs that send text tags with the audio embed them within the audio stream so that they are synchronized with the audio.  However, when connecting for remote scanner control the commands and replies are sent independently of the audio, so there is no synchronization of the two.  As an example, if you use the methods on this page to connect to your scanner remotely using Freescan or another program, the text you see on Freescan will not by synchronized with streaming audio from another program, such as Scannercast. 

What I’d recommend is to use Winamp or another audio player to listen to your scanner and provide text tags.  When you want to control the scanner remotely to turn banks on or off, pause the scanner on a specific channel, etc. you can use the methods on this page to do that, and then go back to monitoring via Winamp.

Starting Simple

The most basic configuration for scanner over IP uses a TCP serial port redirector at each end.  On the scanner end, the serial port that the scanner is connected to is redirected to a TCP port.  Anything sent from the scanner to the serial port gets sent out the TCP port and vice versa.  On the remote end, a TCP connection is established with the computer connected to the scanner and any data sent to that TCP port is sent to the serial port and vice versa.  A serial port redirector is used on the remote end to create a virtual serial port that a scanner control program (such as Freescan) can connect to.  Unlike a “real” serial port that is physically connected to a scanner, this virtual serial port is connected to a TCP port that is connected over the internet to the computer attached to the scanner. 

Simple Example

This setup will work if you don’t send alpha tags in your online scanner feed.  However, if you do send alpha tags, a conflict arises since two programs can’t normally share a single serial port.  The program that is streaming audio needs access to the serial port to get the alpha tag information, while the serial port redirector program also needs access to the serial port for obvious reasons.

Sharing a Serial Port

To get around this issue we can use a program called hub4com, which is part of the com0com project.  Using com0com and hub4com together allows us to share a single serial port, with some limitations.  First we set up two virtual serial ports using com0com.  We then use hub4com to link these two virtual serial ports to a single real serial port.  As an example, lets say my scanner is connected to COM1.  I then use com0com to create virtual serial ports COM19 and COM20.  Finally, I use hub4com to link COM19 and COM20 to COM1.  When this is done, any data sent to COM19 will be sent to COM1.  Any data sent into COM1 from the scanner will be sent to both COM19 and COM20.  The one limitation is that any data sent to COM20 will not be sent to COM1.  In other words, COM20 can see data coming from the scanner but it can’t send any data to it. 

Example com0com GUI showing COM19 setup         Example com0com gui showing COM20 setup
Example com0com GUIs showing COM19 and COM20 setups

Here is an example of the hub4com command used at the Windows command prompt to up the port sharing:

hub4com --baud=115200 --ox=on --ix=on \\.\COM1 \\.\CNCB0 \\.\CNCB1

Full Example
com0com and hub4com example

So what good is this?  Don’t we need both programs to be able to send data to the scanner in order for those program to work?  Normally, yes that would be true.  However, there are some tricks we can play to make this useful. 

First some background details.  In order to get alpha tag information from a Uniden scanner, Scannercast periodically sends the “GLG” command to the scanner, and the scanner then responds with talkgroup and frequency information.  As long as Scannercast sees the “GLG” information coming back from the scanner, it’s happy and will send the alpha tag info embedded into the audio stream.

So back to our example.  If Scannercast is connected to COM20, as long as the program on COM19 is requesting and receiving “GLG” information from the scanner, Scannercast will also see that data and can use it.  It doesn’t care that the request is coming from the program on COM19, all it knows is that it’s seeing the “GLG” data show up on COM20 and it’s happy.

So here’s what I did.  I found a sample Python script that acts as a serial port redirect server and modified it so that it constantly sends the “GLG” request out the serial port whenever it’s waiting for a TCP connection from a client.  I've built this script into a Windows EXE called ScanServe.  In my example, this program would connect to COM19.  Whenever it’s not connected to a remote computer, it will send the “GLG” request which will then be sent to COM1.  The scanner (on COM1) will receive the “GLG” request and respond with the data, which will be sent to both COM19 and COM20.  Scannercast (on COM20) will get the data and use it for alpha tagging.  When a remote connection is made through the TCP port the program stops sending the “GLG” request and instead sends whatever data is received via the TCP connection.  Once the TCP connection is disconnected or times out, the program resumes sending the “GLG” commands.  To start the program I use this command:

On the remote side

So far we’ve been concentrating on the software and setup on the scanner side of the link.  On the remote side, we can use com0com and hub4com and tcp4com to create a virtual serial port and a serial port to tcp client that connects to the server program described above.   Our scanner control program (such as Freescan, etc.) can then connect to this virtual serial port, whose traffic is redirected over the TCP connection to the scanner

Web Page Control

As an alternative, we can set up a web page that uses a PHP script to connect to the server program.  This would allow us to control the scanner from any computer that has internet access, not just one that has a scanner program, com0com, and tcp4com installed.

Web Page Example

This web page can be hosted by a commercial hosting service, or you can host it on your home PC by using a PHP-enabled hosting server such as WampServer.

I've included some sample HTML and PHP files that should get you started on implementing this.  As was mentioned above, there isn't a lot of security built in, so use caution.  You probably don't want someone to be able to reset your scanner to factory defaults over the web!

This sample web page and PHP script periodically sends the "STS" command to the remote scanner to get the screen display information, which it then displays on the web page.  There are also a bunch of buttons on the web page that will send the corresponding button press command to the remote scanner.  It's fairly simple, but allows you to remotely stop and start scanning, enable or disable banks, etc.