130 Home
Mark Jessop edytuje tę stronę 2024-01-31 16:42:27 +10:30

auto_rx logo

radiosonde_auto_rx - Automatic Radiosonde Receiver Utilities

Last Updated: 2024-01-31

This project is built around rs1279's RS demodulators, and provides a set of utilities ('auto_rx') to allow automatic reception and uploading of Radiosonde positions to multiple services, including:

Auto-RX's Web Interface provides a way of seeing the live status of your station, and also a means of reviewing and analysing previous radiosonde flights. Collected meteorological data can be plotted in the common 'Skew-T' format.

Radiosonde Support Matrix

Manufacturer Model Position Temperature Humidity Pressure XDATA
Vaisala RS92-SGP/NGP ✔️ ✔️ ✔️ ✔️ ✔️
Vaisala RS41-SG/SGP/SGM ✔️ ✔️ ✔️ ✔️ (for -SGP) ✔️
Graw DFM06/09/17 ✔️ ✔️ ✔️
Meteomodem M10 ✔️ ✔️ ✔️ Not Sent
Meteomodem M20 ✔️ ✔️ ✔️ ✔️ (For some models)
Intermet Systems iMet-4 ✔️ ✔️ ✔️ ✔️ ✔️
Intermet Systems iMet-54 ✔️ ✔️ ✔️ Not Sent
Lockheed Martin LMS6-400/1680 ✔️ Not Sent
Meisei iMS-100 ✔️ ✔️ ✔️ Not Sent
Meisei RS11G ✔️ Not Sent
Meteo-Radiy MRZ-H1 (400 MHz) ✔️ ✔️ ✔️ Not Sent
Meteosis MTS01 ✔️ ✔️ Not Sent
Weathex WxR-301D ✔️ Not Sent

Support for other radiosondes may be added as required - please send us sondes to test with! If you have any information about telemetry formats, we'd love to hear from you (see our contact details below).

Improvements from the upstream RS codebase will be merged into this codebase when/where appropriate. A big thanks to rs1729 for continuing to develop and improve these decoders, and working with us to make auto_rx decode all the radiosondes!

Updates

This software is under regular development. Please update regularly to get bug-fixes and improvements!

Please consider joining the Google Group to receive updates on new software features: https://groups.google.com/forum/#!forum/radiosonde_auto_rx

Presentations

Contacts

Licensing Information

All software within this repository is licensed under the GNU General Public License v3. Refer this repositories LICENSE file for the full license text.

Radiosonde telemetry data captured via this software and uploaded into the Sondehub Database system is licensed under Creative Commons BY-SA v2.0. Telemetry data uploaded into the APRS-IS network is generally considered to be released into the public domain.

By uploading data into these systems (by enabling the relevant uploaders within the station.cfg file) you as the user agree for your data to be made available under these licenses. Note that uploading to Sondehub is enabled by default.

Setup Guide

1. General Theory of Operation

This software performs the following steps:

  1. Use rtl_power to scan across a user-defined frequency range, and detect peaks in the spectrum.
  2. For each detected peak frequency, run the rs_detect utility, which determines if a radiosonde signal is present, and what type it is. This detection is performed using correlation, and will detect a sonde many dB below the threshold where a decode is possible.
  3. If a radiosonde signal is found, start demodulating it, and upload data to various internet services.
  4. If no peaks are found, or if no packets are heard from the radiosonde in a given amount of time (3 minutes by default), go back to step 1.

The latest versions can make use of multiple RTLSDRs to allow for tracking of many radiosondes simultaneously. The number of simultaneous radiosondes you can track is limited only by the number of RTLSDRs you have setup!

It is also possible to connect auto_rx to an AirSpy SpyServer, allowing decoding of all radiosonde within the SpyServer's reception bandwidth. Refer here for more information.

By running auto_rx continuously, not just at known radiosonde launch times, you may see other radiosonde launches (military or otherwise) that would otherwise go un-noticed. Here in Australia, we discovered the Bureau of Meteorology's Ozone sounding schedule this way (which was later confirmed by the Bureau - thanks guys!).

2. Hardware Requirements

  • Ideally, a standalone single-board computer (Raspberry Pi 3 or newer, ODroid, etc...) to run the software. Other Linux machines will also work. It has been reported to work under WSL, though I cannot provide any support for this.
  • A RTLSDR receiver, or the SpyServer software connected to an AirSpy Mini/R2.
    • A receiver with a TCXO is mandatory, and you must make sure the PPM offset value is set correctly (see here). The demodulators are quite sensitive to frequency offsets, and the warm-up drift of the non-TCXO RTLSDRs is enough to throw it off. I've had great success with the RTL-SDR.com 'v3' dongles. The NooElec SMArt dongles (with the TCXO option) are also good.
  • An antenna suitable for receiving on 400-406 MHz (a basic 1/4 wave monopole is usually good enough). If you have an 70cm amateur-band antenna, that will probably work fine too.
  • For optimal receive performance, a preamplifier and a band-pass filter, like this one. You can still achieve pretty good results without one.
  • For those in the US trying to receive 1680 MHz LMS6 sondes, a higher gain antenna (short helical) and a preamp is required.

3. Setup & Configuration - Docker

Probably the easiest way to get auto_rx going is using Docker - A guide on setting up using Docker is available here: https://github.com/projecthorus/radiosonde_auto_rx/wiki/Docker

If you want to run auto_rx 'natively', then continue on with the guide below.

4. Setup & Configuration - 'Native'

This section is intended to assist with setup under a fresh Raspbian installation (Raspbian Bullseye or newer). The instructions should be usable on other Debian-based systems, noting that we require at least Python 3.6.

For an excellent guide on setting up a 'headless' (no display) Raspberry Pi, look here. The Raspberry Pi Foundation's Guide is also very good.

4.1. Software Dependencies

Update your system, then install the required dependencies using:

$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install python3 python3-venv sox git build-essential libtool cmake usbutils libusb-1.0-0-dev rng-tools libsamplerate-dev libatlas3-base libgfortran5 libopenblas-dev

If you are running Raspbian Bookworm, you may be affected by a known bug with the Linux v6.1 kernel which will cause RTLSDR issues. You can get around this problem by updating the kernel, then rebooting:

$ sudo apt install rpi-update
$ sudo rpi-update

4.2. RTL-SDR Utilities

As we may we wish to use the bias-tee option in the newer v3 RTLSDRs, we need a fairly recent version of the rtl-sdr software. Recent ubuntu distributions provide this support in the rtl-sdr package (package version 0.5.3-12 or newer), and as of 2020, Raspbian supports it too!

WARNING: For RTLSDR v4 support you will likely need to compile the RTL-SDR drivers from source. Refer below.

WARNING: There is a known issue with Raspbian running Kernel version 5.10, and the latest Raspbian-supplied rtl-sdr package (v0.6-1), where rtl_fm uses far more CPU than it should. This can be identified by running 'top' while auto_rx is running. If this affects your station, you should compile rtl_sdr from source using the instructions below.

This means that you can probably just install the rtl-sdr utilities by running:

$ sudo apt-get install rtl-sdr

If you install via the system package manager, then most likely the required udev rules (which enable the pi user to access the RTLSDR) will not NOT have been installed (... sigh). To install these, run:

$ sudo wget -O /etc/udev/rules.d/20-rtlsdr.rules https://raw.githubusercontent.com/osmocom/rtl-sdr/master/rtl-sdr.rules

Then, reboot the RPi.

4.2.1 Installing rtl-sdr from source (if required)

If your package manager's version of rtl-sdr does not provide bias-tee support (no -T option), then you will need to compile from source.

IMPORTANT NOTE: Make sure to remove any installations of rtl-sdr already on your system before compiling/installing from source. (i.e. sudo apt-get remove rtl-sdr librtlsdr0 librtlsdr-dev

$ git clone https://github.com/steve-m/librtlsdr.git
$ cd librtlsdr
$ mkdir build
$ cd build
$ cmake -DINSTALL_UDEV_RULES=ON -DDETACH_KERNEL_DRIVER=ON ../
$ sudo make install
$ sudo ldconfig

4.2.2 RTL-DVB Kernel Module Blacklisting

Because the kernel rtl_dvb driver (yes, these SDRs can be used to watch TV after all) will inhibit our intended use, we need to blacklist a few kernel modules.

If you installed rtl-sdr from source as above, then a blacklist file should have already been installed, otherwise create a new module blacklist file using:

$ sudo nano /etc/modprobe.d/rtlsdr-blacklist.conf

and add the lines:

blacklist dvb_usb_rtl28xxu
blacklist rtl2832
blacklist rtl2830
blacklist dvb_usb_rtl2832u
blacklist dvb_usb_v2
blacklist dvb_core

Save the file (Ctrl+x, y), and reboot the Raspberry Pi.

4.2.3 - Check your RTLSDRs are working!

At this point it is worth checking that you can communicate with your RTLSDR, which can be achieved by running:

$ rtl_test

Found 1 device(s):
  0:  Realtek, RTL2838UHIDIR, SN: 00000002

Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
Supported gain values (29): 0.0 0.9 1.4 2.7 3.7 7.7 8.7 12.5 14.4 15.7 16.6 19.7 20.7 22.9 25.4 28.0 29.7 32.8 33.8 36.4 37.2 38.6 40.2 42.1 43.4 43.9 44.5 48.0 49.6
[R82XX] PLL not locked!
Sampling at 2048000 S/s.

Info: This tool will continuously read from the device, and report if
samples get lost. If you observe no further output, everything is fine.

Reading samples in async mode...

Hit Ctrl+C to kill rtl_test. If you see lots of warnings such as lost at least <X> bytes, this indicates USB bandwidth issues, or some other issue with the RTLSDR. One or two lines of this is normal.

4.3. Cloning & Configuring the Radiosonde Auto RX Repository

From your home directory, run:

$ git clone https://github.com/projecthorus/radiosonde_auto_rx.git
$ cd radiosonde_auto_rx/auto_rx
$ ./build.sh
$ cp station.cfg.example station.cfg

Edit station.cfg (i.e. nano station.cfg) and modify the settings as required. For detailed information on configuration settings, please read through the Configuration Settings page.

Note that after major updates, you will usually need to re-copy the station.cfg.example file, as new options will have been added.

4.4. Setting up a Python Virtual Environment

We now need to get all the Python packages we need to run auto_rx. We will be setting up a Python Virtual Environment ('venv') to do this, to avoid 'polluting' system-wide packages.

The following commands need to be run within the ~/radiosonde_auto_rx/auto_rx directory:

$ cd ~/radiosonde_auto_rx/auto_rx/
$ python3 -m venv venv
$ source venv/bin/activate
(venv) $ pip install -r requirements.txt

A few warnings may be shown while pip does it's thing. The packages we need should still be installed however.

From now on, before attempting to run any auto_rx Python scripts, ensure you are operating within the Virtual Environment we just created. You can confirm this by running:

$ cd ~/radiosonde_auto_rx/auto_rx/
$ source venv/bin/activate

Your terminal should have a (venv) prefix, which indicates you are operating within the venv.

4.5. Initial Testing

To check everything is operational, start up the automatic receiver script using:

(from within radiosonde_auto_rx/auto_rx, and within the virtual environment we just setup)
(venv) $ python3 auto_rx.py

Depending on how you have configured the software, you should see output similar to the following:

2023-10-27 03:55:19,173 INFO:Reading configuration file...
2023-10-27 03:55:19,180 WARNING:Config - Web Password not set, disabling web control
2023-10-27 03:55:21,016 INFO:Config - Tested RTLSDR #0 OK
2023-10-27 03:55:21,017 INFO:Started Flask server on http://0.0.0.0:5000
2023-10-27 03:55:21,019 INFO:Telemetry Logger - Started Telemetry Logger Thread.
2023-10-27 03:55:21,020 INFO:OziMux - Started OziMux / Payload Summary Exporter
2023-10-27 03:55:21,021 INFO:Sondehub Uploader - Started Sondehub Uploader Thread.
2023-10-27 03:55:22,227 INFO:Version - Local Version: 1.7.1 - Up to date!
2023-10-27 03:55:22,228 INFO:Task Manager - SDR #0 has been allocated to Scanner.
2023-10-27 03:55:22,317 INFO:Sondehub Uploader - Uploaded station information to Sondehub.
2023-10-27 03:55:24,080 INFO:Scanner (RTLSDR 0) - Starting Scanner Thread
2023-10-27 03:55:24,082 INFO:Scanner (RTLSDR 0) - Running frequency scan.

This indicates that the software is successfully scanning for radiosondes. The rest of the functionality can only easily be tested with a signal from a radiosonde. These are launched at around 11:15Z and 23:15Z at most major airports around the world.

When a sonde is found, the following output will be seen:

2023-10-27 03:55:44,141 INFO:Scanner (RTLSDR 0) - Detected peaks on 10 frequencies (MHz): [401.5  400.62 400.61 401.33 400.24 400.25 401.32 400.43 400.41 402.57]
2023-10-27 03:55:46,082 INFO:Task Manager - Detected new RS41 sonde on 401.501 MHz!
2023-10-27 03:55:46,083 INFO:Halting Scanner to decode detected radiosonde.
2023-10-27 03:55:46,083 INFO:Scanner (RTLSDR 0) - Waiting for current scan to finish...
2023-10-27 03:55:52,386 INFO:Scanner (RTLSDR 0) - Scanner Thread Closed.
2023-10-27 03:55:52,387 INFO:Task Manager - SDR #0 has been allocated to Decoder (RS41, 401.501 MHz).
2023-10-27 03:55:54,236 INFO:Decoder (RTLSDR 0) RS41 401.501 - Using fsk_demod decoder chain.
2023-10-27 03:55:54,269 INFO:Decoder (RTLSDR 0) RS41 401.501 - Starting decoder subprocess.
2023-10-27 03:55:58,530 INFO:Telemetry Logger - Opening new log file: /home/pi/radiosonde_auto_rx/auto_rx/log/20231027-025558_S5030935_RS41_401501_sonde.log
...

Depending on what exporter options have been enabled (SondeHub, APRS, ChaseMapper), you will see indications when telemetry has been uploaded. If no exporters are enabled, you will only see telemetry information with the 'verbose' logging option enabled (-v).

A web interface which displays the log information as above, along with a sonde position map and frequency scan output, is available on port 5000, i.e. http://localhost:5000/ (Or replace localhost with your RPi's IP address if accessing from another computer).

To shut-down the automatic reception script hit Ctrl-C, and the threads will eventually close.

When a Radiosonde is successfully detected, a log-file will be created in the auto_rx/log/ directory, containing the telemetry for that flight.

4.5. Automatic / Continuous Operation via systemd

It's highly recommended that you run auto_rx in a 'continuous' mode, running as a systemd service.

To set this up, the auto_rx.service file (located in radiosonde_auto_rx/auto_rx) must be edited to include your username, and the path to this directory.

$ sudo cp auto_rx.service /etc/systemd/system/
$ sudo nano /etc/systemd/system/auto_rx.service

If you are not running auto_rx as the 'pi' user, you will need to edit the auto_rx.service file and modify the ExecStart, WorkingDirectory and User fields. Otherwise, leave all settings at their defaults.

Note - As of November 2023, the systemd file has been updated to use the Python virtual environment created in previous steps.

[Unit]
Description=auto_rx
After=syslog.target

[Service]
# For running outside of a python virtual environment
# ExecStart=/usr/bin/python3 /home/pi/radiosonde_auto_rx/auto_rx/auto_rx.py -t 0 

# For running within a venv, located at /home/pi/radiosonde_auto_rx/auto_rx/venv/
ExecStart=/home/pi/radiosonde_auto_rx/auto_rx/venv/bin/python3 /home/pi/radiosonde_auto_rx/auto_rx/auto_rx.py -t 0
Restart=always
RestartSec=120
WorkingDirectory=/home/pi/radiosonde_auto_rx/auto_rx/
User=pi
SyslogIdentifier=auto_rx

[Install]
WantedBy=multi-user.target

If you are behind a proxy server, then you can add the following lines into the [Service] section to use it:

Environment=HTTP_PROXY=http://your.proxy.here:8080
Environment=HTTPS_PROXY=http://your.proxy.here:8080

Once/if edited, install and start the service using:

$ sudo systemctl enable auto_rx.service
$ sudo systemctl start auto_rx.service

You can check on the status of the service by running:

$ sudo systemctl status auto_rx.service
● auto_rx.service - auto_rx
     Loaded: loaded (/etc/systemd/system/auto_rx.service; enabled; preset: enabled)
     Active: active (running) since Fri 2023-10-27 04:15:02 BST; 2min 28s ago
   Main PID: 1188 (python3)
      Tasks: 26 (limit: 1585)
        CPU: 25.236s
     CGroup: /system.slice/auto_rx.service
             ├─1188 /home/pi/radiosonde_auto_rx/auto_rx/venv/bin/python3 /home/pi/radiosonde_auto_rx/auto_rx/auto_rx.py -t 0
             ├─1313 /bin/sh -c "rtl_fm -M raw -F9 -p 0 -d 0 -s 48000 -f 401501000 - 2>/dev/null | ./iq_dec --bo 16 - 48000 16 2>/dev/null |./fsk_demod --cs16 ->
             ├─1315 rtl_fm -M raw -F9 -p 0 -d 0 -s 48000 -f 401501000 -
             ├─1316 ./iq_dec --bo 16 - 48000 16
             ├─1317 ./fsk_demod --cs16 -b -10000 -u 10000 -s --stats=5 2 48000 4800 - -
             ├─1319 /bin/sh -c "./rs41mod --ptu2 --json --jsnsubfrm1 --softin -i  2>/dev/null"
             └─1322 ./rs41mod --ptu2 --json --jsnsubfrm1 --softin -i

Oct 27 04:15:29 airspy2 auto_rx[1188]: 2023-10-27 04:15:29,214 INFO:Scanner (RTLSDR 0) - Detected peaks on 9 frequencies (MHz): [401.5  401.51 401.48 401.52 40>
Oct 27 04:15:32 airspy2 auto_rx[1188]: 2023-10-27 04:15:32,401 INFO:Task Manager - Detected new RS41 sonde on 401.501 MHz!
Oct 27 04:15:32 airspy2 auto_rx[1188]: 2023-10-27 04:15:32,402 INFO:Halting Scanner to decode detected radiosonde.
... other log lines here.

The log output can be viewed by running:

$ sudo journalctl -u auto_rx.service -f -n

To stop the service, simply run:

$ sudo systemctl stop auto_rx.service

You can also completely disable the service by then running:

$ sudo systemctl disable auto_rx.service

5 - Updates

Check the releases page occasionally for information on new updates to the software. Refer to this page for information on how to perform updates to auto_rx.

Sometimes we will block telemetry uploads to SondeHub from older versions, to avoid causing issues when we change things like uploaded telemetry formats.