Adafruit Ultimate GPS HAT for Raspberry Pi Created by lady ada Last updated on 2018-08-22 03:45:45 PM UTC
Guide Contents Guide Contents Overview Pinouts Serial Console Pins PPS Pin HAT EEPROM Pi GPS Setup Set up the Pi to release the console pins Basic Test Serial test Use 'gpsd' Installing a GPS Daemon (gpsd) Raspbian Jessie systemd service fix Try out 'gpsd' More info! External Antenna Battery Backup Downloads Files Schematic Fabrication Print © Adafruit Industries 2 3 5 5 5 5 6 6 9 9 12 12 12 12 13 15 16 17 17 17 17 https://learn.adafruit.
Overview It's 10PM, do you know where your Pi is? If you had this Pi HAT, you would! This new HAT from Adafruit adds our celebrated Ultimate GPS on it, so you can add precision time and location to your Pi 3, Pi Zero, Pi 1 Model A+ or B+, or Pi 2 Here's the low-down on the GPS module: -165 dBm sensitivity, 10 Hz updates, 66 channels Only 20mA current draw Built in Real Time Clock (RTC) - slot in a CR1220 backup battery for 7-years or more of timekeeping even if the Pi is off! PPS output on fix, by default
© Adafruit Industries https://learn.adafruit.
Pinouts This HAT is pretty simple but its worth going thru what pins are used for what! The Ultimate GPS uses the following GPIO pins: TXD RXD #4 and EEDATA/EECLK Serial Console Pins The Raspberry Pi has only one serial port, and you do need serial to chat to a GPS so we will take over the RXD and TXD pins. PPS Pin GPS's can output a 'pulse per second' for synchronizing the time.
Pi GPS Setup Don't forget to also read our Ultimate GPS tutorial which has a lot of information about this GPS module and datasheets/example code that you will find handy! (https://adafru.
Select NO Keep the Serial Port Hardware enabled Thats it! Run sudo shutdown -h now to shutdown your Pi safely. Remove power, attach the GPS hat and re-power the Pi After rebooting the Pi for the above changes to take effect, you can proceed with testing the GPS! © Adafruit Industries https://learn.adafruit.
© Adafruit Industries https://learn.adafruit.
Basic Test We can get started by testing the GPS right at the command line. Before you start, you'll want to make sure the GPS modules has a 'fix' - that means it has received enough data from satellites to determinet he location. You can quickly determine fix status by looking at the Red LED on the GPS Hat: Blinking on and off once every other second - NO FIX Blinking once per 10 seconds or so - HAS FIX You may need to put the Pi near a window or attach an external antenna.
This is the raw GPS "NMEA sentence" output from the GPS module. There are a few different kinds of NMEA sentences, the most common ones people use are the $GPRMC (Global Positioning Recommended Minimum Coordinates or something like that) and the $GPGGA sentences. These two provide the time, date, latitude, longitude, altitude, estimated land speed, and fix type.
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. So the time when this screenshot was taken is 7:45 pm and 9 seconds.
Use 'gpsd' You can always just read that raw data, but its much nicer if you can have some Linux software prettify it. We'll try out gpsd which is a GPS-handling Daemon (background-helper) Installing a GPS Daemon (gpsd) The first step is installing some software on your Raspberry Pi that understands the serial data that your GPS module is providing via /dev/ttyAMA0.
or cgps which gives a less detailed, but still quite nice output cgps -s Don't forget, you do need to have FIX to use these tools! If you have FIX and cgps always displays 'NO FIX' under status and then aborts after a few seconds, you may need to restart the gpsd service. You can do that via the following commands: sudo killall gpsd sudo gpsd /dev/ttyAMA0 -F /var/run/gpsd.
existins libraries The following tutorials may be useful to you if you want to dig into this a bit further, and do something a bit more advanced with your GPS data: GETTING GPS TO WORK ON A RASPBERRY PI (https://adafru.it/aWL). GPSD Client How-To (https://adafru.it/eUC) ... including examples in C, C++ and Python The official GPSD project pages (https://adafru.it/aWN) A nice writeup of using GPSd with python using threads to make it faster (https://adafru.
External Antenna 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.
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 insert a battery. There is holder on the HAT for a CR1220 sized battery holder. We provide the holder but the battery is not included.
Downloads Files MTK3329/MTK3339 command set sheet (https://adafru.it/e7A) for changing the fix data rate, baud rate, sentence outputs, etc! PMTK 'complete' datasheet (https://adafru.it/uoe) (like the above but with even more commands) Datasheet for the PA6H (MTK3339) GPS module itself (https://adafru.it/aPO) Fritzing object in the Adafruit Fritzing Library (https://adafru.it/aP3) EagleCAD PCB files on GitHub (https://adafru.
© Adafruit Industries Last Updated: 2018-08-22 03:45:40 PM UTC Page 18 of 18