Homemade GPS Receiver
holmea.demon.co.uk
holmea.demon.co.uk
There's some wonderful quotes in the page that just hint at the complexity involved:
"Originally, by not transforming satellite positions from earth-centred-earth-fixed (ECEF) to earth-centred-inertial (ECI) coordinates, I was effectively ignoring Earth's rotation during the 60 to 80 ms that signals were in flight."
"The above solutions were generated without compensating for ionospheric propagation delays using parameters in page 18 of subframe 4 which should be applied because this is a single frequency receiver. Ionospheric refraction increases path lengths between users and satellites."
!
What strikes me is that the math and all the corrections would not be all that alien to a sextant user from 100 years ago. To determine position using a sextant you also start with an estimated position and an accurate clock. You compensate for drift during your measurements, for dip and refraction, you solve the equations for several celestial bodies etc.
Was it ever used?
While searching, I was reminded of another interesting fact, that the SR-71 had a fully automated celestial navigation system that could get still a position fix on the ground in the middle of the day, and was more accurate than an INS on long flights.
that could get still a position fix on the ground in
the middle of the day
What! Surely the sky would outshine the stars... did it use light outside of the visual spectrum?The basic idea is a form of synchronous detection or lock-in amplification: The shutters are arranged so that a point source is occluded at a fixed frequency, while an area source will be only partially occluded at any given time. Due to the way it is designed, area sources should add little to the time-varying component of the photodetector signal. The lock-in amplifier is essentially a very narrow notch filter (centered at the "star occlusion frequency"), so it completely rejects the DC component from the sky.
There is a little more to it than what I'm writing, mainly because you need to not just detect the point source, but also estimate the star's position within the field of view (which IIRC is done by comparing the phase of the time-varying star signal to a reference point on the shutters).
You need more than a few stars for navigation, of course, but I would assume with a good sensor, proper filtering, and nice optics, a computer could see enough stars during daytime to perform navigation.
search for "periscopic sextant"
Some back-of-the-envelope numbers (and precision calculation) here: http://physics.stackexchange.com/questions/1061/why-does-gps...
The author actually mentions a third source of relativistic error without saying it's relativistic error: the Sagnac effect. ("Originally, by not transforming satellite positions from earth-centred-earth-fixed (ECEF) to earth-centred-inertial (ECI) coordinates, I was effectively ignoring Earth's rotation during the 60 to 80 ms that signals were in flight.")
See also:
http://en.wikipedia.org/wiki/Error_analysis_for_the_Global_P...
However, yes, relativity further complicates it.
"Were there an infinite value for the speed of light, light itself would not exist at all."
http://www.scientificamerican.com/article.cfm?id=why-isnt-th...
The speed of light is strange in that it has the same value independent of the relative velocity between the source and the observer. This fact is an experimental one that can only make sense if relative motion changes the relationship between space and time intervals to keep the distance covered by light per unit time the same for all observers.
The fact that space and time must get mixed up to keep the speed of light constant implies that, in some sense, space and time must be the same, despite our habit of measuring space in meters and time in seconds. But if time and space are similar to the extent that they can be converted one into the other, then one needs some quantity to convert the units--namely, something measured in meters per second that can be used to multiply seconds of time to get meters of space. That something, the universal conversion factor, is the speed of light. The reason that it is limited is simply the fact that a finite amount of space is equivalent to a finite amount of time.
Nevertheless it's not the only attempt, bug a very good one, at "open source GPS" projects. There's at least http://www.gnss-sdr.org/ which is a more software-centric approach being able to work with different receiver frontends. And I've just found another FPGA project at http://www.witchnav.cz/.
Naturally the software-only solution will burn a lot of CPU in the correlators, so I'd expect a software solution to require a multi-GHz machine, whereas the GPS receiveres with FPGA (such as the one linked to) works easily on a pretty low-performing Raspberry-Pi.
Some GPS vendors read the above in terms of an OR function, instead of an AND function. In other words, their receivers stop functioning above that altitude no matter what the speed is.
That prevents some off-the-shelf GPS receivers from being used to build stratospheric balloons, since these things can climb all the way to 30 km altitude, or more. Other GPS receivers are built on an AND function, and work well with strato balloons. Sometimes it's a bit tricky to tell if a given receiver is an AND or an OR.
I assume, if you build a DIY GPS receiver, you can even ignore any such limitation altogether, right? That might well be illegal where I live, I'm not sure, and I have no intention to build such a thing anyway. I'm just asking in principle.
EDIT: This is the COCOM limit:
In GPS technology, the phrasing "COCOM Limits" is also used to refer to a limit placed to GPS tracking devices that should disable tracking when the device realizes itself to be moving faster than 1,000 knots (1,900 km/h; 1,200 mph) at an altitude higher than 60,000 feet (18,000 m).[2] This was intended to avoid the use of GPS in intercontinental ballistic missile-like applications.
Doppler shift is the change of the percieved frequency when either source or receiver move towards another, or away from another. Canonical example: Sound of a emergency vehicle's horn when passing by.
Normally you never see the satellites ride directly towards you (or away from you) but the path is pretty orthogonal to your line-of-sight. So you only account for a fraction of the 14'000 km/h speed of the GPS satellites to cause frequency shifts of the signal. (Max. example listed on the homepade-GPS page is ±5 KHz of doppler, which is relatively 3.3×10^−6 of the GPS frequency, even though the GPS satellite rides at 1.8×10^−5 the speed of light).
If you'd fly with 1900 km/s (1.8×10^−6 of the speed of light) directly towards the GPS bird, this movement will increase the frequency you receive by 1.8×10^−6 × 1,5 GHz = 2.7 kHz. So please increase your doppler search range from ±5 KHz to ±8 KHz to be able to successfully steer your homemade cruise missiles at that the COCOM limit speed, increase more if faster. This will slow down your time-to-first-fix, obviously.
The other limit of 10km is easier to ignore, though. It would only become relevant once you can no longer exclude some solutions to the formulae that lie outside of the GPS satellite's orbit (imagine four coplanar GPS birds used for calculation). And in practice proabably it's sane to assume a position that is not wider than 100km from the earth's surface, again, if you don't plan to ride your DIY receiver to the ISS, or maybe even geostationary orbit.
The best bit is that all the diagrams, schematics and PCB layouts are hand-drawn.
Which is funny, because to know you're higher/faster than allowed you need to calculate that from GPS data
In practice, not sure how this is achieved, but for speed this may even be a limitation of the circuit (for example, if you can't compensate for the doppler effect at that speed or has to add some other processing - still, the doppler effect should be small)
1000 knots is still +/- 1.5 Mach (at sea level) so Concorde and fighter jets should use a special GPS (but this is very fast)
Actually, no. All military aircraft have inertial navigation packages that, among other values, provide altitude above the elipsoid, position, and velocity vector. When available, these systems are fixed periodically to GPS-based measurements.
You're right from the point of view of the aircraft/missile, where several pieces of information are put together (GPS, barometric, inertial, etc) for navigation purposes.
GPS devices should disable themselves when at an altitude above 60,000 feet AND a speed faster than 1,000 knots
Whereas some vendors read it:
GPS devices should disable themselves when at an altitude above 60,000 feet OR a speed faster than 1,000 knots
Which effectively disables your cheap GPS dongle in your home-made stratospheric balloon, which is quite capable of reaching 30 km, above the COCOM altitude spec.
Sometimes it's quite tricky to figure out if a given receiver is an AND or an OR.
Probably way out of budget range for hobby stuff though
[1] One is the WelNav GS720: http://www.t-e.com.tw/GS-720.pdf
[2] A Simple Demonstration that the Global Positioning System (GPS) is Vulnerable to Spoofing: http://www.ne.anl.gov/capabilities/vat/pdfs/GPS-Spoofing-%28...
Concorde is old enough that its operators probably never went to the trouble of doing the paperwork to have a GPS integrated with the rest of the NAV system. For its (relatively) short flights, an internal navigation system plus VHF or LF radionav works adequately (and there were very few, if any, GPS/WAAS approaches certified by the time of its retirement).
Not that I mind--this is one of the more awesome articles submitted to HN or really anywhere.
https://news.ycombinator.com/item?id=5699429
Whatever. I'm glad people are looking at this because it is incredible.
EDIT: I do wonder, however, that the link from 3 days ago only has one point, which is what it had as soon as it was created. Presumably elemeno appended the "#" before he submitted the link, because if he had just submitted the link then the 3-day-ago link would have at least two points. Is automatically adding the hash a thing that people do? Is reposting non-hashed links from several days before with added hashes a thing that people do?
I guess since this version of the link has been upvoted 201 times, elemeno actually has provided a valuable service to HN.
I had no idea it was this complex. Well, in a way it is simpler than I imagined (since he's using an antenna with an amplifier), and the FI amplifier is "simpler" as well.
The most interesting parts for me is the demodulation, and the code phrases search using FFT.
No wonder you need a FPGA to do the heavy lifting.
So cell phone GPS receivers have everything needed for standalone GPS, and position assistance from other sources as you mention, and the ability to load satellite position data from other sources. All this on a chip that probably costs less than $10 in bulk.
He didn't fab his own silicon, package his own dies, or even machine his own connectors!
The hard (and interesting) parts are the design and testing/debugging phases. Building your own PCB to handle various RF signals at this sort of level is non-trivial in both time and money, and doesn't really gain you much.
There's no reason why it should be through-hole either, and indeed, good luck finding suitable parts in those packages. SMD manual soldering isn't particularly hard either, although time consuming. If you have a reflow or spare toaster oven, you can do it a whole lot faster too.
L1 and L2 are hand-wound microwave chokes with
very high self-resonant frequency, mounted
perpendicular to one another and clear of the
ground plane. Wind 14 turns, air-cored, 1mm
inside diameter from 7cm lengths of 32swg
enamelled copper wire. Checked with the tracking
generator on a Marconi 2383 SA, these were good
to 4 GHz.To quote Linus, it's quite "studly" to operate like this, but the result is big and ugly. Fabbed PCBs are much more compact.