My Raspberry Pi RTL Dongle server cards run the server as a service under
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:
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 sudocp rtlsdr.service rtlsdr1.service sudonano rtlsdr1.service
- Edit the ExecStart line to add: -d1 -p1235 as in
- Press Ctl-x followed by y to save and close the file
- Make sure you have two dongles connected to the Pi
sudo systemctlstart rtlsdr1
sudo systemctlstatus rtlsdr1 This checks the status so you should see your dongle reported
- If all is well enter:
sudo systemctlenable 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
Mike – G4WNC
5 thoughts on “Raspberry Pi – Multiple Instances of RTLSDR as a Service”
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
You can use a single service definition and pass it parameters. see https://derushadigital.com/other%20projects/2019/02/15/RTLSDR-service.html
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.
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.
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