RTLSDR Scanner GPS

Al's picture

Heat MapI've added basic GPS functionality to the RTLSDR Scanner.

The idea is if you've set up a GPS device it will record the location of each scan which you can then create a map of signal strengths to view in Google Earth, a GIS (Geographic information system) or an image viewer.

Once you have added a GPS (Edit->GPS Devices) and enabled GPS logging (Edit->Preferences), simply start a continuous scan as usual.  As each sweep of the frequency range is performed your location is added to it.  Currently the most up to date location is used before the sweep ends, because of this I recommend only using narrow frequency ranges for accuracy.  You may also want to increase the number of scans that are retained (Edit->Preferences) so you have a large dataset to work with.

After you've covered the are you wish to survey select File->Export map.  In this window select the centre frequency of the signal along with the bandwidth you want to average over, click update to display the heat map.  If you're happy with the results click OK and export the data.

 

Currently 3 type of GPS device are supported:
NMEA:  Serial devices (RS232, USB, Bluetooth) which provide NMEA data.
GPSd:  A daemon for Linux machines
GPSd (Legacy): Versions of GPSd < 2.91 such as gpsd-4-win.

 

This update does require the pySerial module:
Windows: If you use the Windows installer just run it again and select it in the Python section under 'Dependencies' or download it here.
Ubuntu: run sudo apt-get pyserial
Fedora: run sudo yum install pyserial
OSX with MacPorts: run sudo port install py-serial

 

As  I can't collect data in the field so I've only tried this with test data.  If you try this I'd like appreciate some feedback in the comments (even if it fails) so I can improve on it.

 

Categories: 

Comments

58

Click to view comments

I needed to change line 189 in location.py from:
return "{0:X}".format(checksum)
to:
return "{0:02X}".format(checksum)
in order to run GPS funcionality on my setup.

Great software anyway.
Greetings.

Al's picture

Thanks kasz, I've updated the code with this fix.

are you going to make the RTLSDR Scanner compatible with HackRF One?

Al's picture

I'd like to, unfortunately I can't afford to buy one.

It is not work for me ! Could you help me?

Al's picture

I'm in the process of writing an simple application which will allow the scanner to use the location sensors in Windows 7 and 8. Hopefully this will make things a little easier. I'll add a post when it's available.

I change the de GPS in device.py
ef __init__(self):
self.name = 'GPS'
self.type = DeviceGPS.NMEA_SERIAL

Now the test error is:
Starting...
could not open port u'localhost:2947': WindowsError(2, 'O sistema n\xe3o pode encontrar o arquivo especificado.')

Al's picture

Hi,

I'm guessing that your GPS is connected via a serial port. In 'Edit -> GPS Devices' set the type to 'NMEA (Serial)' and select the serial port from the drop-down list under 'Device'.
'localhost:2947' is the network address for your computer, at some point I'll change this window to be a bit clearer.

Hi Tks
I put serial port (com3), then select test and start.

But it in not work, just appear Starting... and not finish

I use pyseria l2.7

Wow this is great! Is there any way to use an iOS device as the GPS receiver? There is a tweak called TryGPSOut that allows one iOS device to be the GPS data source for another iOS device via Bluetooth. But I have no idea what data format it uses.

When I try to test the connection it gives me this

Starting...
Opening "COM13"
$GPRMC,192414.520,A,-0.000000,S,-0.000000,W,0.0,0.0,,,,A*5D
$GPGGA,000000.520,-0.000000,S,-0.000000,W,1,00,2.0,0.0,M,-5.7,M,,0000*79
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
Stopping...
Invalid checksum D, should be 0D
$GPRMC,192414.520,A,-0.000000,S,-0.000000,W,0.0,0.0,,,,A*5D

As you can see I am using NMEA (Serial) type because it is the only one with serial connection (virtual serial COM port via Bluetooth). I have no idea if the data is actually NMEA

Al's picture

Hello soooooil,

Those are NMEA sentences you are seeing except the latitude and longitude have a negative sign which incorrect. Normally negative coordinates are represented by 'S' or 'W' instead.
I've tweaked the code to be more tolerant of errors and I'll upload it soon.

Thanks! I have modified *.py files with differences from your github and now testing GPS works just fine!
But when I run the frequency scan it shows that same gps checksum error. After I stop the scan the Stop button is still active but when I click it nothing happens. In file menu almost everything is greyed out so I can't try and export the map.

This is the console output when I run and stop the scan
https://www.dropbox.com/s/jfnd6gi6etbjp8k/Screenshot%202014-05-29%2022.3...

Hi

I haven´t IOS device here..

Now the teste result in Edit GPS Device Nema(serial) is:

Starting...
Opening "COM16"
Stopping...
Invalid checksum c, should be C7
Invalid checksum c, should be C7

Hi,

LocationBridge its ok,
But 'NMEA (Server)' and set the device to localhost:10110, no
Starting...
Opening "localhost:10110"
timed out

And NEMA SERIAL Starting...
Opening "COM16"
(am
Stopping...

and a lot errors like this
unicodedecodeerror 'ascii' codec can't decode byte 0Xe9 in position 7: ordinal not in range(128)
unicodedecodeerror 'ascii' codec can't decode byte 0X96 in position 1: ordinal not in range(128)
unicodedecodeerror 'ascii' codec can't decode byte 0X96 in position 1: ordinal not in range(128)
unicodedecodeerror 'ascii' codec can't decode byte 0Xbb in position 0: ordinal not in range(128)
unicodedecodeerror 'ascii' codec can't decode byte 0Xa0 in position 0: ordinal not in range(128)
unicodedecodeerror 'ascii' codec can't decode byte 0Xef in position 0: ordinal not in range(128)

Al's picture

Hi valderez,

Can you post a few lines of the data you are getting (especially the ones starting with $GPGGA and $GPRMC)?

You can use a serial terminal to connect to the comm port (PuTTY is a good one for Windows).

Thanks.

Hi Al

Sorry I don´t understand were ?

In may terminal no apperar $GPGGA and $GPRMC.

Could you help me again?
tks

Hi Something is wrong
Using PuTTY in comm port gps the result is:
V
q2▒▒▒▒▒▒g!X▒oBJ▒١▒
Z▒.FK▒Z▒▒aZa(;▒▒▒P▒B▒`!▒▒BT/Ho/▒H)J/
▒▒▒
▒▒C#(▒BBh▒▒▒▒▒^8▒▒▒"稂▒ιC▒▒H▒)B)N▒▒▒2▒-D▒$▒▒▒c▒▒▒cFZI▒▒`▒Ǩ_▒▒▒^<▒#▒g▒▒I▒▒▒K▒▒H▒)b)N▒%O▒▒▒"'▒CIo"▒▒aFZ▒!C▒Je▒▒�3-▒Hl)$B(▒н▒!+z▒▒'-!▒▒▒▒▒K▒
▒6'
@cŬZеhH▒▒g▒!▒dC",)Hjb$J▒DK▒▒▒R(R*;K▒▒▒▒▒▒j=▒)mB^F▒
▒)d+Jg▒C▒▒%C"▒CZ▒k▒▒Z▒B▒ᒦ▒▒▒ ^8▒▒dDB:▒▒A"▒j▒▒U+▒OR▒F▒#ȅX▒
T▒▒▒Z▒aaq/▒NBR▒!B" ▒▒')!▒▒▒▒#▒

I´m looking another one Telenet

Al's picture

Either the device is not providing NMEA data or the serial port settings are incorrect, have you tried a different baud rate?

Hi, again,

Now I use GPS Test Device and the result is this:

$GPGSA,A,3,07,08,10,13,28,,,,,,,,4.9,1.6,4.6*3C
$GPRMC,020647.000,A,2334.1592,S,04639.2804,W,0.0,226.6,300514,,,A*6A
$GPGGA,020647.000,2334.1592,S,04639.2804,W,1,05,1.6,593.2,M,-4.3,M,,0000*4E
$GPVTG,226.6,T,,M,0.0,N,0.0,K,A*0D
$GPGLL,2334.1592,S,04639.2804,W,020647.00,A,A*6E
$GPGSA,A,3,07,08,10,13,28,,,,,,,,4.9,1.6,4.6*3C
$GPGSV,3,1,11,28,73,296,19,10,44,312,15,08,46,171,25,13,37,064,15*7F
$GPGSV,3,2,11,07,37,139,27,05,29,246,21,17,15,002,,26,13,220,*7E
$GPGSV,3,3,11,19,13,125,,23,08,050,,03,07,137,*48
$GPRMC,020648.000,A,2334.1592,S,04639.2804,W,0.0,226.6,300514,,,A*65
$GPGGA,020648.000,2334.1592,S,04639.2804,W,1,05,1.6,593.2,M,-4.3,M,,0000*41
$GPVTG,226.6,T,,M,0.0,N,0.0,K,A*0D
$GPGLL,2334.1592,S,04639.2804,W,020648.00,A,A*61
$GPGSA,A,3,07,08,10,13,28,,,,,,,,4.8,1.6,4.5*3E
$GPRMC,020649.000,A,2334.1592,S,04639.2804,W,0.0,226.6,300514,,,A*64
$GPGGA,020649.000,2334.1592,S,04639.2804,W,1,05,1.6,593.2,M,-4.3,M,,00

GPS work well in LocationBridge.exe and google earth

Tks

Hi Al

I´m here again.

Now the GPS test ok, but when I start scan ok, but the program isnt finish ,I clik stop but nothing.

Here is the terminal :

RTLSDR Scanner

Found Elonics E4000 tuner
Found Elonics E4000 tuner
Found Elonics E4000 tuner
Exact sample rate is: 2000000.052982 Hz
Traceback (most recent call last):
File "C:\Program Files (x86)\RTLSDR Scanner\main_window.py", line 820, in __on
_event
self.__progress()
File "C:\Program Files (x86)\RTLSDR Scanner\main_window.py", line 946, in __pr
ogress
self.__cleanup()
File "C:\Program Files (x86)\RTLSDR Scanner\main_window.py", line 961, in __cl
eanup
self.threadLocation.stop()
File "C:\Program Files (x86)\RTLSDR Scanner\location.py", line 270, in stop
self.notify.queue.clear()
AttributeError: 'FrameMain' object has no attribute 'queue'
Traceback (most recent call last):
File "C:\Program Files (x86)\RTLSDR Scanner\main_window.py", line 710, in __on
_stop
self.__scan_stop()
File "C:\Program Files (x86)\RTLSDR Scanner\main_window.py", line 924, in __sc
an_stop
self.threadLocation.stop()
File "C:\Program Files (x86)\RTLSDR Scanner\location.py", line 270, in stop
self.notify.queue.clear()
AttributeError: 'FrameMain' object has no attribute 'queue'
Traceback (most recent call last):
File "C:\Program Files (x86)\RTLSDR Scanner\main_window.py", line 710, in __on
_stop
self.__scan_stop()
File "C:\Program Files (x86)\RTLSDR Scanner\main_window.py", line 924, in __sc
an_stop
self.threadLocation.stop()
File "C:\Program Files (x86)\RTLSDR Scanner\location.py", line 270, in stop
self.notify.queue.clear()
AttributeError: 'FrameMain' object has no attribute 'queue'
Traceback (most recent call last):
File "C:\Program Files (x86)\RTLSDR Scanner\main_window.py", line 710, in __on
_stop
self.__scan_stop()
File "C:\Program Files (x86)\RTLSDR Scanner\main_window.py", line 924, in __sc
an_stop
self.threadLocation.stop()
File "C:\Program Files (x86)\RTLSDR Scanner\location.py", line 270, in stop
self.notify.queue.clear()
AttributeError: 'FrameMain' object has no attribute 'queue'
Traceback (most recent call last):
File "C:\Program Files (x86)\RTLSDR Scanner\main_window.py", line 710, in __on
_stop
self.__scan_stop()
File "C:\Program Files (x86)\RTLSDR Scanner\main_window.py", line 924, in __sc
an_stop
self.threadLocation.stop()
File "C:\Program Files (x86)\RTLSDR Scanner\location.py", line 270, in stop
self.notify.queue.clear()
AttributeError: 'FrameMain' object has no attribute 'queue'

Tks and regards

Valderez

Al's picture

Just uploaded a fix for that problem, should work now.

Hi Al

Tks agian, Now The program stop, but list the problems above:

RTLSDR Scanner

Found Elonics E4000 tuner
Found Elonics E4000 tuner
Found Elonics E4000 tuner
Exact sample rate is: 2000000.052982 Hz
Qt: Untested Windows version 6.2 detected!
log4cplus:ERROR No appenders could be found for logger (AdSyncNamespace).
log4cplus:ERROR Please initialize the log4cplus system properly.
Qt: Untested Windows version 6.2 detected!
log4cplus:ERROR No appenders could be found for logger (AdSyncNamespace).
log4cplus:ERROR Please initialize the log4cplus system properly.
Qt: Untested Windows version 6.2 detected!
log4cplus:ERROR No appenders could be found for logger (AdSyncNamespace).
log4cplus:ERROR Please initialize the log4cplus system properly.
Qt: Untested Windows version 6.2 detected!
log4cplus:ERROR No appenders could be found for logger (AdSyncNamespace).
log4cplus:ERROR Please initialize the log4cplus system properly.
Qt: Untested Windows version 6.2 detected!
log4cplus:ERROR No appenders could be found for logger (AdSyncNamespace).
log4cplus:ERROR Please initialize the log4cplus system properly.
Qt: Untested Windows version 6.2 detected!
log4cplus:ERROR No appenders could be found for logger (AdSyncNamespace).
log4cplus:ERROR Please initialize the log4cplus system properly.
Traceback (most recent call last):
File "C:\RTLSDR Scanner\main_window.py", line 549, in __on_export_geo
image = dlgGeo.get_image()
File "C:\RTLSDR Scanner\dialogs.py", line 528, in get_image
width = self.extent[1] - self.extent[0]
TypeError: 'NoneType' object has no attribute '__getitem__'

My android has gps and i can run rtlsdr with the rtlsdr driver.
is it possible to run it on a android?

Al's picture

Hello Bernd,

It won't run on Android but a port is on my wish list.

Hi Al

When I click "export map" appear new box with text " Insufficiente gps data" , just white screen.

And when save in this way, nothing save: in kmz file - file isn´t appear , in cvs file is empty.

Tks and regards
Valderez

Al's picture

Hello,
When you test your GPS device using RTLSDR Scanner do your coordinates display correctly? If so it sounds like you are not moving around enough to get a sufficient spread of locations to generate a map.

Hello Al
Yes, the coordinates that appear are correct.

I did several tests, sweeping ranges of frequencies, eg 88 to 216 MHz, or 420 to 700 MHz over a distance of 200m, 500m, 1 km, 2 km, the options single or continuous. (With GPS on, and clicked on configuration)

And in all cases the same message appears.

Certainly , I'm doing something wrong.

Could you help me, telling me about what is the right set-up to get this information from GPS? Eg: range of frequencies, single or continuous mode, the travel time, or how many meters or kilometers I move around, etc..

Many Tks
Valderez

Hi, Al.

Just want to say thank you for your great software and show the results of scanning of GSM downlink band as a heatmap using Google Maps API -- http://www.tautology2.net/heatmap/

Regards,
Alexander

Al's picture

Hello,

Thanks, it's interesting to see as I'm going to add a heatmap export function soon.
I guess you parsed the RFS file directly, I decided to store the data as JSON so it was easily accessible even though it's inefficient, precisely for this kind of usage.

Yes, I was happy to see that RFS file is in JSON format, great decision.
Got a minor glitch in the 'Export image sequence' dialog: it throws exception when I try to change DPI settings.
This patch fixes it for me: https://gist.github.com/ati/f68673b2e255a7a463a5

Al's picture

Thanks, glad it was of use to you and good work with the software (which others reading this can find at GitHub).

I've patched the master with your diff, again thanks, especially because otherwise I could have missed this for quite a while.

Is there a method or example if using GPS with rtlsdr_scan.py file without using the GUI interface? I understand the rtlsdr_scan.py arguments, but not sure about incorporating GPS at the command line? Help is much appreciated!

Al's picture

Currently the CLI doesn't record GPS but I have been working on it, there's a few bugs still left and hopefully I'll push the new code in the next few weeks.

Currently the idea is that a simple configuration file is used to set the GPS parameters which the CLI application can read. Otherwise there would be far too many command line switches for all the configuration permutations.

Thanks! Can't wait to use rtlsdr_scan.py in tandem with gps via command line.

Al's picture

I've just pushed some code which should do the job, basically specify a configuration file with the GPS port settings ('-c' switch).
It only supports serial GPS devices for the moment, see this example.

The manual has been updated and there's a FAQ entry.

Hope that helps.

Was wondering if I could use this same configuration on an Ubuntu 14.04 system? If I change the port from 'COMX' to /dev/ttyUSB0 it will work the same with my USB GPS (BU-353)?

Al's picture

AFAIK the BU-353 will output NMEA sentences so it should work.

When I try to run CLI on Kali as follows:

python rtlsdr_scan.py -s 433 -e 434 -g 41 -w 1 -c ../conf/gps.conf scan.rfs
(specifying /dev/ttyUSB0 and 38400 baud in gps.conf)

I get the following error (GUI approach works fine with GPS):

Found Rafael Micro R820T tuner
[R82XX] PLL not locked!
433 - 434MHz
1 Sweeps
40.2dB Gain
0.131s Dwell
1024 FFT points
0MHz LO
Generic RTL2832U OEM

Waiting for GPS: 38400-8N1
Exception in thread Location:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
self.run()
File "/root/RTLSDR-Scanner-master/src/location.py", line 320, in run
self.__nmea_read()
File "/root/RTLSDR-Scanner-master/src/location.py", line 218, in __nmea_read
for resp in comm:
File "/root/RTLSDR-Scanner-master/src/location.py", line 131, in __serial_read
data = self.commIo.readline()
File "/usr/lib/python2.7/encodings/ascii.py", line 30, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0x80 in position 0: ordinal not in range(128)

^C
Aborted

Any suggestions? Thanks.

Al's picture

Hi Art,

Sorry for the delay, I'll get a fix out soon. Just out of interest what's the GPS unit you're using?

Hi Al:

I am using a GlobalSat BU-353-S4 GPS receiver.

Art

Al's picture

Thanks.

I've just pushed some new code up improves the serial handling, as a side effect of this it should fix your error.

The problem was that it wasn't ignoring the extra data that the GlobalSat unit was sending, with any luck it should now.

Hi Al:

The new code works fine for 1 sweep. When I set the sweeps to say 5 I get
the following output (only sweep 1 is 100%, sweeps 2 and 3 give errors and then
it hangs. Sometimes I get sweeps 1 and 2 done 100% but sweeps 3 and 4 give
errors):

python rtlsdr_scan.py -s 433 -e 434 -g 41 -w 5 -c ../conf/gps.conf scan.rfs
RTLSDR Scanner

Found Rafael Micro R820T tuner
[R82XX] PLL not locked!
433 - 434MHz
5 Sweeps
40.2dB Gain
0.131s Dwell
1024 FFT points
0MHz LO
Generic RTL2832U OEM

Waiting for GPS: 4800-8N1

Sweep 1:
Starting
Found Rafael Micro R820T tuner
[R82XX] PLL not locked!
Exact sample rate is: 2000000.052982 Hz
100.0%

Sweep 2:
usb_claim_interface error -6

Sweep 3:
Starting
Error: Error code -6 when opening SDR (device index = 0)
Found Rafael Micro R820T tuner
[R82XX] PLL not locked!
Exact sample rate is: 2000000.052982 Hz
^C

Art

Al's picture

Thanks again Art, I've just fixed that problem (fingers crossed!).

Thanks Al it is working now.

Art

Al's picture

Great, glad to hear that!

Hello Al, I have got your software up and running and must compliment you on the result. I would like to use this on my laptop with gps location to track power line poles which are generating electrical, very detrimental to hf communications. I am a little confused (not a Python person) about the current capability. I have a Holex Bluetooth and USB capable gps but having no luck interfacing it to Scanner software. Two questions, is the current software Bluetooth compatible and also is it able to interface at USB level?the gps is NMEA format. Do I need to download additional software to make it work?
A third question, can I use my iPad and export the gps data to Scanner via Bluetooth?
Hope you can help me I am really excited about the potential to solve power line noise problems
Kind regards Howard

Al's picture

Hi Howard,
An interesting use for the software, thanks for getting in touch.

It will be easier to use your GPS via a USB connection but Bluetooth should work as well. The idea is once connected a new serial port will show up on your machine and you point the scanner to that.
The serial port name depends on your operating system, which do you use Linux, OS X or Windows?

To use the iPad GPS I'd try searching iTunes for something like 'GPS NMEA' or 'GPS Bluetooth', a few matches come up but I don't have one to try it out.

Hi Al, I am using windows 8.1. I have got the gps talking on bluetooth to a test program on the laptop, all operating ok.When I click on Edit GPS I get GPS - GPSd - local host 2947.
I am receiving the gps via bluetooth on com 4 at 38400 baud rate in my test program, seeing normal NMEA sentences and displaying location data ok.
When I try to connect to scanner i get the following error message - GPS (error no 10061) no connection could be made because the target machine actively refused it.
Tried everything I can think of but no luck, obviously missing a step here!
many thanks for replying, hope the solution is simple.
regards
Howard

Al's picture

Almost there!
Go back to the Edit->GPS and click where it says 'GPSd' and select 'NMEA' Serial from the drop-down list.
There is a bug that causes the scroll bar to hide the list at first but click on it again an it should show it (still trying to fix that!).

The 'Host' column should now change and by clicking the cell you should be able to select COM4 from the list and the 38400 baud rate.

Bingo!

Thanks Al, GPS now working perfectly with Bluetooth connection from Holux 286 at 38400 baud.
next challenge is to save files as a heatmap in Google earth, any pointers you have would be welcome.
Once again many thanks for your help. Will keep you in touch with results as we progress. regards Howard

Al's picture

Lovely!

To export the heatmap, click 'Export map' from the file menu.

Hi Al, I have been delayed with this project due to a birth and a death in the family last week. Hoping to get back to it now!
in 2013 Bill wrote... In order to get the Noise floor more close to reality, I modified line 1448 in rtlsdr_scan.py.
I'm guessing it should be around -110 dBm in a 2 MHz BW (Sample Rate of 2,000,000 samples/sec).
By default I was seeing a noise floor of around -50 dB as indicated in plots, so I subtracted 60.
power = 10 * math.log10(scan[freq]) - 60
Then used only enough gain so as not to increase the noise floor upon scans..
Does this sound reasonable?

I would like to display this range of signal levels as an S9 signal is around -72dB and the noise I am looking for is around this level or lower. I have downloaded VIM + Cream editor and looked at all the Python files but cant find the area of the program Bill refers to. I guess the files i have down loaded are already compiled ( i am not Python savvy). Is there any easy way I can modify what I have (which is working well) to achieve the -100dB to - 40 db scale on the display? best regards
Howard

Al's picture

Hello,
The code you are looking for is on line 207 of scan.py.

There are two types of Python file; the original '.py' and a compiled version that is generated when it's first run, ending in '.pyc'. You can safely ignore the pyc files.

Remember the offset will change with the device gain.

GPS Operation crash

Hey there, firts let me say this is a great program, best one I've try with
the dongle.

Exactly after I do :

Go back to the Edit->GPS and click where it says 'GPSd' and select 'NMEA'
Serial from the drop-down list.

The program crash it says python has stopped working and my console says
error 255, what do you think it could be?

(This is happening in windows10, I've testing for a few weeks everything else
works perfect)

Al's picture

Hi,

Thanks very much, glad you like it.

It might be worth updating wxPython to the latest version, try this download and see if it helps.

 

I have installed the scanner and it all works fine but I can't get it to record the GPS info when I export it as a map, it just comes up Insufficient GPD Data.
If I export the GPS track it lists the times and locations , in the bottom status bar it shows GPS Enabled with my current coordinates . I did read you need to enable Use GPS in the Preferences but this option doesn't show up in my preferences.

Click to add a comment