rtl_sdr and OpenWRT

Using a TP-Link WR703N and a RTLSDR I decided to make a small dedicate SDR box. Using rtl_tcp I can set up the box and a suitable antenna and use it to receive IQ values over a wifi or ethernet link. Using the wifi means I can do this without pluggin a ton of crap into my laptop.

WR703N

The WR703N has been really well documented, with a full section of mods on its wiki page. I have add serial console headers and a rp-sma antenna connector on the box I used for this project.

These were fun to do, the serial connector makes debricking the WR703N a lot easer, the rp-sma connector allows different antennas to be used with the router. With some more gain behind it, I should be able to place the sdr box somewhere high and out of the way and still be able to connect to it.

For getting OpenWRT onto the WR703N you can follow the generic flashing instructions. Make sure to install Barrier Breaker or later, BB has a prebuilt package for rtl_sdr.

I installed the rtl_sdr software via the web interface, but it can be done from the command line with something like the following.

# opkg update
# opkg install rtl_sdr

rtl_tcp

Once you have the rtl sdr packages installed, connect your rtl sdr dongle to the usb port then run the following.

$ rtl_tcp -a 192.168.1.1 -n 8 -b 8

This command will start rtl_tcp and have it listen on the 192.168.1.1 address for external connections, without this it will only listen on localhost. If you have configured your network differently you will want to change the listen address.

I had a lot of trouble running rtl tcp for more than a few seconds with a client connected, this was fixed by configuring the buffer options. The -n option configures the number of linked lists rtl tcp will use, -b configures the number of buffers it will use. I have had a quick look at the rtl_tcp source, but I couldn't really figure out why this helped so much.

Viewing the data

The last thing to do to test this is connect a client. The rtl sdr tools can't connect to a rtl tcp source, but we can connect and grab some data using netcat.

$ nc 192.168.1.1 > capture.iq

This might be enough if you have a process for dealing with iq data, but I like to look at things. The GrOsmoSDR package comes with a couple of tools for viewing ffts and waterfalls using GNURadio.

$ osmocom_fft -W -s 2000000 -f 144000000 -a 'rtl_tcp=192.168.4.1:1234'

        Without any of the following it will show an fft
-W      Show a waterfall
-S      Show a scope
-F      Show the cool fosphor display