High accuracy GNSS positioning has always been associated with expensive commercial solutions. So I was pretty thrilled when I first heard about RTKLIB. Developed for the past seven years by Tomoji Takasu, RTKLIB is a free open source software for GNSS data processing. It has an impressive list of features, decoding of multiple formats (including the latest RTCM 3.2), NTRIP support, multiple constellations support, post processing and real-time processing ranging from single point positioning to RTK to PPP.
A great thing about RTKLIB is that it is highly portable. It is written in standard C and can be compiled on many different operating systems and platforms, including the hugely popular Raspberry Pi. Run the free RTKLIB on a fifty bucks Raspberry Pi connected to a low cost GNSS board (such as the u-blox LEA-xT series), now you have access to centimetre level positioning without the thousands of dollars price tag.
Compiling RTKLIB on Raspberry Pi
The RTKLIB suite consists of a dozen programs which can be grouped into those with graphical user interface (GUI) and those with command line interface (CLI). The GUI programs run on Microsoft Windows only but the CLIs can be compiled to run on other operating systems and hardware platforms including the Raspberry Pi. I use Raspbian (Wheezy) on the RPi here.
The complete source package of RTKLIB (rtklib_<ver>.zip) can be downloaded from rtklib.com. The CLI program that does real-time positioning is called RTKRCV. Unzip the package and locate the source code for RTKRCV in rtklib_<ver>\app\rtkrcv. Navigate to the gcc directory underneath it.
The makefile can be used out of the box but if you prefer you can customise it. Raspberry Pi has a pretty slow CPU so I added several compile options in a – probably vain – attempt to optimise RTKRCV for the RPi. Edit the makefile and modify the CTARGET line to include the options below. Keep the existing options.
CTARGET = -march=armv6 -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -ffast-math
Now run ‘make’ to build RTKRCV. Go and get coffee.
The install routine in the makefile will copy the rtkrcv binary into /usr/local/bin. Personally, I just setup a separate directory for RTKRCV in my home directory and keep all related files in there.
sudo mkdir ~/rtkrcv sudo cp rtkrcv ~/rtkrcv sudo cp *.sh ~/rtkrcv sudo cp ../*.conf ~/rtkrcv
Test that the build was completed properly by running RTKRCV.
cd ~/rtkrcv ./rtkrcv
RTKRCV might complain about missing options file and navigation data but you will get to its console like below.
RTKLIB is highly configurable and there are numerous options in RTKRCV which makes setting it up pretty daunting. For my initial test, I wanted to see RTKRCV solving RTK solutions, the most accurate solution possible. There are too many options to discuss here but you can download this zip file (rtkrcv) which includes the RTKRCV binary and two configuration files, single.conf (for single point positioning) and rtk.conf. Obviously you will need to change the connection settings to match your equipment.
When running, RTKRCV goes into console mode from which you can issue a number of commands. You may need to memorise the commands if you are going to use RTKRCV regularly. Alternatively, for most applications, these would be scripted. In the screenshot below, I started rtkrcv, loaded a config file (rtk.conf), restarted it to enable the new config file and then asked it to show the solutions. The fix solution was obtained within 4 seconds and you can see the accuracy increasing immediately from metre level to centimetre level.
A bunch of numbers are not that fun to look at so I used RTKPLOT (part of RTKLIB) running on a separate Windows PC to connect to the Raspberry Pi and plot the coordinates computed by RTKRCV. The plot below shows two instances of RTKRCV running. The green dots (Number 1) are the RTK solutions while the red dots are the standard single point solutions.
We can zoom into the green dots (RTK solutions) to see what sort of accuracy they have. As you can see from the plot below, the coordinates produced are within 2 cm.
GPS/GNSS board to use
Okay, so it is fun to have a free RTK software running on cheap and small computer but a suitable GPS/GNSS board is still needed to make the actual raw measurements. Things get tricky here. There are no shortage of cheap and small modules that produce coordinates but there are very few that would produce raw measurements suitable for processing by RTKLIB. I mentioned earlier the timing series board from u-blox. You can buy an evaluation kit from u-blox for $349. Alternatively, you might want to try the RasPiGNSS expansion board. It is around $200 and you can attach it directly to the Raspberry Pi.
These products track single frequency only. If you want cm-level accuracy within seconds like the example above, dual frequency tracking is needed. This is where it gets expensive. An L1/L2 board like the Trimble BD920 has a list price of around $1,200.