Upgrading cmake on Raspbian Jessie

Trying to build and install rtl-sdr from source I got this error on a Raspberry Pi 1 running Jessie:

$ cmake ../

CMake Error at CMakeLists.txt:22 (cmake_minimum_required):
CMake 3.7.2 or higher is required.  You are running version 3.6.2

Doing an ‘apt-get update’ and ‘apt-get upgrade’ is not picking up a more recent version, so following the steps here, I downloaded the required 3.7.2 version from source and followed the steps to build it: http://osdevlab.blogspot.com/2015/12/how-to-install-latest-cmake-for.html

I downloaded a .tar for the 3.7.2 version from:

https://cmake.org/files/v3.7

The build look over 2 hours, but completed successfully, and now I’m able to build rtl-sdr.

Setting up a Raspberry Pi SD card with some Amateur Radio related apps

Gert KK6ZGA asked if I could set up an SD Card for her Raspberry Pi with including a few Amateur Radio apps. Rather than just install a bunch of random apps and hand it back, I thought it may be useful to document the setup steps for others as a reference in case anyone else is interested in doing something similar.

First steps, installing an OS – the SD card was blank, so first step I installed Raspbian from here: https://www.raspberrypi.org/downloads/raspbian/

… and then wrote the .img to the sd card with the dd util (notes on how to do this here , If on Windows there are utilities you can download to help you burn an image to an sd card, Google for help with these).

With my LG monitor it doesn’t recognize the HDMI output from the Pi unless you tweak the settings in config.txt to boost the output signal. I’ve covered this before here.

Booting up for the first time, the keyboard is configured by default for GB_en locale and UK keyboard layout (which makes it difficult to find some symbols on a US keyboard like ‘$’, so I have notes on how to switch this to US_en using raspi-config here.

For future reference, I have a number of other Raspberry Pi related getting started posts here.

Raspbian by default is configured to boot to a graphical desktop and to logon automatically with the default userid/password (pi / raspberry) – you should change your password on first boot. You can change this option in raspi-config too if you’d like to boot to a shell, or require logon at boot.

After first boot and the initial setup above, the list of apps I thought would be useful to install is most of what I covered in my July 2016 presentation at one of our RCARS club meetings on using a Raspberry Pi with  amateur radio. Here’s each of the apps I installed and how to start/use them:

  • Installed xlog:
    • sudo apt-get install xlog
    • To start, double-click the icon on the desktop
  • Installed cqrlog
    • sudo apt-get install cqrlog
    • To start, double-click the icon on the descktop

There’s many things you can do with with RTL-SDR (you’ll need a RTL-SDR dongle to take advantage of these), so here’s a couple of examples. Most of these are command line only, from the Terminal, which you can open from the desktop here:

  • dump1090 receives and decodes ADS-B transponder signals from airplanes flying overhead (depending on your antenna, within about a 100 mile radius) on 1.090Ghz. To run, there’s a couple of different modes.

‘Interactive’ mode is started like this from a terminal, first ‘cd dump1090’ then:

./dump1090 –interactive

You’ll see a display like this that updates every second, showing decoded info from received ADS-B transponder signals:

‘Net’ mode displays the received signals via a webpage. You’ll need the Pi to be on a network, either wired or wifi, and you’ll need to know your Pi’s IP address (which you can find by running ‘ifconfig’ in a Terminal). Run this with:

./dump1090 –net –quiet

And then point a browser at your Pi’s IP address on port 8080 (e.g. assuming your IP is 192.168.1.75, http://192.168.1.75:8080) and you’ll see the received signals plotted like this:

Received signals including latitude and longitude location info are plotted on the map, other signals with no location info are displayed in the table on the right.

Other things you can do with rtl-sdr utils: rtl_fm allows you to tune to a specific frequency and decode the FM modulation, and with a combination of piping the data to your audio out if you have speakers attached to the Pi’s audio output, you can receive FM signals and output the audio like this (scroll to the right for the whole command):

rtl_fm -f 96.9M -M wbfm -s 200000 -r 48000 | aplay -r 48k -f S16_LE

This tunes the RTL-SDR to 96.9Mhz, uses wideband FM, a sample rate (I think) of 200000, pipes the audio ‘|’ into aplay to play the audio stream. Take a look at the RTL-SDR docs here for more info on the options.

Hopefully this is a few things to get you started 🙂

Configuring rtl_fm and Direwolf for decoding Amateur Radio Packet on the Raspberry Pi

rtl_fm is one of the utilities from the rtl_sdr package for using a TV dongle as an SDR. Head over here if you need more info on this.

Direwolf is a soundcard based packet modem.

According to the Direwolf docs, it supports using rtl_fm as an input, so I thought I would take a look at look at getting these running together.

I’ve used rtl_sdr and rtl_tcp on my Pi before, but not rtl_fm, so first to get this working.

To playback the stream from rtl_fm you need to pipe into into some audio app. This is the same way that direwolf is going to read the stream too. Following the suggestion here on the rtl_sdr page, this command works fine for a local broadcast radio station on 96.9MHz:

rtl_fm -f 96.9M -M wbfm -s 200000 -r 48000 | play -r 48000 -t s16 -L -c 1  -

I’m not sure what all these options are, but the key options seem to be -s for the sample rate, and -r for the resolution. The -r value needs to match on the rtl_fm side and on the play side.

Now to get direwolf installed on Raspbian:

– per the userguide, first install libasound-dev:

[code]sudo apt-get install libasound-dev[/code]

– download the source zip from: https://home.comcast.net/~wb2osz/site/?/page/Download/

– unzip and cd into the direwolf folder

– make with:

[code]make -f Makefile.linux

make install-conf

make install_rpi[/code]

At this point I have rtl_fm on the Pi working as it should, and direwolf working great when decoding audio input from a 2m radio input via a USB soundcard. Combining the two though is giving me issues.

I don’t thing I’m able to get a strong enough received signal on 2m on the RTL stick even with an external 1/4wave 2m antenna.

This is the combination of commands, rtl_fm, piping into Direwolf:


[code]rtl_fm -f 145048467 -M fm -s 200000 -r 32000 -g 35 | direwolf -n 1 -r 32000 -b 16 -t 0 -[/code]

I’ve allowed for the tuning offset ppm on this RTL card, but maybe I’ve calculated this wrong?

Anyway, since Direwolf by itself on the Pi is working well and what I needed for a small packet project was to be able to decode packet on the Pi, I’ll be putting rtl_fm on hold for the time being and playing with Direwolf by itself.

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