Exploring GPS Systems with the PmodGPS

Fall quarter 2018 at UW Bothell, I took my first EE elective course: Sensors and Sensor Systems. The course was project based, meaning half of our time and grade involved a group project. In my opinion, we were rather rushed into deciding a project and ordering parts for it. Not only did we have to make-up a problem to fix, but we had to order the parts for it within a week. We decided we wanted to try and develop a system for group GPS tracking and local environmental data reporting. We thought this could be a useful system for people exploring the outdoors where signs and other means of location reference might not be available or obvious and help group member locate each other or a reference location like a base camp. Due to incompatibility with some of the parts we ordered and learning curves associated with using Wifi, we had to make many modifications and patches with our system and hardware to make it work by the end of the quarter. I have posted two projects on Hackster.io illustrating the overall project (using Arduino Mega and Raspberry Pi microcontrollers) and a more focused project (using an Arduino Uno microcontroller) about the GPS with all code available via Github. Now, back to the article.

The Pmod GPS has quite a bit of functionality to it. On top of reporting latitude and longitude, you can report altitude, speed, time, number of connected satellites, and heading. With all this, you can do some computation and report even more like the distance between you and some other point, the angle in which you are to that point, how fast you are approaching that point, what time you will arrive at that point, and whatever else you can think of!

The PmodGPS in all its glory.

There are 24 satellites orbiting the Earth at about 20,000 km for the purpose of GPS. These satellites are the transmitters and our PmodGPS is a receiver. GPS satellites broadcasts two carrier waves: L1 (1575.42MHz) and L2 (1227.60MHz). These frequencies are chosen such that they eliminate what is called ionospheric dispersion, which causes systematic range errors due to properties of waves passing through the ionosphere. What is called the pseudorange is a calculation of the distance between the satellite and the receiver. The pseudorange is not the actual distance from satellite to receiver, there are many 7 biases and environmental conditions that affect this calculation. Our report in the overall project shows the pseudorange equation and a description of its variables. Multipath takes into account the transmitted signal bouncing off objects before getting to the receiver. There are two pseudorandom noise codes (PRN) that are modulated onto the carrier frequencies. The Course/Acquisition-code (C/A-code, wavelength of 300 meters) is modulated onto L1 and the Precision-code (P-code, wavelength of 30 meters) is modulated onto L1 and L2. The P-code is not authorized for civilian use so that the government can control the level of accuracy available to the public. To transmit the signals from the satellites involves transmitting a carefully formulated code called pseudo-random sequences. The received signals and the transmitted sequences are compared, and the travel time for the signal is found by measuring when the two signals are most closely correlated.

Cool GIF from: https://en.wikipedia.org/wiki/Talk%3AGlobal_Positioning_System/Archive_6

Determining the position of an object on Earth is called ranging. For a GPS receiver to accurately determine its position, a minimum of four satellites are needed. Three are needed for the three physical dimensions but a fourth satellite is needed to help compensate for the effect of spacetime relativity. The satellite orbits are such that at least 4 are visible at anytime from any point on Earth and every satellite uses an atomic clock with a nominal period of 1 nanosecond. To harness such resolution, the actual period must be determined with an accuracy of about 20 nanoseconds and requires taking into account General and Special Relativity theories.

Four satellites are needed to include solving for the variable time. Photo from here: https://pixabay.com/en/gps-satellite-navigator-scheme-1826792/

General Relativity predicts that being farther from the Earth’s mass results in less spacetime curvature and thus clocks on the satellites would appear to move faster than clocks on Earth, leading by 45 microseconds per day due to the satellite’s distance from the surface of the Earth. Special Relativity predicts that since the satellites are moving relative to an observer on the ground, the clocks on the satellites would appear to move slower and would lag clocks on Earth by 7 microseconds per day due to the satellite’s distance from the surface of the Earth. The combination of these two effects results in a net difference of satellite clocks leading Earth clocks by 38 microseconds per day. Engineers took this into account before the satellites were deployed by designing the satellite atomic clocks frequency to slow down appropriately as they approached their designated orbit to match the atomic clock frequency on Earth.

GPS receivers also contain circuitry to calculate the 3D trilateration and compensate for the effects of Relativity. Further, the signals that the satellites transmit are microwaves, which move at the speed of light; this means that the wave’s velocity is known. The GPS receiver compares the time the signal left the satellite to the time it receives the signal and multiplies that offset by the known velocity of the signal to calculate the distance to the satellite. Trilateration is the process the GPS receivers use to determine their position on the Earth by comparing the distances between at least 4 satellites to pinpoint a location that satisfies those distances. Exactly how the receiver calculates this information given the sensed GPS satellite signals was indeterminable from our research. Our report in the overall project shows the system of equations to determine position based on data from at least 4 satellites. GPS receivers are constructed such that they know the codes sent from each satellite and can distinguish between them.

Pretty wild, huh? That’s what I was able to learn about GPS and the PmodGPS in the time I had available. I had a big happy nerd moment getting to write about Relativity Theories. If you have anything to add or can clarify any muddy points, please comment below!

Here’s links to the posted projects again:

Group GPS Tracking and Environmental Data System – (overall project using Arduino Mega and Raspberry Pi microcontrollers)

GPS Tracking System with Arduino Uno and Digilent PmodGPS – (focused project using an Arduino Uno microcontroller)

Leave a Reply

Your email address will not be published. Required fields are marked *