main.lv
Dont think code it

2014-11-5 RTLSDR usage

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+                                RTLSDR usage                                  +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+                                    INDEX                                     +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1. Setup rtlsdr
   1.1. Get sources
   1.2. Drivers
   1.3. Check if works
 2. Collection of tools
   2.1. FM
   2.2. Spectrum diagram
   2.3. ADSB
   2.4. AFSK1200
 3. Projects where rtlsdr used
   3.1. WebSDR
 4. Problems
   4.1. Sync errors
 5. Links
 6. Changelog


++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+                               1.Setup rtlsdr                                 +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

By rtlsdr usually call RTL2832U chip based tv-tunners which
can be used for not just recievin DVB-T frequencies but much more
and yes price is ~$10 it mean that anyone can just buy and try
without "loosing" money.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1.1.Get sources


Main development repository is on http://sdr.osmocom.org/trac/wiki/rtl-sdr
on github you can find more repos with experminental 
features (https://github.com/keenerd/rtl-sdr).

Getting sources from git:
  git clone git://git.osmocom.org/rtl-sdr.git

I prefer using plain binaries without any kind of installation. Just
compile and use binary without any troubles.
Build:
  cmake .
  make

All binaries is in src dir


++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1.2.Drivers


Linux kernel have some drivers for rtlsdr stick and DVB-T. When you will plug
rtlsdr then kernel probably will load DVB-T drivers and you will not able
to use you rtlsdr for sdr. Way yo fix is it add some drivers to black list and
next time when you will plug rtlsdr this drivers will not be loaded.

Check if rtlsdr related drivers is loaded:
  lsmod | grep rtl28

If there is some drivers then balcklist driver by creating file
in /etc/modprobe.d/ with content:
  blacklist dvb_usb_rtl28xxu

Next thing that could appear is permissions on rtlsdr usage when its pluged in.
To allow everyone to use create file in /etc/udev/rules.d/ with content:
  SUBSYSTEM=="usb", ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="2838", \
  GROUP="adm", MODE="0666", SYMLINK+="rtl_sdr"

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1.3.Check if works

How to test if rtlsdr works? Run one of commands:
  rtl_test

I like to run rtl_adsb as you can see there that something is recieved and
you see that everything "works":
  rtl_adsb

There should be line by line showing up some "hex" lines. If some data is showen
then adsb data from plains is recieved.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+                            2.Collection of tools                             +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2.1.FM

Get some sound trancmited from FM radio stations.

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


++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2.2.Spectrum diagram

Scan spectrum to find some activities on different frequencies.
Good link with all description is http://kmkeen.com/rtl-power/ . 
Main usage of rtl_power is :

  rtl_power -f 76M:108M:125k -i 1 fm_stations.csv

and then draw image :

  heatmap.py fm_stations.csv fm_stations.png

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2.3.ADSB

ADS-B ( Automatic dependent surveillance broadcast ) in simple words airplain
geoposition, speed, height and flight number broadcasting. You can recieve
this data and see how many plains is around and sometimes flight number.

rtlsdr have default one rtl_adsb programm but it shows only recieved data,
without any decoding. Here is dump1090 specifically for rtlsdr and nothing
more:

  https://github.com/antirez/dump1090

description howto install could be found also here

  http://www.satsignal.eu/raspberry-pi/dump1090.html

Using in interactive mode with height in metrs:
  
  dump1090 --interactive --metric

Output:

  Hex    Flight   Altitude  Speed   Lat       Lon       Track  Messages Seen .  
  ------------------------------------------------------------------------------
  71be01          10052     1009    36.434    33.544    45    9         1 sec
  424913 SDM6329  10966     711     36.440    33.405    221   65        0 sec


++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2.4.AFSK1200

Gqrx is graphical SDR software where you can travel across frequencies
and in real time search for some transmission.

  http://gqrx.dk/

It have builtin AFSK1200 demodulator or in simple words ham radio packets.
And you could try to see what people sending in tex around the world.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+                        3.Projects where rtlsdr used                          +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3.1.WebSDR

WebSDR probably best site where you can go and click on some radio reciever 
and liste what happends in some particular country. WebSDR site contains
about 80 radio recievers around the world that can be accessed trought web
interface. 
  http://websdr.org/

If you whant setup your own radio reciever read FAQ, prepare mail and send mail
after that you could recieve precompiled websdr software with is easy
to setup with rtlsdr stick.


++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+                                 4.Problems                                   +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4.1.Sync errors

Once there was sync error when was trying to use rtl_test or rtl_adsb.
To fix that changes for better quality usb cable.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+                                   5.Links                                    +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
[1] http://kmkeen.com/rtl-demod-guide/
[2] http://kmkeen.com/rtl-power/
[3] http://sdr.osmocom.org/trac/wiki/rtl-sdr
[4] http://www.rtl-sdr.com/
[5] https://github.com/antirez/dump1090
[6] http://gqrx.dk


++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+                                 6.Changelog                                  +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
24aug2014   just initial writeup
5nov2014    prerealese