Anda di halaman 1dari 12

Adafruit Ultimate GPS Breakout v3 Tutorial for the

Raspberry Pi 3
By Walter Monterroso

PHYS 295 3 U WR Independent Research

Wilbur Wright College


Acknowledgments

I would like to thank the Illinois Space Grant Consortium, DePaul University, City Colleges of Chicago and
NASA for their support of the High Altitude Ballooning Spring 2017 Fellowship program. I would like to
also acknowledge Dr. Andrew Kruger and Dr. Soma Dey of Wright College and Dr. Phillip Vargas of
Harold Washington College for their help to make this program a reality for all its students. Lastly, I
would like to thank my peers for their influence and help while carrying out research experiences
together.
Table of Contents

Overview
Connecting to the Raspberry Pi
The GPS Module
Wiring Process using Fritzing Schematic
Connecting External Antenna (Optional)
Reading Data
Supporting Programs
Example Programs
Ultimate GPS v3 Schematic
Overview

The Adafruit Ultimate GPS Breakout is a GPS module that provides many different components for only
$39.99. These components include a data-logger with a flash memory size of about 128KB, or up to 32
hours of data, a u.FL connector for external antennas (sold separately), an RTC battery slot, which is
useful for detecting Greenwich Time instead of UTC, and much more. The GPS module works up to
40KM in the air and is a perfect setup for our High Altitude Ballooning project needs. I will discuss this
module specifically with the widely popular Raspberry Pi 3 and how to wire, configure and put to good
use.

One of the limitations Ive come across occurs when I begin transmitting and receiving inside large
buildings such as Harold Washington College, a twelve story building with lots of obstacles that could
hinder proper data logging. Instead, I did most of my tracking inside my two-story home. I would
recommend tracking around a residential area. Also, the v3 version of this module includes significant
improvements from the earlier modules, including higher altitude reading limit of 40KM (excellent for
High Altitude Ballooning). I hope you enjoy this tutorial as much as Ive enjoyed writing it.
Connecting to the Raspberry Pi

The GPS Module can be connected in two different ways: either directly or through a USB to TTL cable.
Ive used a 4-pin USB to TTL cable for this tutorial.

Required Items

Raspberry Pi 3 Model B

Adafruit Ultimate GPS Breakout v3

USB to TTL Cable (4-pin)

Optional Items

CR 1220 12mm Diamter 3V Lithium Cell Battery

External Antenna 3 5 Volt 5 Meter SMA 28 dB (Highly Recommended)

SMA to uFL Adapter Cable (Highly Recommended)


The GPS Module

The GPS Module is composed of several pins, each with similar but different uses (some are optional to
use). I will briefly explain the functions for each (from left to right):

3.3V Pin 3.3V output.

EN Pin Enable Pin. Used for projects requiring GPS module to be turned off for power consum ption
purposes at given times.

VBAT Pin Battery backup for Real-time Clock.

FIX Pin Drives Red LED Light. Off will pulse light every second. On will pulse light every 200ms.

TX Pin Receives data from GPS Module to Raspberry Pi. 3.3V; 9600 Baud Rate

RX Pin Sends data to GPS Module. 3 5V; 9600 Baud Rate

GND Pin Ground pin normally used for power functionality of sensor.

VIN Pin Power supply used from 3 5 V, perfect for Raspberry Pi.

PPS Pin Pulse per second output pin.


Wiring Process using Fritzing Schematic

Using the USB to TTL Cable (4-pin):

1. Connect the red wire (normally used for voltage) to the VIN Pin.
2. Connect the black wire (normally used for ground) to the GND Pin.
3. Connect the green wire to the RX pin.
4. Connect the white wire to the TX pin.
5. Connect USB to a USB Port on the Raspberry Pi.
Hooking up an External Antenna to GPS Module

Connecting an external antenna to the GPS Module is optional (since the GPS module has an onboard
one). However, I highly recommend purchasing this upgrade and its accompanying SMA to uFL adapter
for desired results. There is a circular slot on the GPS Module in which the uFL end (smaller side) of the
adapter will fit in nicely. Please take caution not to force the pin directly down if it will not correctly snap
on. It was easier to connect the uFL end to the slot at an angle. Snaps right in.
How to Run GPS Module onto your Raspberry Pi

Before continuing, please make sure that your Raspberry Pi is connected to the internet and you have
upgraded to the latest update of your distribution. If you have not please type sudo apt-get update in
the LX Terminal to access the latest software upgrades.

1. First, open LX Terminal.


2. Locate your ttyUSB device. In order to do this, type the following:

ls /dev/ttyUSB*

If you are having any issues, you can list all USB devices connected to your Raspberry Pi.

In order to list the USB devices connected to your Raspberry Pi, type the following command

sudo lsusb

3. Then, type the following to check if your GPS module is reading any sort of data.
sudo cat /dev/ttyUSB0
Now, we can finally read data!

4. You can now install the following program to read GPS data.

sudo apt-get install gpsd gpsd-clients python-gps


NOTE: If you have problems with your Raspian Jessie distribution, please read the following in order to
disable the service which GPSD has installed for you and may be causing some issues:

In order to disable system service:

sudo systemct1 stop gpsd.socket

sudo systemct1 disable gpsd.socket


In order to enable:

sudo systemct1 enable gpsd.socket

sudo systemct1 start gpsd.socket


Manual start GPSD

sudo gpsd /dev/ttyUSB0 -F /var/run/gpsd.sock


Great job! Now you can finally run an instance of the GPS program.

5. Run GPSD by typing the following:

cgps s
Example Program

import os
from gps import *
from time import *
import time
import threading Use the GPS library
posted by Adafruit to
gpsd = None #seting the global variable
come up with
class GpsPoller(threading.Thread):
def __init__(self):
different outputs of
threading.Thread.__init__(self) information for your
global gpsd #bring it in scope
gpsd = gps(mode=WATCH_ENABLE) #starting the stream of inf o
code. For example,
self.current_value = None you can modify your
self.running = True #setting the thread running to true
code in order to add
def run(self):
global gpsd
current time to your
while gpsp.running: position. Visit this
gpsd.next() #this will continue to loop and grab EACH set
of gpsd info to clear the buffe r
link to download a
copy of the Adafruit
if __name__ == '__main__':
gpsp = GpsPoller() # create the thread GPS Library on
gpsp.start() # start it up
GitHub.
time.sleep(5)
print 'latitude ' , gpsd.fix.latitude
print 'longitude ' , gpsd.fix.longitude

gpsp.running = False #arret


gpsp.join() # wait for the thread to finish what it's doing

The code above, which was posted by benjinight from the Raspberrypi.org forums, prints a basic output
of latitude and longitude when ran. Below is the result of the compiled program:
Ultimate Breakout V3 Schematic

Anda mungkin juga menyukai