Posted on 5 Comments

Raspberry Pi – Multiple Instances of RTLSDR as a Service

My Raspberry Pi RTL Dongle server cards run the server as a service under systemd. This has several benefits including a better-defined start and the facility to stop/restart a service gracefully. One of my customer recently asked if it was possible to support 2 dongles and switch between them.

From previous tests, I know that a Pi3-B can support up to 4 RTL-SDR server instances, so switching between two should be easy. To add a second instance we just need to create a second Service file that’s a duplicate of the original with just one line changed. Here’s a copy of the original, single device, service file:

Description=RTL-SDR Server


ExecStartPre=/bin/sleep 15
ExecStart=/bin/sh -c ‘/usr/local/bin/rtl_tcp -a $(hostname -I)’


The line we need to change is the ExecStart as this line actually starts the server. To add another instance it should read:

ExecStart=/bin/sh -c ‘/usr/local/bin/rtl_tcp -a $(hostname -I) -d1 -p1235’

The -d suffix is the device number which counts from 0 and the -p1235 entry forces the second server instance to use port 1235.

Here’s a step-by-step guide to adding a second instance. NB: Back-up your SD card first!

  • Open a terminal session (Ctl-Atl-t)
  • Enter: cd /etc/systemd/system
  • sudo cp rtlsdr.service rtlsdr1.service
  • sudo nano rtlsdr1.service
  • Edit the ExecStart line to add: -d1 -p1235 as in above example
  • Press Ctl-x followed by y to save and close the file
  • Make sure you have two dongles connected to the Pi
  • Enter sudo systemctl start rtlsdr1
  • Enter sudo systemctl status rtlsdr1 This checks the status so you should see your dongle reported
  • If all is well enter: sudo systemctl enable rtlsdr1 This will make the second instance automatically run at boot.

That’s it! If you want to stop either service from starting at boot use: sudo systemctl disable rtlsdr or rtlsdr1

To start or stop a service it’s sudo systemctl stop rtlsdr or rtlsdr1 to start it’s sudo systemctl start rtlsdr or rtlsdr1

Good Luck,

Mike – G4WNC

5 thoughts on “Raspberry Pi – Multiple Instances of RTLSDR as a Service

  1. Mike,
    How do you change Exec Start line to use a fixed IP address. I am trying to get the RSP1a tcp server running using a version of this Unit File for creating a service to get rsp_tcp service to run for an RSP1a

  2. You can use a single service definition and pass it parameters. see

    1. Hi Noah,

      Thanks for commenting. That looks like a neat solution. I’m traveling in Switzerland at the moment but will look to incorporate this when I get back to base.



  3. Totally off topic but can this dongle be used to add location APRS to my Kenwood TM-V71A if I also get a USB GPS? I’m a bit of newb and don’t totally get all the wired com protocols.

    1. Hi David,

      Apologies for the delayed reply. I’ve not seen any examples of using the RTL-SDR dongle as a complete GPS solution. All it really achieves in SDR mode is to present a pair of 8-bit IQ samples over the USB port. Also, from a cost perspective, you can buy a dedicated USB GPS dongle for not much more than the price of an RTL-SDR dongle.


      Mike – G4WNC



Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.