Running SpyServer on a Raspberry Pi-3

NB: UPDATED 15th June 2017 – The following issues are fixed:

  • Wi-Fi was unavailable after upgrading to Stretch.
  • Reduced bandwidth option stuttering – fixed by a new version of Spy Server released 14/6/17

Installing SpyServer on a Raspberry Pi 3

SpyServer is now available as a Linux app that will run on the popular and cheap Raspberry Pi-3. The main benefit here is that it lets you mount the AirSpy receiver close to the antenna and then use cheap Ethernet cable for the connection back to your network. By using this technique, you can minimise feeder losses and get the receiver away from all the RF noise in the shack. At the higher VHF and UHF frequencies, the benefits can be significant. The server also allows you to access your receiver via the Internet.

Here’s a step-by-step guide to getting SpyServer running on a Pi 3.

  1. Start with a fresh install of the latest Raspbian Jessie (these instructions are based on the 10-4-17 release)
  2. Type the following in a terminal session to install the tools to build the AirSpy drivers: sudo apt-get install -y build-essential cmake libusb-1.0.0-dev pkg-config 
  3. 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
    • make
    • sudo make install
    • sudo ldconfig
  4. Open a web browser and navigate to http://airspy.com/download/
  5. Select the SDR Server for 32bit ARM boards and download the file.
  6. Go to the download directory by typing: cd ~/Downloads
  7. Create a new directory for SpyServer by entering the following command: mkdir ~/spyserver
  8. Extract the downloaded tgz file using the following command: tar -xvzf spyserver-arm32.tgz -C ~/spyserver
  9. Let’s check the files are in place with this command: cd ~/spyserver && ls.
  10. If all is well, you should see the files: spyserver and spyserver.config.
  11. The next task is to make SpyServer executable by entering: sudo chmod +x spyserver

If you are running Raspbian Jessie, you will need to upgrade GCC to v5 before SpyServer will run. Those with the Raspbian Stretch release can ignore this step as GCC-5 is included with that build.

  1. To upgrade GCC to version 5, enter the following in a terminal session: sudo nano /etc/apt/sources.list
  2. In the top line of the file that has opened, replace jessie with stretch
  3. Press control x followed by y to save and close the file.
  4. Now we can update the sources by typing: sudo apt-get update
  5. Follow this by installing gcc-5: sudo apt-get install -y gcc-5
  6. During the installation, the process will stop and show you a long list of stability warnings. This is nothing to worry about, just scroll to the end and hit q to exit the warnings and finish the installation. You will also see a warning saying that services need to be restarted. Use the tab key to select Yes and press enter to continue.
  7. When the installation completes – you need to undo the changes you made to the sources.list file.
  8. Start by typing: sudo nano /etc/apt/sources.list
  9. In the top line of the file that has opened, replace stretch with jessie
  10. Press control x followed by y to save and close the file.

That completes the installation process so just reboot and move on to the next section.

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:

  1. Open a Terminal session and type: hostname -I and make a note of the IP address.
  2. Type cd ~/spyserver to make sure we’re in the right directory.
  3. Now we can open the config file by typing: sudo nano spyserver.config
  4. Scroll down to the line: device_sample_rate
  5. Amend this line to read: device_sample_rate = 2500000
  6. Scroll to line: #initial_frequency= 7100000 and change it to your preferred start frequency and remove the #, i.e. initial_frequency = 145000000
  7. Scroll to line: fft_fps = 20 and change value to 10 or 15. This reduces the processor load to provide capacity for multiple connections.
  8. Scroll to line: initial_gain = 5 and change to
  9. Press Control x followed by y to close and save the changes.

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

Alternatively, you can add that line to the rc.local file to autostart the server on boot. For this to work, you also need to add sleep 10 at the start of the rc.local file so that it runs after the network is acquired. If you don’t add the delay, the server won’t start because network won’t be ready.

2 Responses to Running SpyServer on a Raspberry Pi-3

  1. Rick June 1, 2017 at 2:11 pm #

    any posibility to run this on boot ? so you dont have to ssh intio the rpi and leave the session open ?

    • admin June 1, 2017 at 5:48 pm #

      Hi Rick,

      Yep, that’s easy. Here’s the instructions:

      1. From a terminal session, open the rc.local file by typing: sudo nano /etc/rc.local
      2. Use the cursor keys to scroll down to the line containing ‘fi’ and insert a new line above it.
      3. On the new line type: /home/pi/spyserver/./spyserver &
      4. Press Ctrl X followed by Y to save and close the file.
      Now the server will automatically start on boot 🙂

      One other point to note: I’ve discovered that by upgrading to the Stretch distribution you lose the Wi-Fi drivers. I’m sure this will be fixed but I’ll be publishing a revised process for the Pi that just gets gcc-5 from Stretch but keeps the rest of the distribution at Jessie.

      Mike – G4WNC

Leave a Reply

Powered by WordPress. Designed by WooThemes