Fun and Games with Adafruit GPS

by Web FishJan 24, 2013 @ 06:35pm

With most of the navionics building blocks arriving in the mail over the last 15 days and with our test mule build taking longer than originally projected, it's time to start tackling the core navigation functionality.

The final navionics bay design, layout and external connectors are still very much work in progress. For now we'll stick with experimental wiring in order to get all modules talking to each other and iron out all the conflicts. By the time we are done, the deck layout should hopefully be finalized.

Starting with the Adafruit GPS module on UART 2:

Initial plan was to use a one-way communication with the GPS module (read-only) to save one GPIO port for other use (GPIO 4 is normally dedicated to UART 2 / TX). After playing with it for a while, it became evident that the default update frequency of the GPS board (NMEA_UPDATERATE) is ~10Hz, flooding the serial port with data that is (kind of) useless for us (the distance we'll travel at maximum speed in 100ms is significantly less than the GPS margin of error :). So we'll need a two-way communication after all (for the PMTK_SET_NMEA_UPDATERATE command and a few other configs upon GPS initialization).

Another thing to point out about the MTK3339 chipset in the Adafruit GPS module is that it takes FOREVER to update the internal almanac data after cold restart. If you try to do this inside a building, it can spend a whole night without building a usable almanac table and getting a stable satellite lock. Fortunately, Adafruit provides an optional battery back-up (requires a simple battery holder installation and a 3V lithium battery). Once the battery is installed, the satellite lock time is DRASTICALLY reduced (by orders of magnitude) and the receiver is operational on the ground floor of a two-story building.

With all this behind us, the first module is on-line and operational:

Time for the first real-life test. I'll go into more details about the code in the Software section of the blog, but here is a summary of the test setup:

  • The GPS class provides real-time (1 second interval) updates of current longitude/latitude/altitude, satellite fix mode (None/GPS/Differential GPS), number of available satellites in the constellation and the current time offset in GMT (hh:mm:ss);
  • The main routine polls the GPS class every 3 seconds;
  • If there is a satellite lock, the data logger dumps the current location data in human-readable format in a text file on the on-board SD card;

So I dropped the board on the passenger seat of the car and headed to the harbor. Dana Point harbor is not the most signal-friendly place (tall cliffs, rich vegetation, etc). To add to the test, the GPS sensor antenna was pointed down (towards the car seat). A four minute drive from the top of the cliff to the tip of the island yielded this. Not too bad... 

A quick parse and paste into gives us a near-perfect data point distribution. Try guessing where the stop signs are on the test course:

View GPS Test - 1/24/2012 in a full screen map


By the looks of it, we might be able to get away without an external active GPS antenna. 

Next on the list: compass module.

Add comment

  Country flag

  • Comment
  • Preview