Live data from Hacker News

Show HN: Building a GPS receiver

axleos.com

71–80 of 135 posts

Re: Show HN: Building a GPS receiver

#71

Cool article. 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. > 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 wo…

> GPS was launched in 1978,

I would like to point out the insanely good design of the GPS radio layer (the L1+L2 signals).

Even 46 years on, the radio layer is fully forwards and backwards compatible, and a bunch of important metrics like time to first fix and user equivalent range errors have both improved by factors of 10-1000, with no incompatible change needed to the protocol.

The total RF transmit power to provide service to the whole earth is less than the electricity consumption of a typical US house (far less than 5G or TV or AM/FM radio), and well below the noise floor. That's possible due to clever use of stacked gold codes.

The design has allowed frequency-sharing with competing systems (eg. Galileo) - you don't see mobile phone networks doing that!

The actual signal sent has allowed things like carrier phase decoding, due to the locking of the phase between the modulated data and the carrier, which in turn gives far better pseudoranges and accuracy.

Overall, the designers either had incredible forethought, or incredible luck, or some combination of the two.

Re: Show HN: Building a GPS receiver

#72

Earlier quoted context omitted.

Regular jamming just degrades the signal quality. You can blast out fake data, but depending on what you mean by "large area" and a "point", I don't think what youre suggesting is possible. To trick GPS receivers you end up broadcasting fake signals from multiple GPS satellites, so receivers in different areas will be processing it differently and come up with different coordinates.

So does this means that in recent days there wasn't GPS jamming but GPS satalites were broadcasting fake signals? In south Turkey people were appearing to be in Beirut airport. Also see this one: https://www.lloydslist.com/LL1148748/War-zone-GPS-jamming-se...

No, the fact that all of these ships show the same false location strongly suggests that they are being spoofed from a single terrestrial source; this effect is not practical to achieve by modifying the signals transmitted by the satellites, even if the US wanted to for some reason.

There's a report on very similar jamming happening during the Syria conflict that will hopefully be enlightening as the methods and actors are presumably similar https://c4ads.org/wp-content/uploads/2022/05/AboveUsOnlyStar...

Re: Show HN: Building a GPS receiver

#73

Cool article. 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. > 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 wo…

> definitely useless for road navigation

I would disagree strongly with this. I took a roadtrip in 1999 using a Delorme Earthmate Hyperformance GPS receiver, the RS-232 version, plugged into a Toughbook running Delorme Street Atlas USA, I believe it was version 6.0.

It provided perfectly usable directions all the way across the country. It didn't do lane guidance (which I don't find terribly helpful anyway), but some time in advance of every turn, it would announce the turn, including the street name.

That version even had voice recognition, so you could say things like "are we there yet?" and it would announce the ETA to both the next stop and the final destination, along with current location. Lots of fun!

30 meters (typical worst-case CEP under SA) is plenty accurate for road navigation in all but the densest areas, and even then, just glance at the map. Once you're out on the open road, it's brilliant. Rock out to some mp3's until the voice pipes up with the next maneuver.

Re: Show HN: Building a GPS receiver

#74

Amazing! I also had exactly the same experience that led me to research this a few years ago, realizing that: - 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…

> GPS satellites don't send down a location, they only send down time The GPS almanac data they transmit is effectively location. It's not literally location, but the P code isn't literally time either. > and they can (and have!) turned off GPS off certain regions at will when necessary As I understand it, those capabilities are no longer present in newer (possibly all active?) GPS satellites.

What the satellites are sending is effectively THEIR orbit, not YOUR location, I think is the point.

Re: Show HN: Building a GPS receiver

#75
post #3

A good, decently detailed look at signal processing required. I also like https://ciechanow.ski/gps/ , which has some fantastic visuals to go along with this explanation.

Wow that blog never ceases to amaze me. I was actually thinking about it when I read this post, that it’s exactly the type of post Bartosz could have made. And he had! Those interactive graphics are unbeatable.

Re: Show HN: Building a GPS receiver

#76
post #39

Amazing! I also had exactly the same experience that led me to research this a few years ago, realizing that: - 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…

A person would have to have a quite flawed mental model of what GPS is to form the belief that it would stop working without data service, wouldn't they?

One of the interview questions where I work (we do automotive electronics) is "Explain how GPS works." It's directly relevant to the job, but it's also a neat opportunity to see how someone sizes up their audience, manages time and assumptions, etc.

All those things are neat, but mostly what I've learned is that quite a lot of people, otherwise apparently reasonably smart and competent and toting a whole stack of prestigious degrees, have ghastly flaws in their mental model of what GPS is.

Re: Show HN: Building a GPS receiver

#77

Earlier quoted context omitted.

You don't need to brute force the almanac - why would you? But it's very much feasible to 'brute force' your initial signal lock by searching for all gold codes at a range of frequency offsets. And it doesn't take 12.5 minutes to get the ephemerides - the almanac is sent in paginated form which is why it takes so long, the ephemerides are sent more often - they repeat every 30 seconds, and they're enough for a naviga…

> You don't need to brute force the almanac - why would you? I have no idea, but the claim was that you get faster fix with brute force when I know that's not why it's fast in practice. > But it's very much feasible to 'brute force' your initial signal lock by searching for all gold codes at a range of frequency offsets. I hadn't even imagined this constituting "brute force". Is my phone using "brute force" to find t…

> I hadn't even imagined this constituting "brute force". Is my phone using "brute force" to find the WiFi router? At some point it's not really "Brute force" it's "There are a handful of options, try all of them" and GPS seems past that point especially on modern hardware.

Your phone only needs to listen to the WiFi router on one channel at a time in operation, and the signal parameters are well enough defined that they can be scanned quickly. A GPS receiver requires at least 4 parallel channels to achieve a position solution, and there are up to 32 possible codes the satellites could be at. Scanning 6 channels across 32 codes, and then also sweeping phase and doppler shift to lock them , just to 'discover' if there is a valid signal there takes time, and this is what older receivers had to do. Modern receivers tend to just 'brute force' this by having an entire receive pipeline dedicated to every possible PRN all the time, and possibly even correlate multiple doppler shifts simultaneously as well, so they effectively have 32 (or more) receive channels, despite only ever expecting a maximum of 12 birds being visible. The extra channels are necessary more or less exclusively to reduce acquisition time, so I think it's fair to call them 'brute force'.

Re: Show HN: Building a GPS receiver

#78

Earlier quoted context omitted.

You don't need to brute force the almanac - why would you? But it's very much feasible to 'brute force' your initial signal lock by searching for all gold codes at a range of frequency offsets. And it doesn't take 12.5 minutes to get the ephemerides - the almanac is sent in paginated form which is why it takes so long, the ephemerides are sent more often - they repeat every 30 seconds, and they're enough for a naviga…

> You don't need to brute force the almanac - why would you? I have no idea, but the claim was that you get faster fix with brute force when I know that's not why it's fast in practice. > But it's very much feasible to 'brute force' your initial signal lock by searching for all gold codes at a range of frequency offsets. I hadn't even imagined this constituting "brute force". Is my phone using "brute force" to find t…

> I hadn't even imagined this constituting "brute force". Is my phone using "brute force" to find the WiFi router?

Early receivers were a lot less advanced than modern receivers - one of the key functions of the almanac is to help receivers figure out what satellites they can expect to see - thus greatly reducing the range of gold codes and time offsets they have to check.

Unlike wifi, GPS signals are below the noise floor until the gold code is applied to despread the signal, and the gold code has to be synchronized with the received signal to detect it.

The gold codes are pseudorandom and designed to stop signals interfering with one another. Unless you know which gold code you're looking for, and find its time offset (accurate to about 2 chips in 1023) you can't tell it apart from noise.

You also don't quite know the frequency you're looking for - partly due to the imprecision of the receiver clock, partly because GPS satellites move very fast and so can have a lot of Doppler shift (depending on where they are in the sky relative to the receiver of course)

Back when receivers had more limited physical hardware, searching through ~30 different satellites, multiplied by ~500 different gold code offsets, multiplied by a few different Doppler shifts could be a slow process. Especially if you'd found a handful of satellites, so some of your receiver channels were tied up with tracking leaving you with fewer for searching!

So ignoring the almanac and brute forcing every satellite, gold code offset and doppler shift is one of the many ways performance has increased since this stuff was developed in the late 1970s.

Re: Show HN: Building a GPS receiver

#79

Amazing! I also had exactly the same experience that led me to research this a few years ago, realizing that: - 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…

[dead]

Re: Show HN: Building a GPS receiver

#80
post #55
post #37

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. While we're at SDRs, ITAR is also responsible for takedown of passive radar GNU Radio module made by Kraken RF team. [1…

> takedown of passive radar GNU Radio module made by Kraken RF team. https://hackaday.com/2022/11/19/open-source-passive-radar-ta...

IIRC everything they took down was in the Git repo history.
Post reply on HN