Adafruit Ultimate GPS Logger Shield Created by lady ada Last updated on 2015-10-06 04:20:08 PM EDT
Guide Contents Guide Contents Overview Shield Headers 2 3 5 Assembly with male headers Assembly with stacking headers Direct Connect Direct Connection Using the Switch (Uno/Mega) Direct Connection with Jumpers on Leonardo Testing Direct Connection Sending NMEA Commands via Direct Connect Soft Serial Connect Parsing Data If you're using an Uno/Duemilanove/Diecimila... If you're using a Leonardo..
Overview Brand new and better than ever, we've replaced our Adafruit GPS shield kit with this assembled shield that comes with an Ultimate GPS module. This GPS shield works great with either UNO or Leonardo Arduinos and is designed to log data to an SD card. Or you can leave the SD card out and use the GPS for a geocaching project, or maybe a music player that changes tunes depending on where you are in the city.
Each order comes with one assembled and tested shield, a stick of 0.1" male header and a 12mm coin cell. Some light soldering is required to attach the header to the shield in order to plug it into your Arduino. if you want to stack a shield on top, be sure to pick up a set of stacking headers to use instead. If your project is going to be inside an enclosure, you'll love this shield as it has external antenna support. Simply connect an external active GPS antenna (http://adafru.
Shield Headers The Ultimate GPS Logger shield comes tested assembled with a GPS unit and microSD socket already on it, but you'll still need need to put headers on so you can plug it into an Arduino We don't pre-assemble the headers on because there's two options! You can either use plain 0.1" male headers (included with the shield) or Arduino Shield Stacking headers (http://adafru.it/85). Assembly with male headers Most people will be happy with assembling he shield with male headers.
Place the shield on top so the short ends stick out thru the PCB, solder all the pins That's it! Now you can continue and test the shield © Adafruit Industries https://learn.adafruit.
Assembly with stacking headers If you want to attach another shield on top, you can use stacking headers. These headers provide a 'pass-thru' connection so multiple shields can be attached. However, if you put a shield on top, its likely it will cover the GPS patch antenna so you may need to get an external GPS antenna (http://adafru.it/960).
Fit the long pins through the pads until they slot into the Arduino. Depending on which version/type of Arduino you may need to use 2 x 8pin and 2 x 6pin or 1 x 10pin, 2 x 8pin and 1 x 6pin. Turn the Arduino upside down so its resting on the long parts of the stacky headers and solder them from below. You may want to pull the headers out a little to get them to sit flat against the shield PCB Solder all the pins! © Adafruit Industries https://learn.adafruit.
Direct Connect Direct connection is a funky trick we use to connect the output of the GPS serial TTL UART directly to the usb-serial converter chip on an Arduino.
Direct Connection with Jumpers on Leonardo If you have a Leonardo we have to do a funky trick where we swap the Direct connect wires (because the processor chip acts like the USB/Serial converter rather than having a seperate chip. The upshot is you'll need two wires. For basic testing as long as the wires touch the two sets of pads, you'll be able to continue with this very basic test.
Finally upload the Adafruit_GPS->leo_echo sketch to the Leonardo, this will shuffle data from the GPS to the USB port Testing Direct Connection 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: © Adafruit Industries https://learn.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.
If you can get a really long USB cord (or attach a GPS antenna to uFL plug) and stick the GPS out a window, so its pointing at the sky, eventually the GPS will get a fix and the window data will change over to transmit valid data like this: 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.
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.03 knots After that is the tracking angle, this is meant to approximate what 'compass' direction we're heading at based on our past travel The one after that is 160412 which is the current date (16th of April, 2012).
Soft Serial Connect Once you've gotten the GPS module tested with direct wiring, we can go forward and set it up for Soft Serial connection. The soft serial connection works by setting up a secondary UART on two pins (digital 7 and 8) so that the main UART is free for debugging & uploading sketches Soft Serial connection works on Uno/Duemilanove/Diecimila Arduinos as well as Leonardos.
Open up the File® Examples® Adafruit_GPS® leo_echo sketch and upload it to the Arduino. Then open up the serial monitor. This sketch simply reads data from the software serial port (pins 7&8) and outputs that to the hardware serial port connected to USB. You can configure the 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.
Parsing Data 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. If you're using an Uno/Duemilanove/Diecimila...
In this sketch, we can either use interrupts and call GPS.read() within a once-a-millisecond timer (this is the same timer that runs the millis() command) or we check GPS.read() in the main loop constantly. 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()).
SD Logging Finally we get to the fun stuff! Its time to log data from the GPS onto an SD card. First up we'll do a basic test to make sure the SD card system is working. You'll need a microSD card to log data onto. Any capacity will do. Slide the microSD card into the silver socket.
that will be SD.cpp SD.h etc) In the libraries folder, make a new folder called SDbackup. Then drag the SD folder into SDbackup, this will 'hide' the old SD library without deleting it Now we'll grab the new SD library, visit https://github.com/adafruit/SD (http://adafru.it/aP6) and click the ZIP download button, or click the button below Download the SD library zip © Adafruit Industries https://learn.adafruit.
http://adafru.it/cxl Uncompress and rename the uncompressed folder SD. Check that the SD folder contains SD.cpp and SD.h Place the SD library folder your sketchbook libraries folder. You may need to create the libraries subfolder if its your first library. For more details on how to install libraries, check out our ultradetailed tutorial at (http://adafru.it/aYM)http://learn.adafruit.com/adafruit-all-about-arduino-librariesinstall-use (http://adafru.it/aYM) Once installed, restart the IDE.
If the SD card was initialized OK, it will read a sentence from the GPS, check the checksum and if its a proper sentence, and then log it. You can customize this basic example by changing the sendCommand in the top of setup(), for example you can turn on different sentences (although RMC and GGA are the most desirable, we've found). Or change the update rate to 5Hz instead of 1Hz You can also set it so only 'fixed' data is logged - that is, there has to be valid location data.
Built In Logging The built in logging capability isn't easy to use with the Shield - we wanted to make it better for SD logging so while we do have some details here, its not well supported and not recommended For more details, you can read the LOCUS (built-in-datalogging system) user guide (http://adafru.it/dL2) Built In Logging One of the nice things about the GPS module on the shield is the built in data-logger.
Logging Status Once you've seen that the GPS is OK with logging, you can load up the status sketch which will also give you more data. Upload File® Examples® Adafruit_GPS® locus_status and change the line SoftwareSerial mySerial(3, 2); to SoftwareSerial mySerial(8, 7); Downloading Data © Adafruit Industries https://learn.adafruit.
Finally, once we're done logging we need to extract the data. To do this we need to first get the raw data out of the FLASH and then decode the sentences. UploadFile® Examples® Adafruit_GPS® locus_dump to the Arduino and open up the serial monitor. Change the software serial line to use pins 8 and 7 PLEASE NOTE: Asking the Arduino, with 2K RAM buffer to handle 64KB of FLASH data and spit it out from the GPS can sometimes over-tax the processor.
LOCUS Parser LOCUS Parser (http://adafru.it/cFg) © Adafruit Industries https://learn.adafruit.
Antenna, Battery and More! LEDs We love LEDs! There are three LEDs on board to help you with debugging and status updates: Green PWR LED tells you that there is a good 3V power supply. If this isn't on, there's a serious problem with the power supply, perhaps the battery died Yellow L13 (and SD card access) LED is connected to digital 13, this is handy for telling when the Arduino is bootloading and also will flicker whenever the SD card is accessed. Red FIX LED is connected to the GPS's fix output.
Active antennas draw current, so they do provide more gain but at a power cost. Check the antenna datasheet for exactly how much current they draw - its usually around 1020mA. (http://adafru.it/960) Most GPS antennas use SMA connectors, which are popular and easy to use. However, an SMA connector would be fairly big on the GPS breakout so we went with a uFL connector - which is lightweight, small and easy to manufacture.
RTC Backup Battery The Ultimate GPS module does not have a built in RTC battery, but a coin cell is provided, simply place the coin cell inside the holder, with the + facing up, thats it! The battery will last 7+ years The real time clock will automatically set itself to the correct UTC time as soon as the GPS gets its first correct signal from a satellite. Without the battery, if the GPS loses power, it will forget the time and has to wait till it gets signal again to reset.
Breakout and Proto-area Since the GPS module is so small, we had tons of space left over, we turned that into a proto area. Feel free to put any circuitry you'd like into the 0.1" spaced holes. None of the holes are connected. There's also a few breakouts near the SoftSerial/Direct switch. For example, the PPS pin which provides pulse-per-second output when the GPS has a fix.
FAQ Can my module do 40Km altitude? How can I know? Modules shipped in 2013+ (and many in the later half of 2012) have firmware that has been tested 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 version. HOWEVER these modules are not specifically designed for high-altitude balloon use.
Downloads There's also more information at the GPS module tutorial page http://learn.adafruit.com/adafruitultimate-gps (http://adafru.it/aTl) MTK3329/MTK3339 command set sheet (http://adafru.it/e7A) for changing the fix data rate, baud rate, sentence outputs, etc! Datasheet for the PA6H (MTK3339) GPS module itself (http://adafru.it/aPO) MT3339 GPS PC Tool (windows only) (http://adafru.it/aMq) and the PC Tool manual (http://adafru.
© Adafruit Industries https://learn.adafruit.