Installing rtl-sdr and dump1090 on a Raspberry Pi to receive ADS-B signals

I’ve gone through these steps a couple of times when I’ve set up a new SD card, and had to go to various places to work out all the steps, so in case this is useful for someone else, here’s the steps (assuming installing on Rasbian):

Making and installing rtl-sdr from source

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

Pre-req steps, if you don’t already have the following:

sudo apt-get install cmake

#usb driver for the rtl dongle
sudo apt-get install libusb-1.0

Get the source:

git clone git://git.osmocom.org/rtl-sdr.git

Build:

cd rtl-sdr/
mkdir build
cd build
cmake ../
make
sudo make install
sudo ldconfig

If you get permissions errors like this when using any of the rtl_* commands:

Using device 0: Terratec T Stick PLUS
usb_open error -3
Please fix the device permissions, e.g. by installing the udev rules file rtl-sdr.rules
Failed to open rtlsdr device #0.

Then you should be able to add a line to

/etc/udev/rules.d/rtl-sdr.rules

 to set up correct permissions for your specific card, which you can find by running lsusb, eg for mine:

Bus 001 Device 004: ID 0ccd:00d7 TerraTec Electronic GmbH

From this I believe you take the id value and insert it into a new line in rtl-sdr.rules like:

SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00d7", MODE:="0666"

and then restart udev:

sudo service udev restart

… reboot and that should be fixed.  Or you can still run the apps with sudo.

To test, try starting up the rtl_tcp server:

sudo rtl_tcp -a your_ip

and you might see a message about the device already in use by another kernel module:

Found 1 device(s):
  0:  Realtek, RTL2838UHIDIR, SN: 00000001
Using device 0: Terratec T Stick PLUS
Kernel driver is active, or device is claimed by second instance of librtlsdr.
In the first case, please either detach or blacklist the kernel module
(dvb_usb_rtl28xxu), or enable automatic detaching at compile time.
usb_claim_interface error -6
Failed to open rtlsdr device #0.

This is saying dvb_usb_rtl28xxu is already using the device. From instructions here, you can temporarily unload this module:

sudo rmmod dvb_usb_rtl28xxu

or permantly remove it with a blacklist entry in /etc/modprobe.d – add a new file here named something like rtl-sdr.conf, add add one line with the name of the above driver:

blacklist dvb_usb_rtl28xxu

Reboot and now you should be good to go with the rtl_* commands.

 

Making and installing dump1090:

From https://github.com/MalcolmRobb/dump1090

git clone https://github.com/MalcolmRobb/dump1090.git
cd dump1090
make

Run in interactive mode:

./dump1090 --interactive

or net mode to enable the webserver (point a browser at you Pi’s IP address and port 8080):

./dump1090 --net

D-Star setup with Icom ID880H

The 880H supports a couple of different approaches to using DSTAR:

  • regular memories, each one holding repeater info plus one UR, RPT1, RPT2, MY combination, with the DV mode selected
  • DR Mode memories combined with UR memories

The regular memory approach is probably the easiest the understand in terms of how memories would be used in a non-DSTAR mode, but given that you will likely want to send link/unlink commands to the repeater, this would mean each of these combinations would occupy one additional memory.

The DR Mode uses one memory for the common repeater settings, and then you select the variable parts for UR, RPT1, RPT2 etc as needed.

If you follow the instructions in the 880H manual for configuring DR Mode, it talks about three settings, GRP CQ, GRP RPT, and GRP UR. The manual is not very clear about the difference in these modes relating to your UR, RPT1, RPT2, and MY settings however. So here’s my understanding of the differences:

  • GRP CQ – removes RPT2 setting for routing which means when you transmit, you’re only heard on the local repeater and you do not get forwarded out via the gateway to any linked reflectors or other repeaters.
  • GRP UR – does keep the RPT2 value (usually ‘repeater-call G’), plus you can select any of your stored values for UR, either CQCQCQ or a link or unlink command.

I read somewhere that you should use UR of DRCQCQ to indicate that you’re using DR mode to force the repeater to see this as destined not only for the repeater and include the gateway routing info too (RPT2). I don’t think this solves the issue of GRP CQ though, which seems to intentionally remove the RPT2 value – changing the default UR of CQCQCQ to DRCQCQ I don’t think has any effect.

So in summary, if you’re intending to get forwarded out from your repeater’s gateway, use the GRP UR mode.

  • Press DR, select one of your DR repeater memories (from your repeater list memories)
  • Long press UR and select CQCQCQ from your Callsign List
  • Select GRP UR (instead of GRP CQ) by pressing BAND button (each press cycles through GRP CQ, GRP RPT, GRP UR)
  • Long press UR and select GW instead of NOT USED.
  • Press DR Button to return to DR Mode.

I got this tip from this post here.

A few other random observations:

  • If you watch the dashboard for your repeater (eg for W6CX) and a reflector that it is linked to (eg REF014), you’ll see your call appear when you transmit on the repeater dashboard, but NOT the reflector. I’ve asked questions about this in multiple forums online and the opinion seems to be mixed, but I don’t believe if you are accessing a reflector linked to a repeater, then you don’t appear on the reflector’s dashboard. Initially this was misleading for me, as I misread this as I wasn’t making it to the reflector, but calling CQ and a couple of QSOs later confirmed that I was successfully being forwarded to the reflector, even though I never showed up on the reflector dashboard.

I’ll summarize a few other tips later.

Icom 880H programming regular memories

Couple of notes on programming regular repeater memories:

  • Press VFO/MHz then select the frequency with the main dial
  • Hold TONE to select the repeater tone, rotate dial to select tone freq, then press again
  • Press Menu, select DUP.T, R TONE, rotate to select tone, press main knob to select
  • Hold DUP, select – or + offset, press again to select
  • Press S.MW to select memory write. Rotate knob to select free memory. Hold S.MW to write.

To set memory name, with memory selected:

  • Press S.MW for memory write
  • Press Moni, rotate to select M NAME, press Moni
  • Enter name, using knob and < > buttons, press Moni when done
  • Hold S.MW to write.

Running headless WSPR on the Raspberry Pi

I’ve tried a few times to compile and run WSJT on the Pi in order to decode JT65 mode transmissions – I think I got close, but I ran into other issues with the soundcard configuration that has tripped me up, like configuring WSJT to listen and transmit to my soundcard’s inputs and outputs.

I’ve seen some other posts on getting WSPR running, so this looks like it’s more possible.

From going through the WSJT dependencies, I’d already installed all the libportaudio and python-* dependencies. If you’re following this from scratch through, I’d start with George Smart’s article here. To get a working config I followed George’s article first and then picked up LX3KR’s article here to get the soundcard config working – I also wanted to run WSPR in headless mode, so I picked up the steps at this point:

cp WsprMod/w.so WsprModNoGui/

I’m not sure the suggestion for the .asoundrc file worked for me, as referencing the input as 2#audio and output as 3#radioconv in the WSPR.INI didn’t work.

At this point I did some guessing. When wspr starts up, it writes a list of audio devices to audio_caps file in your wspr dir. Here’s what mine looks like with my Rigblaster Advantage attached:

pi@raspberrypi ~/amateur_radio/wspr $ cat audio_caps
0    1    2       0       0  RIGblaster Advantage Audio: USB Audio (hw:0,0)
1  128  128       0       0  sysdefault
2    0    2       1       0  front
3    0    2       1       0  surround40
4    0    2       1       0  iec958
5    1    2       0       0  spdif
6  128  128       0       0  default
7    0    2       1       0  dmix

So I’m guessing the Rigblaster is device 0 and sysdefault is 1.

From the suggested config in WSPR.INI, it configures the in and out like this:

AudioIn 2#radio
AudioOut 3#radioconv

2 and 3 don’t seem to match up with anything I’m seeing, but since the other earlier step changed the USB sound card devices to be default, I set these instead:

AudioIn 1
AudioOut 1

Before starting up wspr I also ran alsamixer and set the vol and mic levels to be roughly 3/4 volume.
Now when starting up it looks like wspr sees my devices and off it goes:

pi@raspberrypi ~/amateur_radio/wspr $ python wspr_nogui.py 
******************************************************************
WSPR Version 3.00_r2326, by K1JT
Run date:   Thu Apr 17 05:14:05 2014 UTC
setting g.Win32
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm_dmix.c:957:(snd_pcm_dmix_open) The dmix plugin supports only playback stream
Audio config ok
2014 Apr 17
05:14:06
Rx Noise: -30  dB

The last few lines repeat for a minute or so then it starts reporting the actual volume level. You want to adjust the radio volume or volume on the Rigblaster so that the level is close to 0db. +/- a few doesn’t seem to make much difference.

The other values I changed are:

PctTx 0

This is percent tx time. Leave it at 0 for rx only, otherwise change to a %age of time value that you want to send your own transmissions. I changed it to 5.

iband 2

This represents the band you’re listening to, counted from the list of freq values. 600m is 1, 160m is 2 and so on.

Start it up and off you go!

python wspr_nogui.py