Adafruit Ultimate GPS featherwing Created by lady ada Last updated on 2018-11-27 03:08:20 AM UTC
Guide Contents Guide Contents Overview Pinouts Power Pins Serial Data Pins GPS Breakouts Coin Battery Reset Button Antennas Basic RX-TX Test Arduino Library Parsed Data CircuitPython Library Usage Datalogging Example 2 3 7 7 7 8 9 9 10 11 15 15 17 17 22 Install SD Card Library Enable Internal Filesystem Writes Datalogging Example Code Battery Backup Antenna Options Resources Datasheets More reading: Adafruit GPS Library for Arduino EPO files for AGPS use F.A.Q.
Overview Give your Feather a sense of place, with an Ultimate GPS FeatherWing. This FeatherWing plugs right into your Feather board and gives it a precise, sensitive, and low power GPS module for location identifcation anywhere in the world. As a bonus, the GPS can also keep track of time once it is synced with the satellites. -165 dBm sensitivity, 10 Hz updates, 66 channels 20mA current draw RTC with coin battery backup Built-in datalogging PPS (pulse per second) output on fix Internal patch antenna + u.
The Wing 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. The MTK3339-based module has external antenna functionality.
We added some extra goodies to make this GPS FeatherWing better than a breakout: a FET-driven ENABLE pin so you can turn off the module using any microcontroller pin for low power use, a CR1220 coin cell holder to keep the RTC running and allow warm starts and a tiny bright red LED. The LED blinks at about 1Hz while it's searching for satellites and blinks once every 15 seconds when a fix is found to conserve power.
Comes as a fully assembled FeatherWing with GPS module and a coin cell holder. However, the 12mm coin cell isnot included - it isn't required but if you would like a battery backup, a CR1220 coin battery must be purchased seperately. We also toss in some header so you can solder it in and plug into your Feather © Adafruit Industries https://learn.adafruit.
Pinouts Power Pins The GPS module runs from +3.3V power and uses 3V logic. the GPS is powered directly from the 3V and GND pins on the bottom left of the Feather. Each Feather has a regulator to provide clean 3V power from USB or battery power. Serial Data Pins The GPS module, like pretty much all GPS's, communicates over UART serial. It sends ASCII NMEA setences from the © Adafruit Industries https://learn.adafruit.
GPS TX pin to the microcontroller RX pin and can be controlled to change its data output from the GPS RX pin. Logic level is 3.3V for both. The baud rate by default is 9600 baud, but you can configure the module to use different baud rate if desired The GPS is wired directly to the Serial pins at the bottom right of the Feather.
FIX is an output pin - it is the same pin as the one that drives the red FIX 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 "pulse per second" output. Most of the time it is at logic low (ground) and then it pulses high (3.
There is a small button that will connect the microcontroller RESET pin to ground for resetting it. Handy to restart the Feather. Note that this is not connected to GPS reset unless you short the jumper on the back! Antennas You have two options for an antenna. The GPS module has an antenna on it already, that's the square tan ceramic thing on the left side. If you plug an active GPS antenna into the uFL connector on the very right, the module will automatically switch over to the external antenna.
Basic RX-TX Test The first, and simplest test, is just to echo data back and forth using the Feather's USB connection to read the GPS data out. The nice thing about this demo is no library is required. This doesn't work with the ESP8266, ATmega328P or nRF52832 Feather! It will work on the nRF52840, m32u4, M0, M4, Teensy, ESP32 and others Upload the following to your Feather, it will work with the Feather 32u4, M0, M4, WICED, etc. Anything that does not have the RX/TX pins used to communicate.
// // // // // // // // // // // // // // // Test code for Ultimate GPS Using Hardware Serial (e.g. GPS for Leonardo, Flora or FeatherWing) This code shows how to test a passthru between USB and hardware serial Tested and works great with the Adafruit GPS FeatherWing ------> https://www.adafruit.com/products/3133 or Flora GPS ------> https://www.adafruit.com/products/1059 but also works with the shield, breakout ------> https://www.adafruit.com/products/1272 ------> https://www.adafruit.
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. These two provide the time, date, latitude, longitude, altitude, estimated land speed, and fix type.
Look for the line that says $GPRMC,194509.000,A,4042.6142,N,07400.4168,W,2.03,221.11,160412,,,A*77 This line is called the RMC (Recommended Minimum) sentence and has pretty much all of the most useful data. Each chunk of data is separated by a comma. The first part 194509.000 is the current time GMT (Greenwich Mean Time). The first two numbers 19 indicate the hour (1900h, otherwise known as 7pm) the next two are the minute, the next two are the seconds and finally the milliseconds.
Arduino Library Once you've gotten the GPS module tested with direct rx-tx, we can go forward and do some more advanced parsing. Download the Adafruit GPS library. This library does a lot of the 'heavy lifting' required for receiving data from GPS modules, such as reading the streaming data in a background interrupt and auto-magically parsing it. To see the code, visit the GitHub repository (https://adafru.
Then open up the serial monitor. In this sketch, we call GPS.read() constantly in the main loop (if you can, get this to run once a millisecond in an interrupt). Then in the main loop we can ask if a new chunk of data has been received by calling GPS.newNMEAreceived(), if this returns true then we can ask the library to parse that data with GPS.parse(GPS.lastNMEA()).
CircuitPython Library You can easily use a GPS module like the ultimate GPS FeatherWing with CircuitPython code. Python code is well suited for parsing and processing the text output from GPS modules and this Adafruit CircuitPython GPS (https://adafru.it/BuR) module handles most of the work for you! First make sure your Feather is running CircuitPython firmware, and the GPS FeatherWing is assembled and connected to the Feather board.
# For other boards set RX = GPS module TX, and TX = GPS module RX pins. RX = board.RX TX = board.TX # Create a serial connection for the GPS connection using default speed and # a slightly higher timeout (GPS modules typically update once a second). uart = busio.UART(TX, RX, baudrate=9600, timeout=3000) # Create a GPS module instance. gps = adafruit_gps.GPS(uart) # # # # # Initialize the GPS module by changing what data it sends and at what rate.
gps.timestamp_utc.tm_min, # month! gps.timestamp_utc.tm_sec)) print('Latitude: {} degrees'.format(gps.latitude)) print('Longitude: {} degrees'.format(gps.longitude)) print('Fix quality: {}'.format(gps.fix_quality)) # Some attributes beyond latitude, longitude and timestamp are optional # and might not be present. Check if they're None before trying to use! if gps.satellites is not None: print('# satellites: {}'.format(gps.satellites)) if gps.altitude_m is not None: print('Altitude: {} meters'.format(gps.
Next the GPS module is imported: import adafruit_gps Now a serial UART (https://adafru.it/BuT) is created and connected to the serial port pins the GPS module will use, this is the low level transport layer to communicate with the GPS module: # Define RX and TX pins for the board's serial port connected to the GPS. # These are the defaults you should use for the GPS FeatherWing. # For other boards set RX = GPS module TX, and TX = GPS module RX pins. RX = board.RX TX = board.
above. You don't need to worry about adding a NMEA checksum to your command either, the function will do this automatically (or not, set add_checksum=False as a parameter and it will skip the checksum addition). Now we can jump into a main loop that continually updates data from the GPS module and prints out status. The most important part of this loop is calling the GPS update function: # Make sure to call gps.
latitude, longitude, and timestamp are usually always available (if you're using the example as-is) but they might not be if you turn off those outputs with a custom NMEA command! That's all there is to reading GPS location with CircuitPython code! Datalogging Example Another handy task with GPS is logging all the raw output of the GPS module to a file. This is useful if you're importing the GPS data into a tool like Google Earth which can process raw NMEA sentences.
code over the USB drive as normal. Remove the alligator clip, reset the board, and the boot.py will switch to mounting the internal filesystem as writable so you can log images to it again (but not write any code!). Remember when you enable USB drive writes (by connecting D5 to ground at startup) you cannot write files to the internal filesystem and any code in your main.py that attempts to do so (like the example below) will fail.
# 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.
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 install a battery. We provide the holder but the battery is not included. You can use any 12mm coin cell - these are popular and we also carry them in the Adafruit shop.
Antenna Options All Ultimate GPS modules have a built in patch antenna - this antenna provides -165 dBm sensitivity and is perfect for many projects. However, if you want to place your project in a box, it might not be possible to have the antenna pointing up, or it might be in a metal shield, or you may need more sensitivity. In these cases, you may want to use an external active antenna. (http://adafru.it/960) Active antennas draw current, so they do provide more gain but at a power cost.
© Adafruit Industries https://learn.adafruit.
Resources Datasheets MTK3329/MTK3339 command set sheet (https://adafru.it/e7A) for changing the fix data rate, baud rate, sentence outputs, etc! PMTK 'complete' data (https://adafru.it/uoe)sheet (like the above but with even more commands) Datasheet for the PA6B (MTK3329) GPS module itself (https://adafru.it/aMo) Datasheet for the PA6C (MTK3339) GPS module itself (https://adafru.it/aMp) Datasheet for the PA6H (MTK3339) GPS module itself (https://adafru.
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.
The timezone cannot be changed, so you'll have to calculate local time based on UTC! © Adafruit Industries https://learn.adafruit.
Downloads Datasheets & Files EagleCAD PCB Files on GitHub (https://adafru.it/nCQ) Fritzing object in Adafruit Fritzing library (https://adafru.it/aP3) Adafruit GPS Arduino Library (https://adafru.it/nCR) MTK3329/MTK3339 command set sheet (https://adafru.it/qif) for changing the fix data rate, baud rate, sentence outputs, etc! LOCUS (built-in-datalogging system) user guide (https://adafru.it/uoC) Datasheet for the PA6H (MTK3339) GPS module itself (https://adafru.
© Adafruit Industries Last Updated: 2018-11-27 03:08:20 AM UTC Page 34 of 34