TechUp.

Using the Adafruit Ultimate GPS Featherwing

Cover Image for Using the Adafruit Ultimate GPS Featherwing
Kyle
Kyle

Introduction

Have you ever wanted to know where your project is located, how fast it's moving, or what direction it's pointing? If so, the Ultimate GPS Featherwing from Adafruit is the perfect solution. In this tutorial, you will learn how to use this Featherwing to retrieve GPS NMEA sentences, which can then be parsed to get the position, speed, altitude, bearing, and many other data points. More info about NMEA Sentences

A GPS tracker I created to wear while skydiving which stored position, altitude, and speed

Parts Required

For this tutorial, all you need is an Adafruit Feather board such as the Adafruit M0 Adalogger, and the Adafruit Ultimate GPS Featherwing.

Assembly

Assembling the parts required for this project is extremely simple due to Adafruit's Feather system. All that you have to do is solder header pins onto your Adafruit Feather board, and then you can stack the GPS Featherwing on top!

Programming

The GPS module communicates via Serial, which is the same protocol that your microcontroller uses to send messages to the Serial monitor within the Arduino IDE. This makes it quite simple to receive data from the GPS. The first thing that we want to do is to begin the Serial connection with the GPS module.

The first line here defines a Macro that allows us to refer to Serial1 as GPSSerial, which improves readability a bit. Next, we define a string called sentence which will be used to store the GPS sentence as it arrives over Serial. Lastly, within the setup function, we begin a Serial connection over the USB port to allow for debugging within an IDE, as well as begin another Serial connection for communicating with the GPS.

Now, within the loop function let's add a check to see if the GPS has any new data for us and if it does let's add it to the sentence variable. To know when a given sentence has ended, we can check to see if there is a newline character. Now that we know this, it is easy to display full sentences once they have arrived!

As you can see, within this code snippet we also are storing the sentence type. The sentence type is the GPS's way of telling us what type of information a given sentence contains, and depending on your use case you most likely do not need to read all sentence types.

An NMEA sentence broken-down source

Comments:


    More Stories