Quantcast
Channel: SparkFun Tutorials
Viewing all articles
Browse latest Browse all 1123

SparkFun GPS Dead Reckoning NEO-M8U Hookup Guide

$
0
0

SparkFun GPS Dead Reckoning NEO-M8U Hookup Guide a learn.sparkfun.com tutorial

Available online at: http://sfe.io/t1166

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

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.

USB micro-B Cable - 6 Foot

USB micro-B Cable - 6 Foot

CAB-10215
$4.95
13
Qwiic Cable - 100mm

Qwiic Cable - 100mm

PRT-14427
$1.50
SparkFun RedBoard Qwiic

SparkFun RedBoard Qwiic

DEV-15123
$19.95
5

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. If you want to try different chip antennas, then try the GNSS Antenna Evalutation Board listed below and make sure to get the u.FL to u.FL connector in the accessories.

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

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

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

GPS/GNSS Embedded Antenna - 1m (SMA)

GPS-14987
$59.95
GPS Embedded Antenna SMA

GPS Embedded Antenna SMA

GPS-00177
$11.95
SparkFun GNSS Chip Antenna Evaluation Board

SparkFun GNSS Chip Antenna Evaluation Board

GPS-15247
$24.95
1

GPS Antenna Accessories

Interface Cable SMA to U.FL

Interface Cable SMA to U.FL

WRL-09145
$4.95
3
GPS Antenna Ground Plate

GPS Antenna Ground Plate

GPS-15004
$4.95
U.FL to U.FL Mini Coax Cable - 200mm

U.FL to U.FL Mini Coax Cable - 200mm

WRL-15114
$1.95

Other Qwiic Cable Accessories

SparkFun Qwiic Cable Kit

SparkFun Qwiic Cable Kit

KIT-15081
$7.95
4
Qwiic Cable - 100mm

Qwiic Cable - 100mm

PRT-14427
$1.50
Qwiic Cable - 200mm

Qwiic Cable - 200mm

PRT-14428
$1.50
Qwiic Cable - 50mm

Qwiic Cable - 50mm

PRT-14426
$0.95

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 intertial measurement unit (IMU). The addition of an IMU allows the M8U to produce more accurate readings in between GNSS data refreshes! 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.

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 these. 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.

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 ReferenceBottom 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.

ConstellationsGPS+GLOGPSLGLOBDSGAL
Horizontal Position AccuracyAutonomus2.5m2.5m4.0m3.0mTo Be Confirmed
with SBAS1.5m1.5m
Max Navigation Update RatePVT25Hz25Hz25Hz25Hz25Hz
Time-To-First-FixCold Start24s25s26s28s29s
Hot Start2s2s2s2s2s
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 Accuracy0.05m/s0.05m/s0.05m/s0.05m/s0.05m/s
Heading Accuracy1deg1deg1deg1deg1deg


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.

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

Top View with the the Axis for ReferenceBottom View with the the Axis for Reference

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.

alt text

Mounting the SparkFun Dead Reckoning NEO-M8U

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. 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:

  • Firstly 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.

alt text

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.

alt text

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. Make sure to secure the board above a vehicle's dashboard using some tape or sticky tack when prototyping and testing.

alt text

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 precisionu-blox cousins. The SparkFun U-blox Arduino library can be downloaded with the Arduino library manager by searching 'SparkFun Ublox' 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 and so the basic GPS polling sketches as shown in the other u-blox hookup guides are skipped.

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.

  • Firstly 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, 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 myGPS.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 (myGPS.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);
  }

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

In 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 (myGPS.getEsfInfo()){
    Serial.print("Fusion Mode: ");  
    Serial.println(myGPS.imuMeas.fusionMode);  
    if (myGPS.imuMeas.fusionMode == 1)
      Serial.println("Sensor is calibrated!");  
  }

  delay(250);
}

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. 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 (myGPS.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);
  }

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

  if (myGPS.getEsfInfo()){

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

    if (myGPS.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 (myGPS.getEsfIns())
  {
    Serial.print("X: ");
    Serial.println(myGPS.imuMeas.xAngRate);  
    Serial.print("Y: ");
    Serial.println(myGPS.imuMeas.yAngRate);  
    Serial.print("Z: ");
    Serial.println(myGPS.imuMeas.zAngRate);  
    Serial.print("X Acceleration: ");
    Serial.println(myGPS.imuMeas.xAccel);  
    Serial.print("Y Acceleration: ");
    Serial.println(myGPS.imuMeas.yAccel);  
    Serial.print("Z Acceleration: ");
    Serial.println(myGPS.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);
}

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.

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 (myGPS.getEsfInfo()){

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

    if (myGPS.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 next gets the relevant information by calling myGPS.getVehAtt(). As in Example 2, the data is stored within a struct called vehAtt.

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

        delay(250);
}   

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-RTK2 Board - ZED-F9P (Qwiic)

SparkFun GPS-RTK2 Board - ZED-F9P (Qwiic)

GPS-15136
$219.95
19
SparkFun GPS-RTK-SMA Breakout - ZED-F9P (Qwiic)

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

GPS-16481
$219.95
SparkFun GPS Breakout - ZOE-M8Q (Qwiic)

SparkFun GPS Breakout - ZOE-M8Q (Qwiic)

GPS-15193
$44.95
3
SparkFun GPS Breakout - NEO-M9N, U.FL (Qwiic)

SparkFun GPS Breakout - NEO-M9N, U.FL (Qwiic)

GPS-15712
$64.95
2

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

GPS Differential Vector Pointer

Use GPS to have two objects, a base and a target, point towards one another. This can be used to aim a directional antenna (or in the case of this project, a laser) from one object to the other object at a distance that is only limited by your ability to provide the base station with the target's GPS location.

SparkFun GPS Breakout - XA1110 (Qwiic) Hookup Guide

Figure out where in the world you are with the Qwiic SparkFun GPS Breakout - XA1110.

What is GPS RTK?

Learn about the latest generation of GPS and GNSS receivers to get 2.5cm positional accuracy!

GPS-RTK2 Hookup Guide

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

learn.sparkfun.com | CC BY-SA 3.0 | SparkFun Electronics | Niwot, Colorado


Viewing all articles
Browse latest Browse all 1123

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>