*UPDATED 31st October 2018: A few typos corrected and instructions updated for Stretch. Also made amendments for Airspy-Mini receiver.
NB: Spy Server is undergoing active development so it’s important to regularly update both Spy Server and SDR Sharp.
SpyServer is available as a Linux app that will run on the popular and cheap Raspberry Pi-3. This brings a number of benefits. First of all, you can mount your Airspy close to the antenna to avoid lossy cable runs whilst accessing the receiver over a network link. Due to Spy Server’s low bandwidth requirement, you can share your receiver over the wider Internet, either for your own use or to let other ops use the radio.
Installing SpyServer on a Raspberry Pi 3
Also see my ready built scripts here:
Here’s a step-by-step guide to getting SpyServer running on a Pi 3.
- Start with a fresh install of the latest Raspbian Stretch.
- Type the following in a terminal session to install the build tools and the drivers for the AirSpy receiver: sudo apt-get install -y cmake libusb-1.0.0-dev
- Now enter the following commands to download and install the AirSpy drivers:
- wget https://github.com/airspy/host/archive/master.zip
- unzip master.zip
- cd airspyone_host-master
- mkdir build
- cd build
- cmake ../ -DINSTALL_UDEV_RULES=ON
- sudo make install
- sudo ldconfig
- Open a web browser and navigate to http://airspy.com/download/
- Select the SDR Server for 32bit ARM boards and download the file.
- Go to the download directory by typing: cd ~/Downloads
- Create a new directory for SpyServer by entering the following command: mkdir ~/spyserver
- Extract the downloaded tgz file using the following command: tar -xvzf spyserver-arm32.tgz -C ~/spyserver
- Let’s check the files are in place with this command: cd ~/spyserver && ls.
- If all is well, you should see the files: spyserver and spyserver.config.
- The next task is to make SpyServer executable by entering: sudo chmod +x spyserver
That completes the installation but you need to update the SpyServer config file for your station. Here’s an example for using an AirSpy receiver with the Pi:
- Open a Terminal session and type: hostname -I and make a note of the IP address.
- Type cd ~/spyserver to make sure we’re in the right directory.
- Now we can open the config file by typing: sudo nano spyserver.config
- Scroll down to the line: device_sample_rate
- Amend this line to read: device_sample_rate = 2500000 (3000000 or 6000000 for Airspy Mini).*
- Scroll to line: #initial_frequency= 7100000 and change it to your preferred start frequency and remove the #, i.e. initial_frequency = 145000000
- Scroll to line: fft_fps = 15 and change value to 10. This reduces the processor load to provide capacity for multiple connections.
- Scroll to line: initial_gain = 5 and change to 10
- Press Control x followed by y then Return to close the files and save the changes.
*NB: Device Sample Rate Notes. Airspy receivers will require 2.5MSPS as the 10MSPS setting uses more USB bandwidth than the Pi can supply. However, AirSpy Mini users must use 3MSPS or 6MSPS as these are the only rates supported by that device. Reports to date indicate that 6MSPS is fine on a Pi 3B+. If you encounter any stuttering audio, you will need to drop the sample rate.
That completes the changes and your Pi is now ready to run SpyServer. You can start the server with the following command from a terminal session: cd ~/spyserver && ./spyserver
ADDING OTHER RECEIVERS
In addition to supporting the standard Airspy and Airspy Mini, Spy Server is ideal for sharing the excellent Airspy HF+ receiver. Here is the step-by-step process to install the HF+ drivers:
- Open a terminal session and enter: cd /home/pi
- Enter: wget https://github.com/airspy/airspyhf/archive/master.zip
- Now unzip the archive by entering: unzip master.zip
- Change to the new directory: cd airspyhf-master
- Make a new directory for the build: mkdir build
- Change to the new directory: cd build
- Make the driver with: cmake ../ -DINSTALL_UDEV_RULES=ON
- Complete the make with: make
- Move the installed files to the correct destination: sudo make install
- Rebuild the search path so the driver can be found: sudo ldconfig
You can also use RTL-SDR dongles with the server but you will need to add the driver as described here.
Auto-Start on Boot
(Note: whilst the rc.local autostart option works ok, I now recommend running the Spy Server as a service. See https://photobyte.org/raspberry-pi-running-spy-server-as-a-service/
You can also start Spy Server on boot. To do this, we need to create a dedicated /etc/rc.local script. This automatically runs at boot but will often be called before the network is ready which will cause Spy Server to fail. To overcome this I have added an ‘until’ loop that checks for the IP every second and, once detected, carries on and runs Spy Server. This IP check also has a 30 second timeout that causes the script to abandon if the IP is not available after 30 seconds. This is very crude at the moment and needs some error handling along with a message to let the user know when IP detection fails.
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will “exit 0” on success or any other value on error.
# This script runs during boot and waits up to 30 seconds for an IP address and, if found, runs Spy Server.
until [[ $_IP ]]
if [ $counter -gt 30 ]
./spyserver spyserver.config &
That’s it; you should find that the server starts automatically when the Pi boots providing you have a local network.