OpenMarine

Full Version: 2 RTL-SDR dongles in one Pi
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I am using SDR-AIS now for some time and it works perfect.
I am trying to use an extra RTL-SDR dongle for recording HAMradio automatically. Because it also uses RTL_fm, like SDR_ais does, it shares the same RTL dongle.  

What I am trying to accomplish is that RTL_test sees both dongles, however one is always in use by SDR-AIS.

Code:
pi@openplotter:~ $ rtl_test
Found 2 device(s):
 0:  NooElec, NESDR Nano 3, SN: 2782081715
 1:  NooElec, NESDR Nano 3, SN: 1112216165

Using device 0: Generic RTL2832U OEM
usb_claim_interface error -6
Failed to open rtlsdr device #0.

I realize drivers can be blacklisted in the /etc/modprobe.d directory, however I am not sure what effect this will have on my currently working SDR-AIS.
Also, I know when unchecking the SDR-AIS in Openplotter will unblock device #0 and all works well. 

However I don't want to do this every time, because while sailing I want my AIS to keep working while I record things in HAM or Marine frequencies that uses another type of antenna. That's why I thought connecting an extra separate dongle would do the trick.

My question is as follows:

- Is there a way to assign device #2 to SDR-AIS only? Or does this need to be done in RTL_fm? If so, how?

Maybe another way of asking is, can rtl_fm run two dongles or two instances at a time for separate dongles.
(2019-11-24, 04:28 PM)jamos.tan@gmail.com Wrote: [ -> ]Hi,

I am using SDR-AIS now for some time and it works perfect.
I am trying to use an extra RTL-SDR dongle for recording HAMradio automatically. Because it also uses RTL_fm, like SDR_ais does, it shares the same RTL dongle.  

What I am trying to accomplish is that RTL_test sees both dongles, however one is always in use by SDR-AIS.......

Maybe using another software could solve the problem? In several packages You could address which device You are using. In this blogposts software https://pysselilivet.blogspot.com/2018/0...berry.html  You can use "-d 1" to adress device 1.
(2019-11-24, 11:38 PM)MatsA Wrote: [ -> ]
(2019-11-24, 04:28 PM)jamos.tan@gmail.com Wrote: [ -> ]Hi,

I am using SDR-AIS now for some time and it works perfect.
I am trying to use an extra RTL-SDR dongle for recording HAMradio automatically. Because it also uses RTL_fm, like SDR_ais does, it shares the same RTL dongle.  

What I am trying to accomplish is that RTL_test sees both dongles, however one is always in use by SDR-AIS.......

Maybe using another software could solve the problem? In several packages You could address which device You are using. In this blogposts software https://pysselilivet.blogspot.com/2018/0...berry.html  You can use "-d 1" to adress device 1.

Thanks! I see indeed if I type rtl_fm -h the available commands:

Code:
rtl_fm, a simple narrow band FM demodulator for RTL2832 based DVB-T receivers

Use:    rtl_fm -f freq [-options] [filename]
    -f frequency_to_tune_to [Hz]
        use multiple -f for scanning (requires squelch)
        ranges supported, -f 118M:137M:25k
    [-M modulation (default: fm)]
        fm, wbfm, raw, am, usb, lsb
        wbfm == -M fm -s 170k -o 4 -A fast -r 32k -l 0 -E deemp
        raw mode outputs 2x16 bit IQ pairs
    [-s sample_rate (default: 24k)]
    [-d device_index (default: 0)]
    [-g tuner_gain (default: automatic)]
    [-l squelch_level (default: 0/off)]
    [-p ppm_error (default: 0)]
    [-E enable_option (default: none)]
        use multiple -E to enable multiple options
        edge:   enable lower edge tuning
        dc:     enable dc blocking filter
        deemp:  enable de-emphasis filter
        direct: enable direct sampling
        offset: enable offset tuning
    filename ('-' means stdout)
        omitting the filename also uses stdout

Experimental options:
    [-r resample_rate (default: none / same as -s)]
    [-t squelch_delay (default: 10)]
        +values will mute/scan, -values will exit
    [-F fir_size (default: off)]
        enables low-leakage downsample filter
        size can be 0 or 9.  0 has bad roll off
    [-A std/fast/lut choose atan math (default: std)]

Produces signed 16 bit ints, use Sox or aplay to hear them.
    rtl_fm ... | play -t raw -r 24k -es -b 16 -c 1 -V1 -
               | aplay -r 24k -f S16_LE -t raw -c 1
      -M wbfm  | play -r 32k ...
      -s 22050 | multimon -t raw /dev/stdin

However, the command "rtl_fm -d 1" doesn't seem to do anything:

Code:
pi@openplotter:~ $ rtl_fm -d 1
Found 2 device(s):
 0:  NooElec, NESDR Nano 3, SN: 2782081715
 1:  NooElec, NESDR Nano 3, SN: 1112216165

Using device 1: Generic RTL2832U OEM
Please specify a frequency.

Seems that you can change the device for only the command that you are trying to execute, so I guess I need to change it in the code for the program itself. I am not sure how or where to do this, or if this statement is actually correct.

About your other comment, to use multiple packages, how does this work? Using two instances of rtl_fm or a whole nother package especially for each purpose? Was wondering how this works.

If I need to be more specific, or if you need more information, let me know.

Thanks.

Jamos
The following script is being used to record some frequencies, but I would like to change the device being used or another package?:

sudo timeout $6 rtl_fm -f ${2}M -s 60k -g 45 -p 55 -E wav -E deemp -F 9 - | sox -t wav - $3.wav rate 11025

Or, if this would be difficult, can I change the device for SDR-AIS instead? If so, where?
(2019-11-30, 06:06 PM)jamos.tan@gmail.com Wrote: [ -> ]The following script is being used to record some frequencies, but I would like to change the device being used or another package?:

sudo timeout $6 rtl_fm -f ${2}M -s 60k -g 45 -p 55 -E wav -E deemp -F 9 - | sox -t wav - $3.wav rate 11025

Or, if this would be difficult, can I change the device for SDR-AIS instead? If so, where?
Please read my post, mentioned before,
[/url]
Quote:[url=https://pysselilivet.blogspot.com/2018/06/ais-reciever-for-raspberry.html]https://pysselilivet.blogspot.com/2018/0...berry.html  You can use "-d 1" to adress device 1

where You can learn to add a, or two, SDR to SignalK direct.