Wednesday, December 16, 2015

First proof-of-concept: A GPS Fix in Windows using an RTL-SDR stick

Using a $20 RTL-SDR stick with 1ppm TXCO and a simple mod to power an active GPS antenna, it is possible to download and decode GPS signals in real time.


Both packages are Open Source, with a default build target is Windows.

Both packages are Open Source (GPL2 and BSD 2-clause, respectively). The default build target for both packages is Windows, although RTKLIB has been compiled under Linux.

Please note that GNSS-SDRLIB is not to be confused with GNSS-SDR!

Useful presentation by the author of GNSS-SDRGUI for a summer school course. Also check the manuals included with GNSS-SDRLIB and RTKLIB.

Step-By-Step Implementation
  1. Ensure RTL-SDR stick is working in Windows. If your driver is not working, try using the Zadig driver installation method outlined here.
  2. Install GNSS-SDRLIB and RTKLIB to any convenient directory
  3. Open GNSS-SDRGUI and select the following options
    1. Input Type: RTL-SDR
    2. [x] RTCM MSM, Port 9999
    3. Change "output interval" dropdown to 10 hz
    4. [x] Plot Tracking
    5. [x] All GPS, GLOSNASS, Galileo satellites 
    6. (optional) enter approximate lat/lon into MISC and click the "..." button to get  current satellite locations in relation to your location.
  4. Click "Start", a number of command consoles will open then close for each satellite being tracked.
  5. Click "M" for log
  6. Now, open RTKNAVI
    1. Click on the "I" button
      1. check "rover", type TCP Client, format RTCM3
      2. click OPT button and set address to "localhost" and port to "9999"
      3. click OK
      4. Click OK
    2. Click on the "start" button
    3. Within a few seconds you should see satellites in the Rover:Base SNR pane
    4. Once a solution exists it will update lat/lon in the left pane
    5. Click "Plot" to generate a plot of the random walk of lat/lon over time

This is what your GNSS-SDRGUI should look like:

This is what your RTKNAVI input should look like:

If everything is working you should get a GPS solution, as shown in this video

Next Actions
Try using GNSS-SDR and/or GNURadio to decode the GNSS signal; this would provide native, Linux compatible headless execution and a cursory Google suggests this has been done successfully with the RTL-SDR stick. 


  1. Have you tried using this as a NTP server?

  2. Is there any way of selecting which RTL-SDR device we want to use in GNSS-SDRLIB GUI? For some reason, on my system, every RTL-SDR device show up as two devices: 0 and 1. The device 0 never works, but device 1 works fine. The GUI always wants to work with device 0.

    1. My stick only shows up as one device, 0, and it seems to work fine, sorry I can't be more help. You could try contacting the author his email address is in the documentation. Personally I've moved on to gnss-sdr under Linux, there's a definite learning curve but it is more configurable.

    2. I'll definitely try running this under GNU/Linux as well! I hope it help a little bit. I'll also see what the author says about the issue.

      Thanks for the response!

    3. I had the same issue, download Visual Studio 2012 and pull the latest zip from Github. Then edit lines 34 and 37 in rtlsdr.c (found under GNSS-SDRLIB-master\GNSS-SDRLIB-master\src\rcv\rtlsdr) and change:

      "int ret,dev_index=0;;" to "int ret,dev_index=1;;"

      "verbose_device_search("0")" to "verbose_device_search("1")"

      Save and build solution, it should work now. Note that this hack will prevent it from working with devices numbered 0 and a real solution would be for it to test 0, 1, 2... and choose that which works.

    4. Thanks Techmeister! As mentioned earlier I did this as a first proof-of-concept but I've since moved on to gnss-sdr which is built off of gnuradio and is more research-oriented.

    5. I recently got an rtlsdr and read your blog to try GNSS-SDRLIB. The response was for Unknown/randoms who come here as this issue should be fairly common and the author won't respond via email/Github.

      No GPS antenna here so my reception sucks and rtklib never prints out a co-ordinate or gets a fix. GNUradio is next on my list, thanks for these primers.

    6. You are welcome! Let me know how gnss-sdr works for you.

  3. Installed and adjusted all settings as explained.

    After a few seconds when all the CMD windows are disapeared I think program is running ok.

    See a lot of values passing by in the monitor window.

    But my problem is that nothing is passed through to RTKLIB.
    When I open the monitor window in RTKNAVI no data is comming in. Checked settings again but no working.

    Is there a way to check for proper data sending to rtknavi ?

    I would be so happy to get this working ......

    1. Did you make sure to set the format to RTCM3? In the GNSS-SDRLIB output window (click "M" near "start" button) do you see any message "connection from"? If not, RTKNAVI isn't connecting to the stream.

      It's also possible everything is just fine and you just arent getting a strong enough signal - are you using an active antenna? Did you do the bias T mod? Outside with a clear sky?

    2. Was A solution for this found?

  4. I tried with a bias-tee and with a gps antenna splitter. Also i tried with a LNA, but never got a result. GPS receiver on splitter is receiving 8 sat's with 50db.
    Also I checked if RTKNavi is listening and GNSS_lib is sending. When I check the option Output rinex, the rinex file stays empty exempt the data headers. How should I read the output from M ? Also I think windows 10 which I'm using is the spoiler.

    1. I was using Windows 7. I'm not quite sure. Honestly as soon as I got the proof of concept working I moved on to using gnss-sdr under Linux. It sounds like a communication problem between gnss-sdrlib and RTKNAVI. Check firewall?

  5. I will try to get a windows 7 machine, and try again.
    Thanks anyways !
    I will follow your blog.

  6. This doesn't appear to be working with one of the new software bias enabled RTL-SDR V.3 dongles. I'm not seeing any TCP output from the GNSS-SDRLIB-GUI program. Checking with HDSDR at 1575.420 MHz I do see an increase in noise when the bias-T is software enabled. I'm using a puck GPS antenna in a location where other antennas work correctly, and both programs appear to be allowed through the Windows Firewall. Trying a terminal program to connect to TCP (raw) shows no output. Dongle ppm error is 0 +/- 0.5 when checked with Kal.

    1. I haven't had a chance to try the V.3 dongles - I just had an older one which was hardware modded. 0.5PPM is great. The GPS signal lives below the noise floor, but if you have linux/gnuradio you can confirm whether or not you are hearing it by doing a fast autocorrelation and seeing if you can recover the chipping rate of 1ms.

      I'd suggest giving SoftGNSS a try if you have a Matlab license. If not, and you are comfortable in linux, gnss-sdr.

  7. Thanks, Philip. I do have a Raspberry Pi but not the software to which you refer. Nor do I have a Matlab licence. I saw one comment which suggested the software didn't run on 64-bit Windows, and I recall the RTL DLLs may be 32-bit, but other 32-bit RTL software works (I tried HDSDR). There's indication that anything is working, other than a considerable CPU increase when GNSS-SDRLIB-GUI is running. No error messages such as "can't find device".

  8. Checking further I think it's a temperature issue with the dongle. I moved the puck which meant unplugging and replugging the dongle, and it worked showing at least one satellite with an SNR of over 40 dB. For a few minutes that was OK, but then the SNR deteriorated after 8 minutes, and was down to ~20 dB after 10 minutes. The SDR-RTL v.3 dongle feels quite warm at this time. I think the is repeatable and well-known behaviour. Oh, that the program supported the Airspy hardware!

    1. Hi David, after the initial proof-of-concept I stopped working with the GNSS-SDRLIB / RTKLIB combo in favor of gnss-sdr and OpenGNSS. The former is well supported and built on gnuradio, the latter requires Matlab.

    2. Hi,

      I'm trying to view the data the gnss-sdrlib gets in rtknavi but I'm facing a problem. After I press start at the rtknavi it doesn't display anything. It says "timeout" after few seconds then attempt to connect again. In the gnss-sdrlib log I can see it says "connection from" but still the rtknavi doesn't show anything.

      Can you please help me with that?

      Thank you!

    3. Same problem here. Any help?

    4. I have not run the GNSS-SDRLIB/RTK combo since this initial proof of concept. I have been using gnss-sdr instead. Sorry I can't be more help - I havent kept up with the code changes etc.

    5. Thanks for the response. To gnss-sdr I go!

  9. Hello,

    Is the tracked location map contain the location of near by devices ?


  10. Hopefully someone can help. I get everything to run perfectly, then after about a minute or so I get an error "GPS subframe number x" then RTKPLOT will not update. What could I be missing? Thanks!

  11. hii please tell me i am from india and here i have used v3 version of the sdr dongle and active antenna so there is no need of bias tee because v3 version give the software based bias tee that i have activated then also nothing is received.

    1. This comment has been removed by a blog administrator.

  12. please give me reply as soon as early i needed it.

    1. Is the rtl-sdr connected to an antenna placed outside with a clear view of the sky? A cheap GPS puck antenna is around $8 on Amazon/Ebay.

  13. thank you for your articles
    I am in Win10 and I am having difficulty getting my RTL SDRV3 recognized with RTL SDRLIB. When the program starts, it indicates an initialization error. What can I do ?
    Thanks for your help !


  14. Shock Absorbers for Sale in Ghana

    Are you looking to buy a vehicle then get the best deals today on AutosGhana, We provide the Mercedes Benz Parts, new Cars & Shock Absorbers for sale in Ghana, call us +233 0240541530

    to get more -