DIY Kinematic GPS Using RTKLIB

This is a post that has been a long time coming. Over the winter break, one of the projects I took on was to build a survey-grade GPS system that could calculate its position using either Real Time Kinematics (RTK) or Post Processed Kinematics (PPK). These technologies allow a user to achieve GPS measurements accurate to <10cm resolutions or in some cases even sub-centimeter accuracy. In comparison, a traditional GPS module found in a phone or quadcopter would get an accuracy of 2.5m at best.

How does it work?

Before we start discussing kinematics, we first need to look at how GPS systems work. To avoid a giant wall of text, I will leave you with a very well made video below which discusses how GPS works. If you already know how the GPS receiver uses trilateration to calculate its position, you can feel free to skip the video.

To get a higher accuracy than standard GPS, we need to add some sort of correction which will improve the signal. A common example of this is the Wide Area Augmentation System, or WAAS, which uses a set of surveyed base stations to correct the natural positioning drift caused by ionospheric delay. The correction signals are calculated by measuring how far the GPS base stations drift from their actual surveyed position and transmitting this signal to a geostationary satellite. The geostationary satellite then rebroadcasts this signal back to the earth’s surface on the same frequency as standard civilian L1 GPS. The end result is a positioning solution that is accurate to approximately 1m which is good enough for instrument approaches in manned aircraft.

A similar technology, Local Area Augmentation System, does the same corrections but instead of using a satellite to rebroadcast the signal it uses VHF frequencies to transmit the signal. The accuracy can be improved slightly to 0.9m using such a system but the range of the correction signal can be quite limiting.

The problem with the above systems is that they rely on “time of flight” measurements to calculate their position. That is, they know how long it took the signal to travel from the satellite to the receiver. This gives a decent positioning accuracy but the precision is limited largely by the hardware being used to gather the timing information.

Kinematic based solutions put themselves apart from traditional measuring systems in that they rely on the carrier wave of the signal instead of the time of flight. This means they are measuring positioning differences using the phase shift observed from the base compared to the rover. The further apart they go, the more the phase angle increases which can be used to calculate the position of the rover with respect to the base. The result is an accuracy of anywhere from 0.5cm to 20cm. The main limitation however is the range as most systems are going to have a good accuracy within only a few miles of the base station

The Hardware

To start off, I had to find a suitable receiver module capable of outputting raw timing information. This was actually more difficult than I thought as the market tends to be either littered with clone modules that are missing critical components or extremely expensive with solutions like the Emlid Reach costing upwards of $700 per unit. Eventually I found the uBlox NEO-M8T which fit the bill and only cost about $75 from CSG shop. I also ordered their high performance amplified GPS antenna for an extra $20. After it arrived, I had it connected to my computer by USB and receiving satellite signals in a little less than 20 minutes.

The Software

As I began doing my research on the subject, I discovered an open source project known as RTKLIB. Designed by a university student in Japan, the project integrates functions for both real time and post processed kinematics and is very well documented. The project has many forks that each have their own purpose, but for this post I will be primarily discussing the Demo5 fork which seems to have a lot more recent development than the original RTKLIB project.

In the image above, you can see all of the windows that RTKLIB has to offer. The main one we will be focusing on here is the RTKNAVI window which is the component used to do RTK calculations. It has 3 segments with the left most one showing the current position and what kind of solution it has. The middle segment shows the base and rover satellite count and signal strength and the right most segment shows the ground track over time.

Since I only have one GPS receiver, I had to use internet based corrections. My initial tests with the Indiana CORS network ended poorly as they use an unusual proprietary communications protocol to access their NTRIP caster. I was simply unable to find a mount point using RTKLIB, so I had to find an alternative. This is where RTK2GO comes into play. It is a free and open source alternative to the CORS network which gives users the ability to run their own base stations and upload the data to their network. It appears to be especially popular in Europe but the United States doesn’t have anywhere near as many stations available through their servers. The closest station is in Auburn Hills, Michigan. This town is almost 250 miles away, so I don’t expect the corrections to be precise but it should work for testing to see if I can get an RTK fix.

In the above image, you can see some of the effects I was expecting. When the GPS module gets a fix (shown in green on the ground track), the drifting slows down significantly. It still drifts by several meters but this is likely caused by the absurdly long distance between the base and the rover. Since making this post I have ordered another receiver set so I can set up my own local corrections base and fix this issue.

Going Wireless – Adding Telemetry

Having RTK is great, but if you need to run wired cables between the base and rover you would be better off using tape measures. To get around this, most commercial RTK systems use either cellular or radio based communications to bridge the gap. I opted to use some spare telemetry modules I have had laying around for some time and modify them to better suit my needs.

The modules in question are a pair of Digi 9XTend modules which came in enclosures from a few crashed Precision Hawk Lancasters. These are transparent link modules that present themselves to the computer and GPS module as nothing more than a cable connecting the two points and are capable of pushing up to 1W of power at 115200 baud. An image of the telemetry module and the NEO-M8T can be seen in Figure 4.

By default, these boards were designed to run off of an external battery pack which ran an internal 5v regulator. I instead felt like having the rover powered off of USB power since USB battery packs are cheap and easily found online. I traced out the entire board in different colors of sharpie to identify the purpose of each line and quickly figured out that a simple adjusting of a jumper could change it over to USB operation.

After tracing out all of the connections on the circuit board I realized there was a lot of wasted space on the board as can be seen in figure 5. I marked it off using purple sharpie to make note of it in later steps.

With all of the free space available, I began to think about how easily I could make this smaller and portable. A few minutes with a dremel left the board open enough to fit the GPS module in the same enclosure as the telemetry module. Figure 6 shows my planned layout but the SMA antenna connector on the GPS module will have to rotate 90 degrees to point out the hole.

The next step was to break out the soldering iron and attach the GPS module to the telemetry module board. This was a simple task which I’m not going to go too heavily into details about but the GPS module can be seen in figure 7. The UART and power lines from the GPS module were connected to the telemetry module and the serial connector used to connect the telemetry module to USB was disconnected. The final result can be seen in figure 8 where the entire system is contained within a single enclosure the size of a deck of cards. This self contained unit will only need an external USB battery bank and a GPS antenna to be operated in the field.

Conclusion

To sum it all up, I have built a system that is capable of using RTK corrections to get a high precision positioning solution. The self contained unit I built could serve as either the rover or the base station depending on the use which makes this a very versatile system. I plan to put RTKLIB on a raspberry pi for field use and test it against a commercial RTK system in the coming weeks. Future applications could also include this being added to the Matrice 100 for increased accuracy in mapping missions.

http://www.ryanf.net/2019/02/18/diy-kinematic-gps-using-rtklib/