Rail Watch Raspberry Pi Monitoring Software

The Rail Watch Monitoring package (RWMON) for the Raspberry Pi 3 allows the use of Software Defined Radios for direct digital monitoring of ATCS and related signals. It is a complete bootable system with a web based interface for easy setup. Internally, it uses GnuRadio software to receive and digitize multiple channels, and custom software to decode the transmissions. The data packets are then available as an ATCSmon compatible server or can be pitched to an ATCS aggregator, and a copy of received data is sent to the Rail Watch web site. With enough cooling it is possible to run at least 2 SDRs and receive up to 3 or 4 channels total, so you can monitor both MCP and BCP.

LATEST RELEASE 2019-12-21

Since version 2019-12-09: Fixes ATCSmon connection issues. Tested to work on Pi 4.

Improvements since 2019-01 release: now receives Genisys 202, Genisys RFL, and SCS-128 protocols (not tested well), significantly lower CPU usage, Pi 4 support, up to 4 SDRs (if CPU can handle it).

This is a large download (1.1GB) so please only grab it if you plan to use it.

Requirements

You will need

The software has currently only been tested with the NESDR Smart and RTL SDR Blog USB module V3, though it should function with any SDR that has similar capabilities and GnuRadio drivers.

Although both of these SDRs work, in our somewhat limited testing (2017-01), we were able to decode about 2.5-3 times more packets from a distant BCP using the NESDR Smart than the RTL-SDR dongle. It also has a more accurate TCXO and is smaller in size, and the optional mini-antennas are higher quality.

The RWMON software uses a lot of cpu time, so the RPi processor can get very hot. It will automatically slow itself down at around 80C, so it is important to keep it as cool as possible. The small heat sinks often sold in RPi kits won't do much. Get a larger heat sink or a fan.

Setup

Download the RWMON SD card image file and uncompress it (gunzip on unix or 7-zip or similar on Windows). The uncompressed file is about 3GB in size.

Copy it to the SD Card with some image copying software (not copy command). Try Etcher (easiest) or Win32 Disk Imager for Windows. You can use dd on unix systems (dd if=rwpi.img of=/dev/ bs=1M),

Attach Ethernet cable to RPi, insert SD card, attach at least one SDR (or RWMON will not start up) and turn it on. It takes about 1 minute to boot up before you can connect to it with a browser. You can plug in an HDMI monitor if you want to monitor the boot process (and you can attach a keyboard if you want to login on the console). It runs a command line interface only (no GUI).

Networking

RWMON can use the LAN port (eth0) or Wifi (wlan0) or both.

Initially, RWMON sets up Wifi as an Access Point named rwmon. From another device, connect to this network, wifi password rwmonwifi. This is the easiest way to first connect because the Wifi IP address of the RPi will be known (192.168.10.2). Wifi settings can be changed by editing the file /etc/hostapd/hostapd.conf (with Webmin or other methods). If your LAN also uses network 192.168.10, there will be a conflict, so you'll have to connect via Wifi first and edit the hostapd file to pick another number, like 192.168.4.

If you want Wifi to connect to an existing network instead, you will need to do a number of things after getting connected to the system via ssh. First, disable hostapd (Access Point) and dnsmasq (DHCP server) using commands "systemctl disable hostapd" and "systemctl disable dnsmasq"). Then, edit file /etc/wpa_supplicant/wpa_supplicant.conf and add the network ssid and password (see wpa_supplicant docs for info on this file).

For the LAN port, RWMON is initially configured to use DHCP to find a local IP address on your wired network. You'll need to figure out what IP address it was assigned somehow, in order to be able to connect to it. Or use Wifi first, and the DHCP address will show up on the RWMON config page.

If you want to the RPi standalone (such as connected directly to a PC running ATCSmon), or for other reasons, then you may need to set a static IP address in the /etc/network/interfaces file.

System Admininstration

The RWMON system is based on Raspbian Buster (v10) Lite. A web-based system administration tool called Webmin is configured to make using it as easy as possible with little knowledge of Unix systems. To use this tool, just connect to port 10000 with your browser. For example, if the RPi address is 192.168.10.2 then enter https://192.168.10.2:10000 into a browser. Note that Webmin only uses https://

The system has two users set up, pi and root. The passwords are both changeme. You can also use an SSH client (such as Putty) to connect to the RPi and get a command shell if you want.

You can use Webmin to configure your IP address and many other things. Webmin can use quite a bit of CPU time so don't leave it connected if not needed. It can also be very slow the first time starting up as it reads info about the system.

Using RWMON

Connect a browser to the RPi. If via wired ethernet, you need to figure out what address it got. If via Wifi it will be at 192.168.1.2. Wifi may be the easier way to connect initially to discover its assigned wired address. Enter the address into you browser (the RWMON program runs on standard www port 80). There is a single web page that shows you status and lets you configure settings. It should look something like this, and a table will appear for each SDR that is found:

The most important info displayed is the CPU temperature. This needs to remain below 80C for best performance.

Below that you will see a listing of RWMON processes that are running. There is a single GnuRadio python process which is what does the SDR signal processing, and other processes for each channel you are receiving. You will also see a list of available devices and should see a line for each SDR that is connected. Another line will show the settings for eth0 which is the wired network port and will contain the DHCP addressed assigned to the Pi.

For each SDR, enter a frequency you want to receive and check the enable box. Select the protocol. For non-ATCS protocols you must then enter the correct RR#+ZIP+N code. See the monitoring kit for the area you are working with for the correct numbers to use. RR# is the 3-digit Railroad Number. ZIP is a 5-digit zip code, and N is an extra digit in case needed for that zip (usually it is zero). For example, UP is #802, so monitoring zip code 98765 would give you "802987650" to enter in this field. If you leave the RRZIP field zero, the channel won't be monitored. Then, pick the TCP port# to use for connecting to with ATCSmon. Pick a different port# for each channel being monitored.

Hit the Save button at the bottom of the page to reconfigure the software to start receiving those channels. You can refresh the display with the button near the top of the page to see if packet counts are going up.

You can enter specific receive frequencies for up to 6 channels per SDR. The only restriction is that all the frequencies on an SDR must be within 1.152MHz of each other (enough for doing either MCP or BCPs). You can also enable or disable the Frequency Lock Loop (FLL) which automatically tries to adjust the receive frequency to the strongest signal it is picking up (for ATCS only). When receiving a single BCP or MCP the FLL is useful, but when receiving multiple off frequency MCPs it may be better to turn if off.

For each SDR you can also set the gain level, which runs from 0-49. The default value of 33 is fairly high and good for receiving faint signals, but might be too high for stronger ones. If you need to receive both near and far MCP signals you could possibly set up 2 SDRs with different gains. You can also pick any enabled channel for Audio monitoring via the headphone jack on the RPi. Using this option will use up a bit more CPU time.

Once you can see packets being received, the last step is to set up ATCSmon to connect to the RPi on the appropriate port (add each port as a new data source under the ATCSmon Options menu).

If you try to enable too many channels, the system may slow down enough that nothing gets received.

Counters show the number of good packets received, the number with CRC errors, and the percentage of errors of total received. You can try adjusting your setup, frequency or gain values for best reception. Another way to look at error rates (for ATCS protocol only) is to send the data to ATCSmon and look at the sequence error counts.

Using with Pitch

There are additional columns in the configuration display where you can enter info (hostname, port, and ID) for Pitch (used with ATCS Router based aggregators). This sends copies of received packets to the pre-arranged designated host.

Quick Summary

Download the RWMON package

You need to Register and Login to Rail.Watch to see the download link below:

The file is about 1.1GB.

Terms and Conditions

By using this free software, you acknowledge that when possible it will send a copy of any data received to the Rail.Watch web site. You will not disable this feature.

Comments

That's it for now! Please send any corrections or comments.