Number Crunching GPS For The DIYer

Many of us have had cause to add GPS to a project, whether it’s because we need an accurate timebase or just want to know where the bloody thing is. Normally, this consists of plugging in a cheap module and making sure the antenna has a good view of the sky. [Mike] wanted to dig deeper, however, and figure out just what goes into decoding a GPS signal and calculating a location fix.

[Mike]’s investigation combined several avenues of investigation. In terms of decoding live radio signals, he selected a KiwiSDR software defined radio. Combined with a Digilent Nexys 2 FPGA, it was now possible to get live data off the air and into the PC quickly for decoding. In concert with this, [Mike] used a sample of raw GPS data captured in Nottingham, UK in order to test his code. After much experimentation, [Mike] was able to get the data decoded with 700 lines of C code. Decoding three minutes worth of data took all night, but further development allowed things to be sped up over 200 times. For the curious, the code is up on Github to convert raw ADC samples into actual location fixes.

Armed with the wealth of resources online and the right hardware, [Mike] was sucessfully able to achieve his goal, and figure out just precisely where his house is, to boot. As a bonus, the whole project was inspired by a similar project posted in these very pages back in 2013! If you’re working on your own satellite-based projects, be sure to drop us a line.

10 thoughts on “Number Crunching GPS For The DIYer

  1. I’m puzzled about the KiwiSDR + Nexys 2 FPGA combination. The KiwiSDR already has a software GPS implementation so why is the FPGA board needed? I would have expected the Beaglebone with its PRUs to easily be able to stream the 2 MB/s feed to a PC.

    1. My old Tom-Tom glitched once and thought I went 10,000 mph… not quite sure what it did, was somewhere I go often but 3 hours away so had it queued up in case there were any detours… so I wasn’t paying attention to it.. it either froze up as soon as I left and then woke up when I was there, or maybe couldn’t lock sats and thought I went a full circle of the planet or something.

    2. What am I missing here? How is it illegal to calculate the position yourself? It’s not like he’s using it to guide a nuclear missle or even navigating his car.

    3. AFIK those restritions do not apply to off-line (non-real time) calculation, and if it takes all night to caculate some co-ordinates that puts it WELL outside real-time. Admittedly his old hardware and slow software has been improved, but even so, it is a very long way away from real time.
      If you wanted to do the stuff you are insinuating, you’d just have a “quiet word” with a GPS module manufaturer. It’s not as if you’d have high morals to be worried about violating.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.