Updated Home (markdown)

master
Mark Jessop 2023-10-27 14:01:34 +10:30
rodzic 1e050af521
commit e32c6ec523
1 zmienionych plików z 84 dodań i 71 usunięć

155
Home.md

@ -5,7 +5,7 @@
This project is built around [rs1279's RS](https://github.com/rs1729/RS) demodulators, and provides a set of utilities ('auto_rx') to allow automatic reception and uploading of [Radiosonde](https://en.wikipedia.org/wiki/Radiosonde) positions to multiple services, including:
* The [SondeHub Radiosonde Tracker](https://tracker.sondehub.org) - a tracking website specifically designed for tracking radiosondes!
* APRS-IS, for display on sites such as [radiosondy.info](https://radiosondy.info). (Note that aprs.fi now blocks radiosonde traffic.)
* APRS-IS, for display on sites such as [radiosondy.info](https://radiosondy.info) and [wettersonde.net](https://www.wettersonde.net/). (Note that aprs.fi now blocks radiosonde traffic.)
* [ChaseMapper](https://github.com/projecthorus/chasemapper) for mobile
radiosonde chasing.
@ -43,6 +43,7 @@ https://groups.google.com/forum/#!forum/radiosonde_auto_rx
## Presentations
* Linux.conf.au 2019 - https://www.youtube.com/watch?v=YBy-bXEWZeM
* UKHAS Conference 2019 - [Presented via Skype](https://youtu.be/azDJmMywBgw?t=643) which had some audio issues at the start. Slides [here](https://rfhead.net/sondes/auto_rx_presentation_UKHAS2019.pdf).
* Tracking Radiosondes for Fun and No Profit - https://www.youtube.com/watch?v=fb9gNomWrAY
## Contacts
* [Mark Jessop](https://github.com/darksidelemm) - vk5qi@rfhead.net
@ -85,18 +86,22 @@ Probably the easiest way to get auto_rx going is using Docker - A guide on setti
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 Buster or newer). The instructions should be usable on other Debian-based systems, noting that we require at least Python 3.6.
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.
**WARNING - These instructions will have some issues on Raspbian/Debian Bookworm, due to new policies on installing system-wide Python packages. An updated version of this document is in the works...(2023-10-23)**
For a good guide on setting up a 'headless' (no display) Raspberry Pi, [look here](https://www.tomshardware.com/reviews/raspberry-pi-headless-setup-how-to,6028.html).
For an excellent guide on setting up a 'headless' (no display) Raspberry Pi, [look here](https://www.tomshardware.com/reviews/raspberry-pi-headless-setup-how-to,6028.html).
### 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-numpy python3-setuptools python3-crcmod python3-requests python3-dateutil python3-pip sox git build-essential libtool cmake usbutils libusb-1.0-0-dev rng-tools libsamplerate-dev libatlas3-base libgfortran5
$ 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
```
If you are running Raspbian Bookworm, you may be affected by [a known bug](https://www.rtl-sdr.com/raspberry-pi-4-usb-bug-experienced-with-rtl-sdrs-now-fixed-with-kernel-update/) 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
@ -171,7 +176,7 @@ 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 are usually OK...
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:
@ -186,56 +191,63 @@ Edit station.cfg (i.e. `nano station.cfg`) and modify the settings as required.
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. Python Dependencies
We now need to grab a few additional packages using Pip.
(This needs to be run from within the auto_rx directory we just cd'd into before)
```
$ sudo pip3 install -r requirements.txt
```
A few errors may be shown while pip does it's thing. The packages we need should still be installed however.
### 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](https://docs.python.org/3/library/venv.html) ('venv') to do this, to avoid 'polluting' system-wide packages.
**WARNING: This command will result in an error on Debian/Raspbian Bookworm. You may be able to get around this error by adding --break-system-packages to the command, though this is untested and may cause other issues.**
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.
### 4.4. Initial Testing
**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)
$ python3 auto_rx.py
(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:
```
2020-12-09 09:02:57,021 INFO:Reading configuration file...
2020-12-09 09:03:00,347 INFO:Config - Tested SDR #0 OK
2020-12-09 09:03:00,353 INFO:Started Flask server on http://0.0.0.0:5000
* Serving Flask app "autorx.web" (lazy loading)
2020-12-09 09:03:00,356 INFO:Telemetry Logger - Started Telemetry Logger Thread.
* Environment: production
WARNING: Do not use the development server in a production environment.
Use a production WSGI server instead.
2020-12-09 09:03:00,358 INFO:OziMux - Started OziMux / Payload Summary Exporter
* Debug mode: off
2020-12-09 09:03:00,830 INFO:Version - Local Version: 1.3.2 Current Master Version: 1.3.2
2020-12-09 09:03:00,831 INFO:Task Manager - SDR #0 has been allocated to Scanner.
2020-12-09 09:03:04,102 INFO:Scanner #0 - Starting Scanner Thread
2020-12-09 09:03:04,112 INFO:Scanner #0 - Running frequency scan.
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:
```
2018-06-01 21:56:12,077 INFO:Scanner #0 - Detected peaks on 1 frequencies (MHz): [402.5]
2018-06-01 21:56:17,521 INFO:Detected new RS41 sonde on 402.500 MHz!
2018-06-01 21:56:17,521 INFO:Halting Scanner to decode detected radiosonde.
2018-06-01 21:56:17,521 INFO:Scanner #0 - Waiting for current scan to finish...
2018-06-01 21:56:25,686 INFO:Scanner #0 - Scanner Thread Closed.
2018-06-01 21:56:25,687 INFO:SDR #0 has been allocated to Decoder (RS41, 402.500 MHz).
2018-06-01 21:56:27,556 INFO:Decoder #0 RS41 402.500 - Starting decoder subprocess.
2018-06-01 21:56:30,868 INFO:Telemetry Logger - Opening new log file: ./log/20180601-113422_N3740572_RS41_402500_sonde.log
2018-06-01 21:56:37,172 INFO:Habitat - Listener information uploaded.
2018-06-01 21:56:41,747 INFO:APRS-IS - Uploaded to APRS-IS: ;N3740572 *111111z3509.05S/13854.80EO116/046/A=053079 RS41 Radiosonde 402.500 MHz 5.2m/s http://bit.ly/2Bj4Sfk
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 (Habitat, APRS, OziPlotter), 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`).
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).
@ -243,10 +255,8 @@ To shut-down the automatic reception script hit Ctrl-C, and the threads will eve
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
#### 4.5.1. Option #1 - Operation as a systemd Service (RECOMMENDED)
auto_rx can be operated in a 'continuous' mode, running as a systemd service.
### 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.
@ -256,7 +266,9 @@ $ 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:
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]
@ -264,7 +276,11 @@ Description=auto_rx
After=syslog.target
[Service]
ExecStart=/usr/bin/python3 /home/pi/radiosonde_auto_rx/auto_rx/auto_rx.py -t 0
# 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/
@ -290,18 +306,25 @@ $ sudo systemctl start auto_rx.service
You can check on the status of the service by running:
```
$ sudo systemctl status auto_rx.service
(which will produce output like:)
● auto_rx.service - auto_rx
Loaded: loaded (/etc/systemd/system/auto_rx.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2021-07-07 22:11:31 UTC; 11h ago
Main PID: 18125 (python3)
Tasks: 12 (limit: 2062)
CGroup: /system.slice/auto_rx.service
└─18125 /usr/bin/python3 /home/pi/radiosonde_auto_rx/auto_rx/auto_rx.py -t 0 --systemlog
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
Jul 08 09:44:50 sonderx auto_rx[18125]: 2021-07-08 09:44:50,123 INFO:Scanner #00000002 - Running frequency scan.
Jul 08 09:45:00 sonderx auto_rx[18125]: 2021-07-08 09:45:00,242 INFO:Scanner #00000002 - Detected peaks on 2 frequencies (MHz): [401.5 402.5]
Jul 08 09:45:26 sonderx auto_rx[18125]: 2021-07-08 09:45:26,163 INFO:Scanner #00000002 - Running frequency scan.
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:
@ -314,21 +337,11 @@ To stop the service, simply run:
$ sudo systemctl stop auto_rx.service
```
#### 4.5.2. Option #2 - Operation via Crontab (Backup option if systemd not available - not recommended)
As radiosonde launch times are quite predictable, auto_rx.py can be started around launch-time using a [crontab](https://help.ubuntu.com/community/CronHowto) entry.
Note that when a process runs within cron, it doesn't have access to the user's $PATH environment variable, and hence utilities like rtl_power and rtl_fm will not be found. This can be fixed by declaring the PATH environment variable within the crontab.
An example crontab is below:
You can also completely disable the service by then running:
```
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games`
15 11 * * * /home/<your_username>/radiosonde_auto_rx/auto_rx/auto_rx.sh
15 23 * * * /home/<your_username>/radiosonde_auto_rx/auto_rx/auto_rx.sh
$ sudo systemctl disable auto_rx.service
```
Note: The auto_rx.sh script performs the following actions:
* Changes directory into your auto_rx dir, then
* Starts auto_rx.py with a 3 hour timeout, which means auto_rx will exit after 3 hours regardless of if any telemetry is being received.
## 5 - Updates
Check the [releases page](https://github.com/projecthorus/radiosonde_auto_rx/releases) occasionally for information on new updates to the software. Refer to [this page](https://github.com/projecthorus/radiosonde_auto_rx/wiki/Performing-Updates) for information on how to perform updates to auto_rx.