SparkFun GPS Breakout - XA1110 (Qwiic) Hookup Guide

Pages
Contributors: Englandsaurus
Favorited Favorite 5

Introduction

The XA1110 GPS module from GTOP is a rare bird indeed. GPS modules are hard to come by, but an I2C GPS+GLONASS module? Now we're cooking with peanut oil! This small module also utilizes the MediaTek MT3333 chipset, loaded with specialized SparkFun firmware that enables both I2C and Serial ports simultaneously. Using I2C means you won't have to tie up your serial port with GPS, leaving it open to other possibilities.

SparkFun GPS Breakout - XA1110 (Qwiic)

SparkFun GPS Breakout - XA1110 (Qwiic)

GPS-14414
$34.95
6

This module is configured with an on-board RTC battery that enables a warm-start functionality. (Giving the XA1110 just five seconds to first fix) A U.FL connector gives you the option to hook up an external antenna via a U.FL cable

This hookup guide will show you how to get started figuring out where on Earth you are. You'll also learn how to change the update rate of the GPS up to 10 Hz as well as change the baud rate.

Required Materials

To get started, you'll need a microcontroller to, well, control everything.

SparkFun RedBoard - Programmed with Arduino

SparkFun RedBoard - Programmed with Arduino

DEV-13975
$21.50
50
SparkFun ESP32 Thing

SparkFun ESP32 Thing

DEV-13907
$23.50
69

Particle Photon (Headers)

WRL-13774
32 Retired

Raspberry Pi 3

DEV-13825
92 Retired

Now to get into the Qwiic ecosystem, the key will be one of the following Qwiic shields to match your preference of microcontroller:

SparkFun Qwiic HAT for Raspberry Pi

SparkFun Qwiic HAT for Raspberry Pi

DEV-14459
$6.50
5
SparkFun Qwiic Shield for Arduino

SparkFun Qwiic Shield for Arduino

DEV-14352
$7.50
9

SparkFun Qwiic Shield for Photon

DEV-14477
Retired

You will also need a Qwiic cable to connect the shield to your GPS module, choose a length that suits your needs.

Qwiic Cable - 100mm

Qwiic Cable - 100mm

PRT-14427
$1.50
Qwiic Cable - 50mm

Qwiic Cable - 50mm

PRT-14426
$0.95

Qwiic Cable - 200mm

PRT-14428
Retired

Qwiic Cable - 500mm

PRT-14429
1 Retired

Suggested Reading

If you aren't familiar with the Qwiic system, we recommend reading here for an overview.

Qwiic Connect System
Qwiic Connect System

We would also recommend taking a look at the following tutorials if you aren't familiar with them.

GPS Basics

The Global Positioning System (GPS) is an engineering marvel that we all have access to for a relatively low cost and no subscription fee. With the correct hardware and minimal effort, you can determine your position and time almost anywhere on the globe.

I2C

An introduction to I2C, one of the main embedded communications protocols in use today.

Qwiic Shield for Arduino & Photon Hookup Guide

Get started with our Qwiic ecosystem with the Qwiic shield for Arduino or Photon.

Hardware Overview

Below is a table listing all of the hardware features and specs for the XA1110.

CharacteristicRange
Operating Voltage3.3V: Regulated to 1.8V - 3.6V
Current25 mA (typical)
Hot/Warm/Cold Start1/5/15 seconds
Update Rate1 Hz (default), 0.1-10 Hz
I2C Interface100kHz & 400kHz (3.3V)
I2C Address0x10
UART9600 bps (default), 4800-115200 bps (3.3V)
Position Accuracy<3.0m, <2.5m with SBAS enabled
Satellites99 during search, 33 during tracking
Sensitivity-148dBm Acquisition, -165dBm Tracking
Max Altitude80km (the mesosphere) using the example configuration sketch to enable high-altitude balloon mode
RTC Battery5.5mAh, enables warm start for 15 days without power

Pins

The following table lists all of the XA1110's pins and their functionality.

PinDescriptionDirection
GNDGroundIn
3.3VPowerIn
SDADataIn
SCLClockIn
INTInterrupt, goes low when NMEA data is ready, after packet is read, the pin pulls highOut
WakeWake upIn
RSTPulling low will reset the moduleIn
PPSProvides one pulse-per-second signalOut
RXUART receiver; to receive commandsIn
TXUART transmitter; outputs GPS informationOut

Optional Features

The XA1110 breakout has several optional features. The first of which is the option to disable the pulse-per-second LED. This can be done by slicing the connection on the JP5 jumper with a hobby knife. If multiple sensors are connected to the bus with the pull-up resistors enabled, the parallel equivalent resistance will create too strong of a pull-up for the bus to operate correctly. As a general rule of thumb, disable all but one pair of pull-up resistors if multiple devices are connected to the bus. If you need to disconnect the pull up resistors they can be removed by removing the solder on the pull up resistor jumper highlighted below. Both jumpers are shown in the below image.

pull up resitor jumper

There is also a U.FL connector on the board, outlined below, which can be used in conjunction with the U.FL cable to connect to an external antenna

U.FL connector

Hardware Assembly

If you haven't yet assembled your Qwiic Shield, now would be the time to head on over to that tutorial. With the shield assembled, Sparkfun's new Qwiic environment means that connecting the sensor could not be easier. Just plug one end of the Qwiic cable into the XA1110 breakout, the other into the Qwiic Shield and you'll be ready to upload a sketch and figure out where you are. It seems too easy, but thats why we made it this way!

XA1110 plugged into shield

Library Overview

First, you'll need to download and install the Sparkfun I2C GPS library, this can be done using the button below or by using the Arduino Library Manager.

Note: This example assumes you are using the latest version of the Arduino IDE on your desktop. If this is your first time using Arduino, please review our tutorial on installing the Arduino IDE. If you have not previously installed an Arduino library, please check out our installation guide.

Before we get started developing a sketch, let's look at the available functions of the library.

  • boolean begin(TwoWire &wireport = Wire, uint32_t i2cSpeed = I2C_SPEED_STANDARD); --- begin() is used to start the GPS, it runs sort of like this:
    • Starts running the I2C port at the given port and clock speed
    • Pings the module and checks for a response
    • Returns TRUE if the response is received, FALSE if not.
  • void check(); --- Checks the module for new data.
  • uint8_t available(); --- Returns the available number of bytes. Will call check() if zero is available.
  • uint8_t read(); --- Returns the next available byte.
  • void enableDebugging(Stream &debugPort = Serial); --- Outputs various messages to assist in debugging.
  • void disableDebugging(); --- Pretty self explanatory, turns off debugging.
  • boolean sendMTKpacket(String command); --- Can be used to send a command or configuration to the GPS module.
    • The input buffer on the MTK is 255 bytes, so strings must be shorter than 255 bytes.
    • After ending a transmission, give the module 10 ms to process the message.
  • String createMTKpacket(uint16_t packetType, String dataField); --- Creates a config sentence (String) from a packetType and any settings. See 'MTK NMEA Packet' datasheet for more info.
  • String calcCRCforMTK(String sentence); --- XORs bytes to create MTK packet.

Note: Due to a new QZSS satellite recently launched by the Japanese, users in the Asia-Pacific region (Longitude 70 to -160 degrees East) can experience huge drifts in location over the course of 2 hours. In order to remedy this, two options are available. The first is to simply reset the module every 2 hours. The second option is to disable the QZSS feature entirely. To do this, simply use the following command in your setup loop. sendMTKpacket($PMTK352,1*2B);

Example Code

You should have downloaded the SparkFun I2C GPS Library in the previous step, if not, go back and click the button to download it. Within should be contained the library along with five examples. We're going to get you started with the first two examples.

Upload the following example to the microcontroller of your choice.

language:c
#include "SparkFun_I2C_GPS_Arduino_Library.h"
I2CGPS myI2CGPS; //Hook object to the library

void setup()
{
  Serial.begin(115200);
  Serial.println("GTOP Read Example");

  if (myI2CGPS.begin() == false)//Checks for succesful initialization of GPS
  {
    Serial.println("Module failed to respond. Please check wiring.");
    while (1); //Freeze!
  }
  Serial.println("GPS module found!");
}

void loop() //Writes GPS data to the Serial port with a baud rate of 115200
{
  while (myI2CGPS.available()) //available() returns the number of new bytes available from the GPS module
  {
    byte incoming = myI2CGPS.read(); //Read the latest byte from Qwiic GPS

    if(incoming == '$') Serial.println(); //Break the sentences onto new lines
    Serial.write(incoming); //Print this character
  }
}

This first example outputs the raw NMEA sentences. Which look something like this:

NMEA output

If your GPS doesn't have a satellite fix, you will simply get zeroes instead of numbers. These NMEA sentences may be a little hard to wrap your head around if you don't fluently speak GPS, so let's move onto the second example, which will take this data, and use the TinyGPS library to transform it into some sensible latitude and longitude data. The second example requires the TinyGPS library, which can be downloaded using the button below.

The below example code will take these NMEA sentences and use the displayInfo() function to output some nice and friendly latitude and longitude readings.

language:c
#include <SparkFun_I2C_GPS_Arduino_Library.h> //Use Library Manager or download here: https://github.com/sparkfun/SparkFun_I2C_GPS_Arduino_Library
I2CGPS myI2CGPS; //Hook object to the library

#include <TinyGPS++.h> //From: https://github.com/mikalhart/TinyGPSPlus
TinyGPSPlus gps; //Declare gps object

void setup()
{
  Serial.begin(115200);
  Serial.println("GTOP Read Example");

  if (myI2CGPS.begin() == false)
  {
    Serial.println("Module failed to respond. Please check wiring.");
    while (1); //Freeze!
  }
  Serial.println("GPS module found!");
}

void loop()
{
  while (myI2CGPS.available()) //available() returns the number of new bytes available from the GPS module
  {
    gps.encode(myI2CGPS.read()); //Feed the GPS parser
  }

  if (gps.time.isUpdated()) //Check to see if new GPS info is available
  {
    displayInfo();
  }
}

//Display new GPS info
void displayInfo()
{
  //We have new GPS data to deal with!
  Serial.println();

  if (gps.time.isValid())
  {
    Serial.print(F("Date: "));
    Serial.print(gps.date.month());
    Serial.print(F("/"));
    Serial.print(gps.date.day());
    Serial.print(F("/"));
    Serial.print(gps.date.year());

    Serial.print((" Time: "));
    if (gps.time.hour() < 10) Serial.print(F("0"));
    Serial.print(gps.time.hour());
    Serial.print(F(":"));
    if (gps.time.minute() < 10) Serial.print(F("0"));
    Serial.print(gps.time.minute());
    Serial.print(F(":"));
    if (gps.time.second() < 10) Serial.print(F("0"));
    Serial.print(gps.time.second());

    Serial.println(); //Done printing time
  }
  else
  {
    Serial.println(F("Time not yet valid"));
  }

  if (gps.location.isValid())
  {
    Serial.print("Location: ");
    Serial.print(gps.location.lat(), 6);
    Serial.print(F(", "));
    Serial.print(gps.location.lng(), 6);
    Serial.println();
  }
  else
  {
    Serial.println(F("Location not yet valid"));
  }
}

The output of this code in the serial monitor should look similar to the below image. If the module does not yet have a fix, you will see Location not yet valid instead of a latitude and longitude reading.

long lat output

Resources and Going Further

You've finally figured out where you are! Now it's time to take this GPS and incorporate it into your own project.

For a little more information, check the resources below:

For more GPS related fun, check out these other SparkFun tutorials.

Alphanumeric GPS Wall Clock

This is a GPS controlled clock - a clock you truly never have to set! Using GPS and some formulas, we figure out what day of the week and if we are in or out of daylight savings time.

Arduino Weather Shield Hookup Guide V12

Read humidity, pressure and luminosity quickly and easily. Add wind speed, direction and rain gauge for full weather station capabilities.

GPS-RTK2 Hookup Guide

Get precision down to the diameter of a dime with the new ZED-F9P from u-blox.

SparkFun RTK Reference Station Hookup Guide

Setup the RTK Reference Station in minutes and start sending RTCM NTRIP corrections to your favourite caster.