Adafruit Ultimate GPS Created by lady ada Last updated on 2018-02-27 02:45:08 AM UTC
Guide Contents Guide Contents Overview 2 3 Pick one up today at the Adafruit shop! Specifications: Pinouts Power Pins Serial Data Pins Other Pins Direct Computer Wiring Arduino Wiring Parsed Data Output CircuitPython Parsing Usage Datalogging Example 7 7 8 9 11 15 17 18 19 23 Install SD Card Library Enable Internal Filesystem Writes Datalogging Example Code 24 24 24 Battery Backup 28 If you have a v1 or v2 module ONLY: Built In Logging Logging Status Downloading Data Using the GPS Tool LOCUS Parse
Overview We carry a few different GPS modules here in the Adafruit shop, but none that satisfied our every desire - that's why we designed this little GPS breakout board. We believe this is the Ultimate GPS module, so we named it that. It's got everything you want and more: -165 dBm sensitivity, 10 Hz updates, 66 channels 5V friendly design and only 20mA current draw Breadboard friendly + two mounting holes RTC battery-compatible Built-in datalogging PPS output on fix Internal patch antenna + u.
The breakout is built around the MTK3339 chipset, a no-nonsense, high-quality GPS module that can track up to 22 satellites on 66 channels, has an excellent high-sensitivity receiver (-165 dB tracking!), and a built in antenna. It can do up to 10 location updates a second for high speed, high sensitivity logging or tracking. Power usage is incredibly low, only 20 mA during navigation. Best of all, we added all the extra goodies you could ever want: a ultra-low dropout 3.
Pick one up today at the Adafruit shop! Specifications: Module specs: Satellites: 22 tracking, 66 searching Patch Antenna Size: 15mm x 15mm x 4mm Update rate: 1 to 10 Hz Position Accuracy: 1.8 meters Velocity Accuracy: 0.1 meters/s Warm/cold start: 34 seconds Acquisition sensitivity: -145 dBm Tracking sensitivity: -165 dBm Maximum Velocity: 515m/s Vin range: 3.0-5.
Dimensions (not including coin cell or holder): 25.5mm x 35mm x 6.5mm / 1.0" x 1.35" x 0.25" If you purchased a module before March 26th, 2012 and it says MTK3329 on the silkscreen, you have the PA6B version of this breakout with the MT3329 chipset. The MTK3329 does not have built in datalogging. If your module has sharpie marker crossking out the MTK3329 text or there is no text, you have a PA6C MTK3339 with datalogging ability.
Pinouts Power Pins © Adafruit Industries https://learn.adafruit.
These are the pins that are involved with powering the GPS. Starting from the right are the required power pins: VIN - power input, connect to 3-5VDC. It's important to connect to a clean and quiet power supply. GPS's are very sensitive, so you want a nice and quiet power supply. Don't connect to a switching supply if you can avoid it, an LDO will be less noisy! GND - power and signal ground. Connect to your power supply and microcontroller ground.
Next pins you'll want to use are the serial data pins: TX - the pin that transmits data from the GPS module to your microcontroller or computer. It is 3.3V logic level. Data comes out at 9600 baud by default RX - the pin that you can use to send data to the GPS. You can use use 3.3V or 5V logic, there is a logic level shifter. By default it expects 9600 baud data, and remember you need to send it checksum'med NMEA sentences Other Pins © Adafruit Industries https://learn.adafruit.
FIX is an output pin - it is the same pin as the one that drives the red LED. When there is no fix, the FIX pin is going to pulse up and down once every second. When there is a fix, the pin is low (0V) for most of the time, once every 15 seconds it will pulse high for 200 milliseconds PPS is a new pin output on V3 modules. Its a "pulse per second" output. Most of the time it is at logic low (ground) and then it pulses high (3.
Direct Computer Wiring GPS modules are great in that the moment you turn them on, they'll start spitting out data, and trying to get a 'fix' (location verification). Like pretty much every GPS in existence, the Adafruit Ultimate GPS uses TTL serial output to send data so the best way to first test the GPS is to wire it directly to the computer via the TTL serial to USB converter on an Arduino. You can also use an FTDI Friend or other TTL adapter but for this demonstration we'll use a classic Arduino.
Now plug in the USB cable, and open up the serial monitor from the Arduino IDE and be sure to select 9600 baud in the drop down. You should see text like the following: This is the raw GPS "NMEA sentence" output from the module. There are a few different kinds of NMEA sentences, the most common ones people use are the $GPRMC (Global Positioning RecommendedMinimum Coordinates or something like that) and the $GPGGA sentences.
enough data to determine the location (2D fix) or location+altitude (3D fix). For more details about NMEA sentences and what data they contain, check out this site If you look at the data in the above window, you can see that there are a lot of commas, with no data in between them. That's because this module is on my desk, indoors, and does not have a 'fix'. To get a fix, we need to put the module outside.
People often get confused because the GPS is working but is "5 miles off" - this is because they are not parsing the lat/long data correctly. Despite appearances, the geolocation data is NOT in decimal degrees. It is in degrees and minutes in the following format: Latitude: DDMM.MMMM (The first two characters are the degrees.) Longitude: DDDMM.MMMM (The first three characters are the degrees.) The next data is the ground speed in knots. We're going 2.
Arduino Wiring Once you've gotten the GPS module tested with direct wiring, we can go forward and wire it up to a microcontroller. We'll be using an Arduino but you can adapt our code to any other microcontroller that can receive TTL serial at 9600 baud. Connect VIN to +5V, GND to Ground, RX to digital 2 and TX to digital 3. Next up, download the Adafruit GPS library.
port connected to USB. Open up the Arduino IDE Serial Console and make sure to set the Serial baud rate to 115200 You can configure the GPS output you see by commenting/uncommenting lines in the setup() procedure. For example, we can ask the GPS to send different sentences, and change how often it sends data. 10 Hz (10 times a second) is the max speed, and is a lot of data. You may not be able to output "all data" at that speed because the 9600 baud rate is not fast enough.
Parsed Data Output Since all GPS's output NMEA sentences and often for our projects we need to extract the actual data from them, we've simplified the task tremendously when using the Adafruit GPS library. By having the library read, store and parse the data in a background interrupt it becomes trivial to query the library and get the latest updated information without any icky parsing work. Open up the File→Examples→Adafruit_GPS→parsing sketch and upload it to the Arduino. Then open up the serial monitor.
CircuitPython Parsing You can easily use a GPS module with CircuitPython code in addition to Arduino. Python code is well suited for parsing and processing the text output from GPS modules and this Adafruit CircuitPython GPS module handles most of the work for you! First make sure to wire up the GPS module to your CircuitPython board exactly as shown for an Arduino. Here's an example with the Metro M0 Express: Board 5V or 3.3V to GPS module VIN. Board GND to GPS module GND.
You can also download the adafruit_gps.mpy file from the Adafruit CircuitPython GPS releases page. Before continuing make sure your board's lib folder or root filesystem has the adafruit_gps.mpy, files and folders copied over. Usage To demonstrate the usage of the GPS module in CircuitPython let's look at a complete program example. the simple.py file from the module's examples. Save this file as main.
# Main loop runs forever printing the location, etc. every second. last_print = time.monotonic() while True: # Make sure to call gps.update() every loop iteration and at least twice # as fast as data comes from the GPS unit (usually every second). # This returns a bool that's true if it parsed new data (you can ignore it # though if you don't care and instead look at the has_fix property). gps.update() # Every second print out current location details if there's a fix. current = time.
Or once a fix has been established (make sure the GPS module has a good view of the sky!) it will print details about the current location and other GPS data: Let's look at the code in a bit more detail to understand how it works.
# # # # # Initialize the GPS module by changing what data it sends and at what rate. These are NMEA extensions for PMTK_314_SET_NMEA_OUTPUT and PMTK_220_SET_NMEA_UPDATERATE but you can send anything from here to adjust the GPS module behavior: https://cdn-shop.adafruit.com/datasheets/PMTK_A11.pdf # Turn on the basic GGA and RMC info (what you typically want) gps.send_command('PMTK314,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0') # Turn on just minimum info (RMC only, location): #gps.
if not gps.has_fix: # Try again if we don't have a fix yet. print('Waiting for fix...') continue # We have a fix! (gps.has_fix is true) # Print out details about the fix like location, date, etc. print('=' * 40) # Print a separator line. print('Fix timestamp: {}/{}/{} {:02}:{:02}:{:02}'.format( gps.timestamp_utc.tm_mon, # Grab parts of the time from the gps.timestamp_utc.tm_mday, # struct_time object that holds gps.timestamp_utc.tm_year, # the fix time. Note you might gps.timestamp_utc.
Install SD Card Library If you're storing data on a SD card you must ensure the SD card is wired to your board and you have installed the Adafruit SD card library. Luckily there's an entire guide to follow to learn about this process of connecting a SD card and installing the necessary library. Be sure to carefully follow the guide so the card is connected, library installed, and you can confirm you're able to manually write data to the card from the Python prompt.
# Simple GPS datalogging demonstration. # This actually doesn't even use the GPS library and instead just reads raw # NMEA sentences from the GPS unit and dumps them to a file on an SD card # (recommended) or internal storage (be careful as only a few kilobytes to # megabytes are available). Before writing to internal storage you MUST # carefully follow the steps in this guide to enable writes to the internal # filesystem: # https://learn.adafruit.
# Path to the file to log GPS data. By default this will be appended to # which means new lines are added at the end and all old data is kept. # Change this path to point at internal storage (like '/gps.txt') or SD # card mounted storage ('/sd/gps.txt') as desired. #LOG_FILE = '/gps.txt' # Example for writing to internal path /gps.txt LOG_FILE = '/sd/gps.txt' # Example for writing to SD card path /sd/gps.txt And further below: Should all be uncommented and look as above.
Awesome! That's all there is to basic datalogging of NMEA sentences with a GPS module and CircuitPython! © Adafruit Industries https://learn.adafruit.
Battery Backup The GPS has a built in real time clock, which can keep track of time even when it power is lost and it doesn't have a fix yet. It can also help reduce fix times, if you expect to have a flakey power connection (say you're using solar or similar). To use the RTC, we need to attach a battery. There is a spot on the back for a CR1220 sized battery holder. We provide the holder but the battery is not included.
Remember, the GPS does not know what time zone you are in (even though it knows your location, there is no easy way to determine time zone without a massive lookup table) so all date/time data is in UTC (aka. Greenwich Mean Time) - You will have to write the code that converts that to your local time zone and account for Daylight Savings if required! Since that's pretty complicated, most people just stick to keeping everything in UTC © Adafruit Industries https://learn.adafruit.
Built In Logging One of the nice things about the MTK3339 is the built in data-logger. This basic data-logging capability can store date, time, latitude, longitude and altitude data into a 64K flash chip inside. Its not a high resolution logger - it only logs once every 15 seconds when there is a fix - but for 99% of projects that want to track location, this can be a great low power way to log data - no SD card or other EEPROM required! It can store up to 16 hours of data.
This output gives you some more information. the first entry is the Log #. This is how many log traces are in the memory. Every time you start and save data, a new log is made. Full Stop means that once the logger has run out of memory it will stop. Next the output indicates that we are logging only during fix data and at set intervals, with an interval delay of 15 seconds. We are not logging based on distance or speed. The current status is LOGGING (active), there's also the number of records we've stored.
Copy and paste all the text after the —-'s (starting with $PMTKLOX,0,86*67 and ending with $PMTK001,622,3*36) then paste it into the box located on this page OR you can try this python tool that don has kindly donated to the community! Using the GPS Tool If you are having difficulty with the Arduino/javascript tool, you can also try using the GPS tool. The tool runs only under Windows but it is very powerful.
LOCUS Parser LOCUS Parser (https://adafru.it/cFg) © Adafruit Industries https://learn.adafruit.
External Antenna New in version 3 of the Ultimate GPS breakout, we now have support for optional external antennas! This is not available in v1 or v2 so if you do not see the uFL connector, you have an older version of the module which cannot support antennas All Ultimate GPS modules have a built in patch antenna - this antenna provides -165 dBm sensitivity and is perfect for many projects.
There is an output sentence that will tell you the status of the antenna. $PGTOP,11,x where x is the status number. If x is 3 that means it is using the external antenna. If x is 2 it's using the internal antenna and if x is 1 there was an antenna short or problem. On newer shields & modules, you'll need to tell the firmware you want to have this report output, you can do that by adding a gps.sendCommand(PGCMD_ANTENNA) around the same time you set the update rate/sentence output.
Resources Datasheets MTK3329/MTK3339 command set sheet for changing the fix data rate, baud rate, sentence outputs, etc! PMTK 'complete' datasheet (like the above but with even more commands) Datasheet for the PA6B (MTK3329) GPS module itself Datasheet for the PA6C (MTK3339) GPS module itself Datasheet for the PA6H (MTK3339) GPS module itself MT3339 GPS PC Tool (windows only) and the PC Tool manual Sample code and spec sheet for the LOCUS built-in logger LOCUS (built-in-datalogging system) user guide Mini G
Downloads Files MTK3329/MTK3339 command set sheet for changing the fix data rate, baud rate, sentence outputs, etc! LOCUS (built-in-datalogging system) user guide Datasheet for the PA6B (MTK3329) GPS module itself - used in version 1 of this module Datasheet for the PA6C (MTK3339) GPS module itself - used in version 2 of this module Datasheet for the PA6H (MTK3339) GPS module itself - used in version 3 of this module MT3339 GPS PC Tool (windows only) and the PC Tool manual Mini GPS tool (windows only) Eagle
© Adafruit Industries https://learn.adafruit.
F.A.Q. Can the Ultimate GPS be used for High Altitude? How can I know? Modules shipped in 2013+ (and many in the later half of 2012) have firmware that has been tested by simulation at the GPS factory at 40km. You can tell what firmware you have by sending the firmware query command $PMTK605*31 (you can use the echo demo to send custom sentences to your GPS) If your module replies with AXN_2.10_3339_2012072601 5223 that means you have version #5223 which is the 40Km-supported firmware version.
© Adafruit Industries Last Updated: 2018-02-27 02:45:08 AM UTC Page 40 of 40