SparkFun GPS Dead Reckoning NEO-M8U Hookup Guide

Pages
Contributors: bboyho, Elias The Sparkiest
Favorited Favorite 3

Introduction

The u-blox NEO-M8U is a powerful GPS units that takes advantage of untethered dead reckoning (UDR) technology for navigation. The module provides continuous positioning for vehicles in urban environments and during complete signal loss (e.g. short tunnels and parking garages). We will quickly get you set up using the Qwiic ecosystem and Arduino so that you can start reading the output!

SparkFun GPS Dead Reckoning Breakout - NEO-M8U (Qwiic)

SparkFun GPS Dead Reckoning Breakout - NEO-M8U (Qwiic)

GPS-16329
$69.95
3

Required Materials

To follow along with this tutorial, you will need the following materials. You may not need everything though depending on what you have. Add it to your cart, read through the guide, and adjust the cart as necessary.

Microcontroller

One method of connecting to the GPS is using a Qwiic cable and microcontroller. We will use the RredBoard Qwiic fo the scope of this tutorial.

SparkFun RedBoard Qwiic

SparkFun RedBoard Qwiic

DEV-15123
$21.50
20
Qwiic Cable - 100mm

Qwiic Cable - 100mm

PRT-14427
$1.50
USB Micro-B Cable - 6 Foot

USB Micro-B Cable - 6 Foot

CAB-10215
$5.50
15

Additional GPS Antenna Options

Below are some other GPS Antenna options. Some of the options below have an SMA connector, so make sure to get the u.FL to SMA cable if you decide to use those. Link for that is below in the GPS accessories.

GPS/GNSS Magnetic Mount Antenna - 3m (SMA)

GPS/GNSS Magnetic Mount Antenna - 3m (SMA)

GPS-14986
$13.95
3
GPS Embedded Antenna SMA

GPS Embedded Antenna SMA

GPS-00177
$12.95
GPS/GNSS Embedded Antenna - 1m (SMA)

GPS/GNSS Embedded Antenna - 1m (SMA)

GPS-14987
$64.50

GPS Antenna Accessories

Interface Cable SMA to U.FL - 100mm

Interface Cable SMA to U.FL - 100mm

WRL-09145
$5.50
3

GPS Antenna Ground Plate

GPS-15004
Retired

Other Qwiic Cable Accessories

SparkFun Qwiic Cable Kit

SparkFun Qwiic Cable Kit

KIT-15081
$8.95
22
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

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.

Serial Peripheral Interface (SPI)

SPI is commonly used to connect microcontrollers to peripherals such as sensors, shift registers, and SD cards.

I2C

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

How to Work with Jumper Pads and PCB Traces

Handling PCB jumper pads and traces is an essential skill. Learn how to cut a PCB trace, add a solder jumper between pads to reroute connections, and repair a trace with the green wire method if a trace is damaged.

Getting Started with U-Center for u-blox

Learn the tips and tricks to use the u-blox software tool to configure your GPS receiver.

Three Quick Tips About Using U.FL

Quick tips regarding how to connect, protect, and disconnect U.FL connectors.

What is Dead Reckoning?

Dead Reckoning is the process of determining current position by combining previously determined positional data with speed and heading. This process can also be applied to determine future positions as well! The NEO-M8U uses what is called Untethered Dead Reckoning (UDR) which calculates speed and heading (amongst many other points of data) through the use of an internal inertial measurement unit (IMU). The addition of an IMU allows the M8U to produce more accurate readings in between GNSS data refreshes!

Illustration of Using an IMU with GNSS Data Illustration of Using only GNSS Data Only
Illustration of Using an IMU with GNSS Data Illustration of Using only GNSS Data Only

Illustration of Refresh Rate to Accurately Determine Position. Image Courtesy of u-blox from the UDR Whitepaper.

In addition, the module can also give accurate and useful GNSS data in areas where satellite connections are difficult to maintain: areas like the dense urban environments of major cities, long tunnels, parking garages, any large UFO's that may descend from the sky, etc.

UDR Dead Reckoning vs GNSS Only Comparison in an Urban Canyon

Untethered Dead Reckoning vs GNSS Only Comparison in an Urban Canyon. Image Courtesy of u-blox from the UDR Whitepaper.

Hardware Overview

Power

Power for this board is 3.3V and we have provided multiple power options. This first and most obvious is the USB-C connector. Secondly, are the Qwiic Connectors on the top and bottom of the board. Thirdly, there is a 5V pin on the PTH header along the side of the board that is regulated down to 3.3V. Make sure that power your provide to this pin does not exceed 6 volts. Finally, just below the 5V pin is a 3.3V pin that should only be provided a clean 3.3V power signal.

 Power Pins

Battery

The small metal disk in the upper left corner is a small lithium battery. This battery does not provide power to the IC like the 3.3V system does, but to relevant systems inside the IC that allow for a quick reconnection to satellites. The time to first fix will about ~26 seconds, but after it has a lock, that battery will allow for about a 1.5 second time to first fix. This is known as a hot start and lasts for four hours after the board is powered down. The battery provides over a years worth of power to the backup system and charges slowly when the board is powered. To charge it to full, leave your module plugged in for 48 hours.

Battery for Hot Start

LEDs

There's is a red power LED just to the left of the bottom Qwiic connector and near the board's edge to indicate that the board is powered. There is another LED just above the power LED labeled PPS that is connected to the Pulse Per Second line. When connected to a satellite, this line generates a pulse that is synchronized with a GPS or UTC time grid. By default, you'll see one pulse a second.

Status LEDs

Jumpers

There are four jumpers on the underside of the product, each labeled with its function. At the upper right of the picture is a three way jumper labeled I²C that connects two pull-up resistors to the I2C data lines. If you have many devices on your I2C data lines, then you may consider cutting the two small traces connecting the center pad to the left and right pads. On the left side of the board is a jumper labeled PWR. If you cut this trace it will disconnect the Power LED. Just below is the PPS jumper that when cut disconnects the PPS LED. Finally, there's a jumper labeled SPI which enables the SPI data bus thus disabling the UART functions on those lines. For more information, check out our tutorial on working with jumper pads and PCB traces.

Jumpers on the Back

U.FL Connector

The SparkFun GPS NEO-M8U has a u.FL connector in which you can connect a patch antenna.

u.FL connector

Qwiic and I2C

There are two pins labeled SDA and SCL which indicates the I2C data lines. Similarly, you can use either of the Qwiic connectors to provide power and utilize I2C. The Qwiic ecosystem is made for fast prototyping by removing the need for soldering. All you need to do is plug a Qwiic cable into the Qwiic connector and voila!

I2C Pins and Qwiic connector

SPI

There are four pins on the right most header that are labeled with their corresponding SPI functionality. As mentioned in the jumpers section, you'll need to close the SPI jumper on the underside to enable SPI.

SPI Pins

UART

There are two pins on the right most header labeled for their UART functionality.

UART Pins

Broken Out Pins

There are four other pins broken out: Pulse per second (PPS), Reset (RST), Safeboot (SAFE), and finally the interrupt pin (INT). The first pin PPS, outputs pulse trains synchronized with the GPS or UTC time grid. The signal defaults to once per second but is configurable over a wide range. Read the u-blox Receiver Protocol Specification in the Resources and Going Further tab for more information. The reset pin resets the chip. The next pin, SAFE is used to start up the IC in safe boot mode, this could be useful if you somehow manage to corrupt the module's Flash memory. The final pin INT can be used to wake the chip from power save mode.

Pins Broken Out

3D IMU Orientation and Reference

For easy reference, we've documented the IMU's vectors with 3D Cartesian coordinate axes on the top and bottom side of the board. Make sure to orient and mount the board correctly so that the NEO-M8U can accurately calculate navigation information. This is explained in detail in the Dead Reckoning Overview. Remember, it's all relative.

Top View with the the Axis for Reference Bottom View with the the Axis for Reference
Top View with the the Axis for Reference Bottom View with the the Axis for Reference

Board Dimension

Overall, the board is 1.30"x1.60".

Board Dimensions

GPS Capabilities

The SparkFun NEO-M8U is able to connect to up to three different GNSS constellations at a time. Below are the listed capabilities of the GPS unit taken from the datasheet when connecting to different GNSS constellations.

Constellations GPS+GLO GPSL GLO BDS GAL
Horizontal Position Accuracy Autonomus2.5m2.5m4.0m3.0mTo Be Confirmed
with SBAS1.5m1.5m
Max Navigation Update Rate PVT 25Hz 25Hz 25Hz25Hz25Hz
Time-To-First-Fix Cold Start24s 25s 26s 28s29s
Hot Start 2s 2s 2s 2s 2s
SensitivityTracking and Navigation -160dBm -160dBm -160dBm -160dBm -154dBm
Reacquisition -160dBm -159dBm -156dBm -155dBm -152dBm
Cold Start-148dBm -147dBm -145dBm -143dBm -133dBm
Hot Start -157dBm -156dBm -155dBm -155dBm-151dBm
Velocity Accuracy 0.05m/s 0.05m/s 0.05m/s 0.05m/s 0.05m/s
Heading Accuracy 1deg 1deg 1deg 1deg 1deg


Dead Reckoning Overview

As mentioned in the "What is Dead Reckoning?" section, the u-blox M8U module has an internal inertial measurement unit or IMU for short. The IMU calculates position based on the last GNSS refresh and its own movement data points. To use the SparkFun GPS Dead Reckoning Board, there are a few guidelines to orienting and mounting the module to a vehicle outlined in the u-blox ReceiverDescrProtSpec Datasheet.

Orientation for the SparkFun Dead Reckoning

The SparkFun Dead Reckoning adheres to two particular frames of reference: one frame of reference for the car and the second a geodetic frame of reference anchoring it to the globe. The latter, known as the local level frame uses the following as its' axes:

  • X-axis points to the North
  • Y-axis points to the East
  • Z-axis uses the right hand system by pointing down.

This frame will be referred to by its acronym NED (North-East-Down) in the image below.

The second frame of references is the Body-Frame reference and uses the following as its' axes.

  • X-axis points to the front of the vehicle
  • Y-axis points to the right of the vehicle
  • Z-axis uses the right hand system by pointing down.

Vehicle Attitude

The transformation of the vehicle within these two frames are given as heading, pitch, and roll. In the datasheet these three angles are called the vehicle's attitude. Below is an image that illustrates how all of these elements fit together.

Diagram Vehicle Attitude with Position of Dead Recogning IMU

Mounting the SparkFun Dead Reckoning NEO-M8U

You can reference the IMU axes directly on the SparkFun Dead Reckoning NEO-M8U silk in the corner closest to the battery.

Top View with the the Axis for Reference Bottom View with the the Axis for Reference
Top View with the the Axis for Reference Bottom View with the the Axis for Reference

The only guideline here is that the SparkFun Dead Reckoning is stable within 2 degrees, and of course that the X-axis points towards the front of the car as mentioned above.

Mounting GPS and Antenna

In the image above the SparkFun Dead reckoning is seen in the front, driver's side of the car and it may be tempting to think that this is also a necessary requirement. However, it can be mounted anywhere within the vehicle (or RC-car, or boat). Keep in mind that the pitch and roll is relative to the SparkFun Dead Reckoning's position.

Calibration

After you've mounted the SparkFun Dead Reckoning M8U, there is still a calibration phase to complete that must satisfy the following movements:

  • First, the car needs to be stopped with the engine turned on.
  • Secondly, the car must do left and right hand turns.
  • Lastly, the car must reach a speed over 30 km/h.

In SparkFun's u-blox Arduino library, SparkFun has included an Example (shown below), that prints out the module's calibration status.

Hardware Assembly

For this example, I used a RedBoard Qwiic and associated USB cable. Connecting the boards with Qwiic cable, the assembly is very simple. Plug a Qwiic cable between the RedBoard and SparkFun NEO-M9U. Then plugged in one of our patch antennas to the u.FL connector. If you need tips on plugging in the U.FL connector, then check out our U.FL tutorial. If you're going to be soldering to the through hole pins for I2C functionality, then just attach lines to power, ground, and the I2C data lines to a microcontroller of your choice. Your setup should look similar to the image below.

NEO-M8U Connected to RedBoard Qwiic and Antenna

For secure connections, you may want to thread the U.FL cable through a mounting hole before connecting. Adding tape or some hot glue will provide some strain relief to prevent the cable from disconnecting.

Strain Relief on u.FL Connector Using Mounting Hole

When using the NEO-M8U, you will want to orient the board according to the guidelines explained earlier. Below is a top-down view with the board pointing down.

Orientation of NEO-M8U

Make sure to secure the board above a vehicle's dashboard using some tape or sticky tack when prototyping and testing. For best signal reception, it is suggested to guide the antenna from the inside of the car and through a window before attaching the GPS on top of a car.

Mounting GPS and Antenna

SparkFun u-blox Library

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.

All of our u-blox based GPS boards share the same library: this board, their predeccesors and the higher precision u-blox cousins. The SparkFun U-blox Arduino library can be downloaded with the Arduino library manager by searching 'SparkFun u-blox GNSS' or you can grab the zip here from the GitHub repository to manually install.

There are 13 example sketches provided to get you up and receiving messages from space. The examples listed below highlight the additional capabilities of the SparkFun Dead Reckoning NEO-M8U. For the scope of this tutorial, we will not focus on the basic GPS polling sketches as shown in the other u-blox hookup guides.

Example 1 - Calibrate Sensor

Now that the SparkFun Dead Reckoning is mounted and oriented correctly with regards to the vehicle, it's time to calibrate the sensor. To do this, a few movements with the vehicle must be done all while maintaining good GNSS reception.

  • First, the car needs to be stopped with the engine turned on.
  • Secondly, the car must do left and right hand turns.
  • Lastly, the car must reach a speed over 30 km/h.

For the first example (located in File Examples > SparkFun u-blox GNSS Arduino Library > Dead Reckoning > Example1_calibrateSensor), the calibration status will be printed to the Arduino's serial monitor to indicate when calibration is ongoing and when it has completed.

In the first code block, there's a call to myGNSS.setI2COUtput(COM_TYPE_UBX) towards the bottom which turns off NMEA noise.

language:c
void setup()
{
  Serial.begin(115200);
  while (!Serial); //Wait for user to open terminal
  Serial.println("SparkFun Ublox Example");

  Wire.begin();

  if (myGNSS.begin() == false) //Connect to the Ublox module using Wire port
  {
    Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing."));
    while (1);
  }

  myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
}

The second code block below is where the heart of the sketch lives. The code pings the module to get its "ESF Info" (External Sensor Fusion Info), to see what Fusion Mode has been achieved. A zero indicates calibration while a one indicates calibrated.

language:c
void loop()
{

  if (myGNSS.getEsfInfo()){
    Serial.print("Fusion Mode: ");  
    Serial.println(myGNSS.imuMeas.fusionMode);  
    if (myGNSS.imuMeas.fusionMode == 1)
      Serial.println("Sensor is calibrated!");  
  }

  delay(250);
}

If you have not already, select your Board (in this case the Arduino Uno), and associated COM port. Upload the code to the board and and set the serial monitor to 115200 baud. Perform those fancy maneuvers (while obeying the traffic laws) before parking your car in a safe location. Then turn your engine off before checking the status! You should see a message indicating that the NEO-M8U is calibrated. If you do not, try driving around with the board once again!

Example 2 - IMU Data

After you have your sensor calibrated (see example 1), you can now poll the internal IMU to see what data is being fed to the GNSS calculations. Open the second example (located in File Examples > SparkFun u-blox GNSS Arduino Library > Dead Reckoning > Example2_getIMUData) to follow along! First, the sketch checks to see that the board is calibrated before it attempts to read IMU data.

language:c
void setup()
{
  Serial.begin(115200);
  while (!Serial); //Wait for user to open terminal
  Serial.println("SparkFun Ublox Example");

  Wire.begin();

  if (myGNSS.begin() == false) //Connect to the Ublox module using Wire port
  {
    Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing."));
    while (1);
  }

  myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)

  if (myGNSS.getEsfInfo()){

    Serial.print("Fusion Mode: ");  
    Serial.println(myGNSS.imuMeas.fusionMode);  

    if (myGNSS.imuMeas.fusionMode == 1){
      Serial.println("Fusion Mode is Initialized!");  
        }
        else {
      Serial.println("Fusion Mode is either disabled or not initialized - Freezing!");  
            Serial.println("Please see Example 1 description at top for more information.");
        }
  }
}

Next, the sketch grabs that IMU data which is stored in a struct called imuMeas.

language:c
void loop()
{

  if (myGNSS.getEsfIns())
  {
    Serial.print("X: ");
    Serial.println(myGNSS.imuMeas.xAngRate);  
    Serial.print("Y: ");
    Serial.println(myGNSS.imuMeas.yAngRate);  
    Serial.print("Z: ");
    Serial.println(myGNSS.imuMeas.zAngRate);  
    Serial.print("X Acceleration: ");
    Serial.println(myGNSS.imuMeas.xAccel);  
    Serial.print("Y Acceleration: ");
    Serial.println(myGNSS.imuMeas.yAccel);  
    Serial.print("Z Acceleration: ");
    Serial.println(myGNSS.imuMeas.zAccel);  
        // These values also have "validity checks" that can be provided by the
        // ublox library, add "Vald" to values: e.g. xAngRateVald or xAccelVald. 
  }

  delay(250);
}

If you have not already, select your Board (in this case the Arduino Uno), and associated COM port. Upload the code to the board and set the serial monitor to 115200 baud. This may be a good time to bring a friend along to drive if you decide to actively monitor the output. Otherwise, check out the data after taking the board for a stroll. Try driving around as the board senses the car's movement. Then park in a safe location with the engine turned off before inspecting the data.

Example 4 - Vehicle Dynamics

What happened to Example 3? It's been skipped over because its used primarily as a diagnostic sketch. What sensors are currently being used, are they functioning correctly, are the measurements being listed as bad or non-existent? Example 3 helps diagnose these various issues. Lets move ahead to the fourth example in the library (located in File Examples > SparkFun u-blox GNSS Arduino Library > Dead Reckoning > Example4_vehicleDynamics)

The vehicle attitude is a termed coined by u-blox that encompasses three measurements: vehicle pitch, vehicle roll, and vehicle heading. Much like the other example sketches, this one checks to make sure that the SparkFun Dead Reckoning NEO-M8U has been calibrated before pulling data.

language:c
if (myGNSS.getEsfInfo()){

    Serial.print("Fusion Mode: ");  
    Serial.println(myGNSS.imuMeas.fusionMode);  

    if (myGNSS.imuMeas.fusionMode == 1){
      Serial.println("Fusion Mode is Initialized!");  
        }
        else {
      Serial.println("Fusion Mode is either disabled or not initialized - Freezing!");  
            Serial.println("Please see Example 1 description at top for more information.");
        }
  }
}

If the SparkFun Dead Reckoning NEO-M8U has indeed been calibrated, then it gets the relevant information by calling myGNSS.getVehAtt(). As in Example 2, the data is stored within a struct called vehAtt.

language:c
void loop()
{
        myGNSS.getVehAtt(); // Give the sensor you want to check on. 
        Serial.print("Roll: "); 
        Serial.println(myGNSS.vehAtt.roll);
        Serial.print("Pitch: "); 
        Serial.println(myGNSS.vehAtt.pitch);
        Serial.print("Heading: "); 
        Serial.println(myGNSS.vehAtt.heading);
        Serial.print("Roll Accuracy: "); 
        Serial.println(myGNSS.vehAtt.accRoll);
        Serial.print("Pitch Accuracy: "); 
        Serial.println(myGNSS.vehAtt.accPitch);
        Serial.print("Heading Accuracy: "); 
        Serial.println(myGNSS.vehAtt.accHeading);

        delay(250);
}

If you have not already, select your Board (in this case the Arduino Uno), and associated COM port. Upload the code to the board and set the serial monitor to 115200 baud. This may be a good time to bring a friend along to drive if you decide to actively monitor the output. Otherwise, check out the data after taking the board for a stroll. Try driving around as the board senses the car's movement. Then park in a safe location with the engine turned off before inspecting the data.

Resources and Going Further

Now that you've successfully got your GPS receiver up and running, it's time to incorporate it into your own project! For more information, check out the resources below:

Are you looking for a GPS receivers? Check out the following GPS boards from the SparkFun catalog!

SparkFun GPS-RTK-SMA Breakout - ZED-F9P (Qwiic)

SparkFun GPS-RTK-SMA Breakout - ZED-F9P (Qwiic)

GPS-16481
$249.95
18
SparkFun RTK Facet

SparkFun RTK Facet

GPS-19984
$699.95
16
SparkFun RTK Facet L-Band

SparkFun RTK Facet L-Band

GPS-20000
$1,599.95
10
SparkFun GPS Breakout - NEO-M9N, SMA (Qwiic)

SparkFun GPS Breakout - NEO-M9N, SMA (Qwiic)

GPS-17285
$74.95
8

Need some inspiration for your next project? Check out some of these related tutorials:

Copernicus II Hookup Guide

A guide for how to get started with the Copernicus II GPS module.

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.

Mini GPS Shield Hookup Guide

A hookup guide for the SparkFun Mini GPS Shield.

SparkFun GPS Breakout (ZOE-M8Q and SAM-M8Q) Hookup Guide

The SparkFun ZOE-M8Q and SAM-M8Q are two similarly powerful GPS units but with different project applications. We'll compare both chips before getting each up and running.