-
-
Notifications
You must be signed in to change notification settings - Fork 127
Spyserver Setup Instructions
Last Updated: 2023-11-09
As of November 2024, we now recommend using KA9Q-Radio for decoding the entire radiosonde band at once! KA9Q-Radio uses less CPU, and is completely open source unlike Spyserver.
Ever wanted to decode all the sondes your station can see, simultaneously? With the new Network SDR support (Spyserver and KA9Q-Radio are supported) in radiosonde_auto_rx v1.6.0 and newer, this is now possible!
However, some caveats:
-
It uses a lot of CPU. Known-Working Platforms:
- Raspberry Pi 4 (use Raspbian 64-bit), with active cooling to avoid overheating and under-clocking.
- It seems that an Airspy R2 running 10 MHz is a bit much for a RPi 4, with sample drops observed. Airspy Mini at 6 MHz is fine.
- Zimaboard 432 (Intel Celeron N3450) is known to work fine with an Airspy Mini.
- Most likely any old Intel machine (multi-core Celeron, i3, i5) you have lying around will handle this.
- Raspberry Pi 4 (use Raspbian 64-bit), with active cooling to avoid overheating and under-clocking.
- Some users have reported packet loss issues that are likely related to dropped samples. This might be to too much CPU usage, network issues, or something else. (Fairly difficult to diagnose!)
- Scanning is currently quite slow, due to the long time it takes spyserver_client to connect. (... however you'll now have a 'virtual SDR' dedicated to scanning continuously, so this isn't really a problem)
- There are known issues with SpyServer refusing connections after some time (can be days to weeks of operation... or not happen at all). This may be due to USB bandwidth issues, so try and have the AirSpy on its own USB bus, or on a USB 3 port where possible.
If you have any issues with this setup, please contact me at [email protected]. Don't try and contact the airspy mailing list, you won't get any useful responses from there, just snide comments.
Big thanks to the following people for making this possible:
- Mike Weber (miweber67) for making an open-source command-line SpyServer Client
- Phil Karn KA9Q for developing an open source network SDR server which is now supported too!
- One Airspy Mini (Airspy R2 is also known to work, though will use more CPU). Currently we only support connecting to one backend server, so you need to provide the frequency coverage you need with a single SDR.
- An Antenna (and maybe a preamp?) - I'm hoping you've already had a radiosonde_auto_rx station running, so you have some idea on what is required here!
- At the bare minimum, a Raspberry Pi 4, or similar class of SBC. Refer above for known-working platforms.
Pretty much all SDRs have a usable receive bandwidth which is smaller than the sample rate in use, due to passband filter rolloff. Typically, about 80% of the sample rate is usable. E.g. for a 6 MHz sample rate (the Airspy Mini's maximum), 4.8 MHz is usable. For an Airspy R2, 8 MHz.
So, this means that a Airspy Mini will not be able to cover the entirety of the 400-406 MHz radiosonde band. You will need to pick a centre frequency such that the frequency range covered is suitable for your area. Some examples:
- 402.5 MHz Centre = 400.1 - 404.9 MHz centre (Suitable for use in Australia where sondes are generally found in 400-403 MHz)
- 403 MHz Centre = 400.6 - 405.4 MHz
An Airspy R2, however will cover the entire band.
The min_freq
and max_freq
configuration settings must be set to either be the same as these band edges, or 'inside' them. While the scan plot on the web interface will show the entire SDR bandwidth, any peaks outside the range min_freq
to max_freq
will be dropped.
SpyServer support is now available in the main branch of auto_rx (as of v1.6.0). Follow the main installation instructions at https://github.com/projecthorus/radiosonde_auto_rx/wiki
If you want to keep up with the absolute latest changes, you can also use the testing
branch as follows:
If using the Docker install method, replace 'latest' with 'testing' when using the docker run
command.
e.g.:
docker run \
-d \
--name radiosonde_auto_rx \
--restart="always" \
--device=/dev/bus/usb \
--network=host \
-v ~/radiosonde_auto_rx/station.cfg:/opt/auto_rx/station.cfg:ro \
-v ~/radiosonde_auto_rx/log/:/opt/auto_rx/log/ \
ghcr.io/projecthorus/radiosonde_auto_rx:testing
If installing the 'long' way, use the testing branch when getting the source:
git clone https://github.com/projecthorus/radiosonde_auto_rx.git
cd radiosonde_auto_rx
git checkout testing
Before running this section, I recommend you have either SDR# or SDR++ available for use, we'll be connecting into the newly setup SpyServer using one of these to adjust gain settings.
Install dependencies (If you've already setup auto_rx, then most/all of these should be installed already):
$ sudo apt-get install build-essential cmake libusb-1.0-0-dev pkg-config
Now download and install the AirSpy libraries:
$ wget https://github.com/airspy/airspyone_host/archive/master.zip
$ unzip master.zip
$ cd airspyone_host-master
$ mkdir build
$ cd build
$ cmake ../ -DINSTALL_UDEV_RULES=ON
$ make
$ sudo make install
$ sudo ldconfig
If you disconnect and re-connect your AirSpy unit, you should now be able to test it by running:
$ airspy_info
airspy_lib_version: 1.0.11
Found AirSpy board 1
Board ID Number: 0 (AIRSPY)
Firmware Version: AirSpy MINI v1.0.0-rc10-6-g4008185 2020-05-08
Part ID Number: 0x6906002B 0x00000030
Serial Number: 0xB58069DC3959B713
Supported sample rates:
6.000000 MSPS
3.000000 MSPS
Close board 1
If you get an error along the lines of AIRSPY_ERROR_NOT_FOUND
then you may not have permissions to access the device. For this, you need to be in the plugdev
group, which you can do by running:
$ sudo usermod -aG plugdev $(whoami)
Once you log out and back in again, you should be able to access your AirSpy device.
Create a spyserver directory in your home directory:
$ cd
$ mkdir spyserver
$ cd spyserver
Download the SpyServer version relevant to your platform:
- 64-bit ARM (e.g. RPi 4 running Raspbian 64-bit) -
wget https://airspy.com/downloads/spyserver-arm64.tgz
- 32-bit ARM (however note that this may not have enough performance!) -
wget https://airspy.com/downloads/spyserver-arm32.tgz
- 64-bit Intel/AMD -
wget https://airspy.com/downloads/spyserver-linux-x64.tgz
Extract the bundle using:
$ tar -xzf spyserver-arm64.tgz (or whatever file you downloaded)
Now download an autorx-specific configuration file by running:
$ wget https://gist.githubusercontent.com/darksidelemm/239eebef0d44bf331a3a89c68e068a8a/raw/0984a87f9897b35cb4082087c0a105b23dd5bcd3/spyserver_autorx.config
Edit this file (e.g. nano spyserver_autorx.config
) and adjust the initial_frequency
and device_sample_rate
settings as appropriate to your device and area.
Now, start up the spyserver manually with:
$ ./spyserver spyserver_autorx.config
SPY Server v2.0.1700
Copyright (C) 2016-2018 Youssef Touil - https://airspy.com
Reading the configuration file: spyserver_autorx.config
Listening for connections on 0.0.0.0:5555
If you get an error like Unable to bind 0.0.0.0 to 5555
, you will need to wait a while. This is a long-standing bug with SpyServer, where it doesn't seem to release its hold on TCP sockets correctly.
Using either SDR# or SDR++, connect into your SpyServer. Do this from a separate machine on the same network as your RPi.
- In SDR#, you will need to select a Source type of 'AIRSPY Server Network', set the address to
sdr://<yourRPiIPhere>:5555
, and click the 'Play' button to connect and start. - In SDR++, select a Source type of 'SpyServer', and enter the RPI IP address in the left entry box, and port 5555 in the right box. Click Connect, then the Play button at the top of the window to start receiving. Enabling FFT smoothing will help with the next steps.
Once connected, you should now be able to adjust the gain of the AirSpy. Some general rules for adjusting the gain:
- Start from 0 gain, then slowly increase the gain while watching the noise floor level. At the lower levels you may not see much movement, but at some point the noise floor will start to increase quite quickly (as much as 4 dB per gain step). Set your gain to the point just after this noise floor rise starts to happen. As you continue to increase gain, all you are really doing is reducing your available dynamic range, potentially leading to distortion issues if you end up with strong signals.
- If you receive while there is a radiosonde in the air, you can try and adjust the gain to optimize SNR. Try not to have too much gain set, as this can lead to intermodulation distortion issues.
As an example, here's how my local noise-floor rises (in this case, connected to a monopole on my roof without any LNA). In this case I'd probably want to set the gain to around 14 or 15.
Once you're happy with the gain settings, disconnect your client, then shutdown the spyserver with Ctrl-C.
Edit the configuration file again (e.g. nano spyserver_autorx.config
) and set initial_gain
to the gain setting you decided on, then set allow_control = 0
. If you don't do this, auto_rx will behave eratically and may eventually crash out. Save the config file.
Download an example SpyServer systemd service file by running:
$ wget https://gist.githubusercontent.com/darksidelemm/ba3b3025ffc1b19fb5d0b0fbdc7efc7c/raw/ba861f3c99eedfd47fb415b4021423f7b050eed2/spyserver.service
Assuming you have setup spyserver at /home/pi/spyserver
and are using the spyserver_autorx.config
configuration file, you shouldn't need to make any changes to the file. Otherwise, you may need to adjust paths in it.
Copy the service file to the right location and start it up with:
$ sudo cp spyserver.service /etc/systemd/system/
$ sudo systemctl enable spyserver.service
$ sudo systemctl start spyserver.service
You can check that it has started by running:
$ sudo systemctl status spyserver
● spyserver.service - spyserver
Loaded: loaded (/etc/systemd/system/spyserver.service; enabled; preset: enabled)
Active: active (running) since Fri 2023-10-27 06:33:51 BST; 4s ago
Main PID: 3807 (spyserver)
Tasks: 2 (limit: 1585)
CPU: 12ms
CGroup: /system.slice/spyserver.service
└─3807 /home/pi/spyserver/spyserver /home/pi/spyserver/spyserver_autorx.config
Oct 27 06:33:51 airspy2 systemd[1]: Started spyserver.service - spyserver.
You may experience the Unable to bind 0.0.0.0 to 5555
error described earlier, if this happens just wait - systemd will restart spyserver every 15 seconds until it works again.
Congratulations, you should now have spyserver starting automatically on boot! It's probably worth testing this by restarting your system and checking it starts up with the sudo systemctl status spyserver
command.
If you need to adjust configuration settings, you can restart the spyserver by running sudo systemctl restart spyserver
after making the required changes.
spyserver_client needs to be complied and copied into auto_rx directory.
If you are using the docker install method, then this doesn't need to be done, as the docker image already includes spyserver_client.
sudo apt-get install libsamplerate0-dev
git clone https://github.com/miweber67/spyserver_client
cd spyserver_client
make
cp ss_client ~/radiosonde_auto_rx/auto_rx/ss_iq
cp ss_client ~/radiosonde_auto_rx/auto_rx/ss_power
Use the station.cfg.example.network file as a starting point.
- sdr_type to
SpyServer
- sdr_quantity to maybe 5 to start with. Increase this once you have confidence in you platforms ability to run multiple decoders reliably.
- Set the Search min/max frequency to be either the same range as your SpyServer will cover, or narrower. Any peaks detected outside of this range will be discarded.
You can also use the always_decode
option to start up persistent decoders, if you know the launch site(s) near you are always using the same frequency.
TODO...