natronics on GitHub

GPS Visualization – September 2014

GPS Visualization

While following along with PSAS’s GPS study group nights I really want to get a better visualization of what’s going on with GPS signals as they’re being created, sent, transformed, and variously mangled.

Let’s start at the beginning.

The GPS Carrier

The L1 GPS carrier is a plain sine wave at 1575.42 MHz. Not much to look at, but here it is

Data

Modulated to this carrier is a psudo-random sequnce known as a PRN. There isn’t any information in this data in the usual way that we think of. That is to say that the bits themselves aren’t interesting, it’s just a random-looking number. But instead they work as a way to figure out where in the signal you are looking. It’s part of a kind of radio technique called CDMA.

To have something to look at that is simpler than the actual GPS PRN we’re going to make a psudorandom sequence using python’s random module (a mersenne twister) starting with an arbitrary seed, in this case the string “GPS PRN”. For later convineience we’ll look at this sequence as a square wave from -1 to 1.

Our PRN chip: [0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1]

BPSK

The transmited GPS signal uses binary phase shift keying, which can be done by multiplying the carefully constructed PRN above with the carrier!

This works because a $sin(x)\times-1 = sin(x-180^o)$, in other words it’s exactly a 180 degree phase shift. We should see this as blips in sine wave every time our data changes from 1 to 0 or visa-versa:

Oops! This is completely indecipherable! The problem is that the carrier is running three orders of magnintude faster than the PRN!!! Unless we zoom into one spot where the phase shift happens we can see anything at this scale.

For the sake of argument lets make the prn modulation much faster.

Now we see the phase shifts! To make what’s going on even clearer, lets overlay the PRN back on the chart to see how the phase shifts coincide with the edges of our PRN:

This is the basic encoding of a PRN in GPS. But the PRN is made wrong! This was just an example. Read the next post in the series to learn about how to compute the actual GPS PRN’s.