Tutorial : Sharing two RTLSDR receivers

Introduction

This first tutorial will show how to set-up a dual-RTLSDR remote-sdr access. We will connect two RTLSDR usb dongles and configure SDRNode to stream the IQ samples remotely.

The configuration shown here is as follows:

  1. Two receivers purchased from www.rtl-sdr.com, but any will work (see RTLSDR driver page in Wiki),
  2. One HF Upconverter from SV1AFN, converting 0-50 MHz to 200-250 MHz.

This picture shows the setup used for the tutorial :

sharing_two_rtlsdr

Step 1 : Prepare the RTLSDR Dongle – Manage serial numbers

By default, most of the RTLSDR dongles come with the same serial number “00000001”. You can check what serial number is assigned with the rtl_eeprom software from osmocom :

C:\SDRNode  rtl_eeprom.exe -d 0
Found 2 device(s):
0: Generic RTL2832U OEM
1: Generic RTL2832U OEM

Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner

Current configuration:
__________________________________________
Vendor ID: 0x0bda
Product ID: 0x2838
Manufacturer: Realtek
Product: RTL2838UHIDIR
Serial number: 00000001
Serial number enabled: yes
IR endpoint enabled: yes
Remote wakeup enabled: no
__________________________________________

C:\SDRNode  rtl_eeprom.exe -d 1
Found 2 device(s):
0: Generic RTL2832U OEM
1: Generic RTL2832U OEM

Using device 1: Generic RTL2832U OEM
Found Rafael Micro R820T tuner

Current configuration:
__________________________________________
Vendor ID: 0x0bda
Product ID: 0x2838
Manufacturer: Realtek
Product: RTL2838UHIDIR
Serial number: 00000001
Serial number enabled: yes
IR endpoint enabled: yes
Remote wakeup enabled: no
__________________________________________

What is the problem with having the same serial numbers ?

The problem will come in the setup when you will want to define which of your streams is HF and which is not. By using the serial number you will be able to distinguish which is what, and then associate the good stream to the good device.

We have to change one of the device serial number to – for example – “2” (SDRNode will create a specific file to manage configuration for this device, the serial number will be part of the file name, take care of special characters here).

C:\SDRNode  rtl_eeprom.exe -s 2
Found 1 device(s):
0: Generic RTL2832U OEM

Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner

Current configuration:
__________________________________________
Vendor ID: 0x0bda
Product ID: 0x2838
Manufacturer: Realtek
Product: RTL2838UHIDIR
Serial number: 00000001
Serial number enabled: yes
IR endpoint enabled: yes
Remote wakeup enabled: no
__________________________________________

New configuration:
__________________________________________
Vendor ID: 0x0bda
Product ID: 0x2838
Manufacturer: Realtek
Product: RTL2838UHIDIR
Serial number: 2
Serial number enabled: yes
IR endpoint enabled: yes
Remote wakeup enabled: no
__________________________________________
Write new configuration to device [y/n]? y

Configuration successfully written.
Please replug the device for changes to take effect.

Now we can do a first boot of SDRNode to see if the program detects correctly the USB dongles.

Step 2 : Start SDRNode and check that the devices are detected

Open a prompt (command-line on windows, shell on linux) and go where you installed SDRNode software. Then type (note the ‘-e’ command run in foreground) :

sdrnode -e

You should see something like :

dual RTLSDR first boot

We have more details in the log file, located in “logs/sdrnode.log” :

+--------------------------------------------------------+
+        Cloud-SDR|SDRnode - Stream IQ over network      +
+        (c) SDR-technologies SAS - (c) F4GKR            +
+--------------------------------------------------------+
Software build date  : 15082016
Running on CPU class  : 7
+--------------------------------------------------------+
IMPORTANT : By using this software your confirm you are in compliance with
your national regulation.
RadioHardwareProvider::RadioHardwareProvider looking for RTLSDR
Found 2RTLSDR devices connected
Attaching device #0
RTLSDR::RTLSDR() device ID:0
RTLSDR::RTLSDR Found manufacturer:Realtek,  product:RTL2838UHIDIR,  serial:00000001
Attaching device #1
RTLSDR::RTLSDR() device ID:1
RTLSDR::RTLSDR Found manufacturer:Realtek,  product:RTL2838UHIDIR,  serial:2

You must also have two new files created in the “conf” folder :

dualrtlsdr_config

Okay, devices are correctly detected. Kill the program with CTRL-C

Step 3 : Add the HF Up-converter to RTLSDR #2

The SV1AFN converter translated the 0-50 MHz range to 200-250 MHz. We need to say somewhere that device with serial number #2 has a front-end.

This is done by editing the content of the “conf_RTL820T2_2.conf” file. Change it as follows (highlighted lines) using your favorite text editor:

[Preferences]
serial_number=2
LO=200000000
In_Min=1000000
In_Max=50000000

That means :

  • There is a local oscillator, at 200 MHz (warning, frequency in Hz),
  • The minimum input is 1 MHz,
  • The maximum input is 50 MHz.

Restart the SDRNode program as you did at end of step 2:

sdrnode -e

And check again your log file in “logs/sdrnode.log”:
We have more details in the log file, located in “logs/sdrnode.log” :

....
RTLSDR::RTLSDR Found manufacturer:Realtek,  product:RTL2838UHIDIR,  serial:2
Converter installed with LO :200.000MHz, freq range changed to [1.000MHz ->50.000MHz]

Step 4 : Name the streams

At that stage the RTL SDR dongles are correctly detected and configured. We need now to define what we share in the cloud so that they can be remotely accessed. For sake of simplicity in this tutorial we will not detail too much all the possible settings and stick to the very minimum.

When SDRNode boots it loads a special “boot configuration script” called sdrnode.js, which contains JavaScript code. This configuration is here to define what is shared.

Let’s have a look to the proposed script for this tutorial:

/*----------------------------------------------------------------*/
/*  This is a sample configuration file for Two RTLSDR dongles   -*/
/*  (c) 2016 Cloud-SDR and F4GKR                                  */ 
/*----------------------------------------------------------------*/
// load the configuration utilities
load('scripts/sources.js');

/*----------------------------------------------------------------*/
/* Boot function to set the hardware                            --*/
/*----------------------------------------------------------------*/
function simpleboot() {
	// get a detailed description of what hardware is here
	var sources = GetSources();
	var i ;
	// loop through the sources
	for( i=0 ; i < sources.length ; i++ ) {
		var sourceDef = sources[i] ;	
		
		if( sourceDef.name == 'RTL820T') {
			// create RFSource object wrapper
			var rtlsdr = new RFSource( sourceDef.UID ) ;		
			// set sampling rate to 2048 KHz
			rtlsdr.setSampleRate( 2048000 );  
			// set some gain value
			rtlsdr.setRxGain( 0, 30 ) ;
			
			var serial_number = rtlsdr.getRxSerialNumber() ;
			print( 'Setting RTLSDR with serial #' + serial_number ) ;
			if( serial_number == '2') {
				print('Configuring HF stream');
				// we define a 100 KHz stream called HF
				var rx820hf = rtlsdr.createStream( 100e3, 'HF' ) ;
				// max compression
				rx820hf.setCompressionType( 3 ) ; 
			} else {
				// we define a 100 KHz stream called VHF 
				var rx820vhf = rtlsdr.createStream( 100e3, 'VHF' ) ;
				// max compression
				rx820vhf.setCompressionType( 3 ) ; 
			}
		}
	}
}
/*----------------------------------------*/
/* program starts here  		--*/
/*---------------------------------------*/
print('booting sdrNode');
// Set this node name
SDRNode.setName('MyRemoteSDR');

// do the configuration
simpleboot();

Here is what we have done:

  1. Program calls the function called simpleboot() at line 52.
  2. Function simpleboot() starts by getting the list of local hardware (line 13),
  3. then goes through all declared hardware to check what we have (line 16),
  4. If we have a RTLSDR of type RTL820T, we can configure it :
    1. We retrieve the serial number (… here it is… ) line 27,
    2. If this is the HF one, we create a 100 KHz IQ stream named ‘HF’ (line 32)
    3. Otherwise we create a 100 KHz  IQ Stream called ‘VHF’.

In both cases the compression type has been set to “3” which is the maximum compression level available at that time.

With this level, a 100 KHz stream will require something like 210 Kbyte / second of network per user.

Restart the SDRNode program as you did at end of step 2:

sdrnode -e

Ok, we are ready to rock ! let’s try this

Step 5 : Connecting and listening to the RTLSDR remote streams

Start the Cloud-SDR client software. It will search for available local hardware devices and then connect to remote SDRNodes.

add_remote

Click yes, and give remote server address and port, depending on your configuration. Then comes the security point : you will need to enter a valid certificate to enable remote access. This is the public_key field from your sdrnode.conf file (see wiki).

add_remote_2

Now the client will try to reach the server. On success you will see the following list of streams :

add_remote_3

You find here what we defined with the JavaScript configuration file.

Click on “Use HF” button…

add_remote_4

There you are !

If your network bandwidth is large enough, you can even open a second client and play with the VHF stream :

add_remote_5