Hi everyone!<p>Shortly after publishing my iOS 4 jailbreak last October[1], I got to work on my next hobby project: a from-scratch homebrew GPS receiver, which can solve the user’s location solely from billions of radio antenna samples.<p>I took a commodity SDR (alongside the Python standard library and numpy) and built a signal processing pipeline that can detect and track GPS satellites over many minutes, drop and pick up satellites as they come in and out of view, and precisely determine the user’s position and clock inaccuracy.<p>All told, gypsum can go from a cold start to a fix on the user’s position, and the precise time, in less than a minute of listening to the antenna. I went on a journey of learning how to detect and track satellite signals that are literally too quiet to hear, and I hope that some of the magic comes through in the posts!<p>After implementing this myself and walking the long road of getting it working, I’m left completely stunned by the brilliance of GPS, across so many axes. I hope you enjoy the read!<p>On a more personal note, I’ll be starting a new job next week which isn’t as amenable to publishing side projects, and therefore this will be my last publicly-published project for some time. I’ve had great experiences making and sharing projects on here, and I’m really grateful for the positive feedback that’s been shared!<p>[1]: <a href="https://news.ycombinator.com/item?id=37736318">https://news.ycombinator.com/item?id=37736318</a>
> Just one problem: you won’t find any SDR on the market that will claim to be able to sample a wave oscillating over a billion times a second.<p>This was true, but not any more. You can get truly impressive “direct RF sampling” or “direct RF conversion” receivers that are more than fast enough for GPS. For example:<p>Xilinx RFSoc: <a href="https://www.mouser.com/datasheet/2/903/ds889_zynq_usp_rfsoc_overview-1670395.pdf" rel="nofollow">https://www.mouser.com/datasheet/2/903/ds889_zynq_usp_rfsoc_...</a><p>A nice National Instruments article: <a href="https://www.ni.com/en/solutions/aerospace-defense/radar-electronic-warfare-sigint/advantages-of-direct-rf-sampling-architectures.html" rel="nofollow">https://www.ni.com/en/solutions/aerospace-defense/radar-elec...</a><p>And their referenced off-the-shelf hardware: <a href="https://www.ni.com/en-us/shop/category/flexrio-custom-instruments-and-processing.html?productId=230187" rel="nofollow">https://www.ni.com/en-us/shop/category/flexrio-custom-instru...</a><p>One might be forgiven for being a bit puzzled as to why NI thinks that direct RF conversion is cost-effective but nonetheless sells the device for $30k :) That being said, if I were prototyping a system that wanted phase-coherent wideband reception around 3 GHz and I had a proper lab and budget, I’d buy a few of these. If I were to go to production, I’d either wait for costs of a homemade board to come down a bit or see whether a traditional heterodyne receiver could do the trick.<p>Hmm. For military applications, if I were concerned about really advanced RF-seeking weapons pointed at me, a direct conversion receiver is probably great — there won’t be any leakage of the LO that an enemy device could try to detect.
Cool article.<p>Whenever I see "from scratch," I'm always curious to see how from scratch the author actually means so I'll admit I was a bit disappointed to see that the hardware was just RTL-SDR. Still, the protocol decoding was very interesting and the result is great.<p>> GPS was launched in 1978, which was 45 years ago at time of writing. Five billion people are currently under 40 years old, so well over half the world’s population has never existed in an environment but this.<p>A note based on this. While GPS was around since 1978 the signal was intentionally degraded with a process known as "selective availability" until 2000. This largely rendered GPS unusable for many many purposes, definitely useless for road navigation, it had some limited utility in areas like backcountry navigation and was definitely useful for marine navigation.<p>> gypsum can go from a cold start to a fix on the user’s position, and the precise time, in less than a minute of listening to the antenna<p>This is very impressive and outclasses what I see even commercial receivers doing today, do you have any idea how? I remember on road trips in the early 2000s I would have to sit on the side of the road and wait for the GPS receiver to get a fix (a 15-20 minute process, when it worked) before we could leave. Or, more likely, my mother would just start driving with paper maps.
Note that GPS receiver capable (i.e. not artificially limited) of providing navigation data while moving 600 m/s or higher used to be considered munition by ITAR. The amount of legalese at updated ruling [1] is well beyond what I can make sense of, to the point I don't even know if it still applies.<p>While we're at SDRs, ITAR is also responsible for takedown of passive radar GNU Radio module made by Kraken RF team.<p>[1] <a href="https://www.space.commerce.gov/itar-controls-on-gps-gnss-receivers-updated/" rel="nofollow">https://www.space.commerce.gov/itar-controls-on-gps-gnss-rec...</a>
A good, decently detailed look at signal processing required. I also like <a href="https://ciechanow.ski/gps/" rel="nofollow">https://ciechanow.ski/gps/</a>, which has some fantastic visuals to go along with this explanation.
Brilliant! I have no idea what the technical background of the author is but for anyone to tease apart the vast, complex, details of the GPS universe is a massive feat. Coupled with his ability to craft software to both assist his analysis and to implement the final solution, he has created a magnificent project. I've been studying GPS and worked with it professionally for a number of years and I still don't know everything about it. I'm looking forward to digging into the code. Kudos to the author!
Super impressive. Can’t agree more with the author that GPS is a stunningly clever engineering achievement.<p>For those interested in the story of the development of GPS, I found “GPS Declassified” by Richard Easton to be an engaging retelling.
Amazing! I also had exactly the same experience that led me to research this a few years ago, realizing that:<p>- GPS works even in airplane mode (while on a literal airplane)
- It works without cell service, or wifi, or anything
- The United States of America controls the GPS constellation, and they can (and have!) turned off GPS off certain regions at will when necessary (which has prompted other countries to launch their own GNSS constellations)
- GPS satellites don't send down a location, they only send down time<p>I think it's a really fun exercise to do this with data you receive on your phone. Your phone has a direct link to satellite.<p>(side note: I recently learned the basic principles of star navigation, and while it is a completely different mechanism, it also relies very much on keeping accurate time, which I thought was a fun symmetry!)
> Have you ever noticed that your Maps app still works during a flight?<p>Yes, and I use that to take pictures of features below my as we fly from one place to the other.<p>If you have a iPhone, when you land, those pictures will be associated with the place you were when the photo was shot. This enables you to locate those curious features you happen to see.
I really love how this article is paced in real time from the first person as a learning adventure. Even down to the search terms used and the inner monologue. This is my absolute favorite kind of tutorial because you're not just being taught to fish, you're being shown how go about sourcing the parts to built your own fishing machinery.
A documentary which interviews the principals involved in the creation of GPS (<i>The Lonely Halls Meeting</i>) is on YouTube:<p><a href="https://youtu.be/Z5N4CqJLAhQ?si=lvaQZv-WG3ab_gEI" rel="nofollow">https://youtu.be/Z5N4CqJLAhQ?si=lvaQZv-WG3ab_gEI</a>
Standford has/had a course that is available online on GPS/GNSS and a lot of the nitty-gritty details:<p>* <a href="https://www.youtube.com/playlist?list=PLGvhNIiu1ubyEOJga50LJMzVXtbUq6CPo" rel="nofollow">https://www.youtube.com/playlist?list=PLGvhNIiu1ubyEOJga50LJ...</a>
Great project, thanks for posting it!<p>It just so happens I've got an RTL-SDR, a GPS receiver that outputs raw pseudoranges, and a signal splitter that lets me put the signal from one antenna into two receivers.<p>So if you like I can get the pseudoranges out of a commercial GPS receiver, and the raw signal from an RTL-SDR at the same time, which <i>might</i> help you pinpoint your last bit of location inaccuracy.<p>Would you be interested in that? Or do you consider this project complete?
> I’ll be starting a new job next week which isn’t as amenable to publishing side projects<p>What does a job have to do with publishing hobby projects?
If you really want to see all the gps-like services out there and have android, you must play with the open-source GPStest<p><a href="https://github.com/barbeau/gpstest">https://github.com/barbeau/gpstest</a><p>I've been fascinated for years how badly GPS does altitude (mean-sea-level)<p>in the USA they had to build an augmentation system for airplanes for altitude (WAAS)
It's not entirely clear to me from the write-up, but it seems some of the problems that the author had with the "tracker" come from attempting to do carrier phase synchronization (with the Costas loop) before any kind of clock recovery.
Wow, thank you! While I had a glimpse at various parts of the madness earlier, this is the first article that actually brought it to a level where I could convince my brain to understand it end-to-end.
> Have you ever noticed that your Maps app still works during a flight?<p>I noticed the opposite, it always fails to locate any satellites, even when GPS is still turned on in aeroplane mode. I'm not sure why.
"Interestingly, the only thing stopping civilians from using the P code is the knowledge of the value of its chipping sequence. If the formula to generate the P code was publicly known, there’d be nothing stopping civilian GPS receivers from locking on to it, with the exact same techniques as are used for the C/A code."<p>I didn't finish reading the whole thing but was curious. Is there any way of brute forcing it or some other trick to get the chipping sequence to get the P code for more precise GPS?
I find it amazing that they managed to design and build all this in the 1970s when computers were only in their infancy and SDR was complete science-fiction.
Anyone manage to get this working with pip in Windows? After installing the dependencies:<p><pre><code> C:\dev\gps\gypsum-release>gypsum-cli.py
Traceback (most recent call last):
File "C:\dev\gps\gypsum-release\gypsum-cli.py", line 9, in <module>
from gypsum.receiver import GpsReceiver
File "C:\dev\gps\gypsum-release\gypsum\receiver.py", line 20, in <module>
from gypsum.navigation_message_decoder import EmitSubframeEvent
File "C:\dev\gps\gypsum-release\gypsum\navigation_message_decoder.py", line 8, in <module>
from gypsum.navigation_message_parser import (
File "C:\dev\gps\gypsum-release\gypsum\navigation_message_parser.py", line 62
*bits
^
SyntaxError: invalid syntax</code></pre>