Rpi-rtl-sdr: Difference between revisions

From wikipost
Jump to navigation Jump to search
No edit summary
 
(No difference)

Latest revision as of 09:45, 23 April 2019

In 2013 I bought one of these cheap USB DVB-T RTL-SDR dongles.

R820T with remote control and antenna
Inside the R820T


Details:

Tuner           Frequency Range
Elonics E4000   52 - 2200 MHz with a gap from 1100 MHz to 1250 MHz (varies)

VID     PID     Tuner   Device Name
0x0bda	0x2838	E4000	ezcap USB 2.0 DVB-T/DAB/FM dongle

Source: http://sdr.osmocom.org/trac/wiki/rtl-sdr

It came with a small magnetic-base antenna and some software. Initially I used it on Windows and was able to receive signals between 50MHz - 1GHz. There are mods available to make them listen on lower frequencies (HF) but I got it to show aircraft's transponder messages using RTL1090. Combined with Google Maps and VirtualRadar it is fascinating and fun to see what flies overhead..

VirtualRadar showing realtime transponder messages


Currently I am attempting to use one of these dongles to act as an aprs receiver (Rx-Only iGate) for 2m (145.175MHz). If this works I will free up one of my handheld transceivers and I will be able to bring down the power consumption and size of the project considerably.

Linux uses rtl_fm to communicate with these devices.


This is what you should see when plugging in the RTL-SDR on a Debian 9 system:

Apr 22 08:34:14 debian kernel: [  358.696018] usb 8-5: new high-speed USB device number 6 using ehci-pci
Apr 22 08:34:14 debian kernel: [  358.856014] usb 8-5: New USB device found, idVendor=0bda, idProduct=2838
Apr 22 08:34:14 debian kernel: [  358.856018] usb 8-5: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Apr 22 08:34:14 debian kernel: [  358.856020] usb 8-5: Product: RTL2841UHIDIR
Apr 22 08:34:14 debian kernel: [  358.856022] usb 8-5: Manufacturer: Realtek
Apr 22 08:34:14 debian kernel: [  358.856024] usb 8-5: SerialNumber: 00000001
Apr 22 08:34:14 debian mtp-probe: checking bus 8, device 6: "/sys/devices/pci0000:00/0000:00:1d.7/usb8/8-5"
Apr 22 08:34:14 debian mtp-probe: bus: 8, device: 6 was not an MTP device
Apr 22 08:34:14 debian kernel: [  359.121689] usb 8-5: dvb_usb_v2: found a 'Realtek RTL2832U reference design' in warm state
Apr 22 08:34:14 debian kernel: [  359.179365] usb 8-5: dvb_usb_v2: will pass the complete MPEG2 transport stream to the software demuxer
Apr 22 08:34:14 debian kernel: [  359.179381] DVB: registering new adapter (Realtek RTL2832U reference design)
Apr 22 08:34:14 debian kernel: [  359.227932] i2c i2c-8: Added multiplexed i2c bus 9
Apr 22 08:34:14 debian kernel: [  359.227934] rtl2832 8-0010: Realtek RTL2832 successfully attached
Apr 22 08:34:14 debian kernel: [  359.227943] usb 8-5: DVB: registering adapter 0 frontend 0 (Realtek RTL2832 (DVB-T))...
Apr 22 08:34:14 debian kernel: [  359.257263] r820t 9-001a: creating new instance
Apr 22 08:34:14 debian kernel: [  359.264401] r820t 9-001a: Rafael Micro r820t successfully identified
Apr 22 08:34:14 debian kernel: [  359.267992] rtl2832_sdr rtl2832_sdr.1.auto: Registered as swradio0
Apr 22 08:34:14 debian kernel: [  359.267994] rtl2832_sdr rtl2832_sdr.1.auto: Realtek RTL2832 SDR attached
Apr 22 08:34:14 debian kernel: [  359.267996] rtl2832_sdr rtl2832_sdr.1.auto: SDR API is still slightly experimental and functionality changes may follow
Apr 22 08:34:14 debian kernel: [  359.274612] Registered IR keymap rc-empty
Apr 22 08:34:14 debian kernel: [  359.274710] input: Realtek RTL2832U reference design as /devices/pci0000:00/0000:00:1d.7/usb8/8-5/rc/rc0/input32
Apr 22 08:34:14 debian kernel: [  359.274811] rc rc0: Realtek RTL2832U reference design as /devices/pci0000:00/0000:00:1d.7/usb8/8-5/rc/rc0
Apr 22 08:34:14 debian kernel: [  359.276298] usb 8-5: dvb_usb_v2: schedule remote query interval to 200 msecs
Apr 22 08:34:14 debian kernel: [  359.286751] lirc_dev: IR Remote Control driver registered, major 244
Apr 22 08:34:14 debian kernel: [  359.287484] usb 8-5: dvb_usb_v2: 'Realtek RTL2832U reference design' successfully initialized and connected
Apr 22 08:34:14 debian kernel: [  359.287526] usbcore: registered new interface driver dvb_usb_rtl28xxu
Apr 22 08:34:14 debian kernel: [  359.344649] rc rc0: lirc_dev: driver ir-lirc-codec (dvb_usb_rtl28xxu) registered at minor = 0
Apr 22 08:34:14 debian kernel: [  359.344651] IR LIRC bridge handler initialized


test audio out by listening to a local FM broadcast station (update frequency for your area)

rtl_fm -f 102.1M -s 170k -r 44100 -o 1 - | aplay -t raw -r 44100 -f S16_LE -c 1 -V mono -


rtl_fm

  • -s 170k = Sampling bandwidth, use 170k for Wide-Band FM, 25k for Narrow-Band FM
  • -r 44100 = output sampling rate; must always be less than the Sampling Bandwidth
  • -o 1 = Oversampling

NOTE:


aplay

  • -c 1 = Channels (use 2 for stereo)
  • -V mono = VU-meter (show signal strength on screen)
  • -r 44100 = sampling rate (max=44100) (must match output sampling rate from rtl_fm)


streaming over TCP

If your device does not have a soundcard available you can stream the audio over the network.

On the server:

(required packages: apt-get install sox libsox-fmt-mp3 socat)

rtl_fm -f 106.1M -s 170k -r 44100 - | sox -traw -r44100 -es -b16 -c1 -V1 - -tmp3 - | socat -u - TCP-LISTEN:8080


On the receiver:

(required packages: apt-get install sox libsox-fmt-mp3 netcat)

netcat <server> 8080 | play -t mp3 -


testing APRS packets with MultimonNG

Feeding a pre-recorded aprs packet in .wav format into multimon (it supports .mp3 as well)

multimon-ng -a AFSK1200 -t wav -i <soundfile.wav>


creating a Virtual Sound Device for the RTL-SDR

This will allow us to simply connect soundmodem to the virtual sound device and all we need to do then is feed it with audio from the RTL-SDR.

 # modprobe snd-aloop

-or-

 # echo "snd-aloop" >> /etc/modules
 (reboot) 

send RTL-SDR audio to the virtual sound device

 $ rtl_fm -f <freq> -s 100k -r 22050 - | aplay -r 22050 -f S16_LE -t raw -c 1 -D hw:Loopback,0,0


Confirm audio is coming through:

arecord -f S16_LE -r 22050 -D plughw:1,1 - | aplay -r 22050 -f S16_LE -

We can now use the virtual sound device to configure soundmodem





(more info here when I get it to work!)