Library to operate GPS 20u7 with Mbed

Dependencies:   TinyGPS mbed

GP-20U7 is a GPS receiver build-in high performances -165dBm GPS chipset. GP-20U7 provides high position, velocity and time accuracy performances as well as high sensitivity and tracking capabilities. The low power consumption makes this GPS receiver deal for most portable applications. /media/uploads/zbraun6/img_7911.jpg

This 56-channel GPS module, that supports a standard NMEA-0183 and uBlox 7 protocol, has low power consumption of 40mA@3.3V (max), an antenna on board, and -162dBm tracking sensitivity. With 56 channels in search mode and 22 channels “all-in-view” tracking, the GP-20U7 is quite the work horse for its size.

Features

  • 56-Channel Receiver (22 Channel All-in-View)
  • Sensitivity: -162dBm
  • 2.m Positional Accuracy
  • Cold Start: 29 seconds (Open Sky)
  • 40mA @ 3.3V
  • 3 pin JST connection

This module sends six National Marine Electronics Association(NMEA) messages in the form of strings. It is standardized with NMEA 0183 https://en.wikipedia.org/wiki/NMEA_0183 . It is slowly being phased out by NMEA 2000 https://en.wikipedia.org/wiki/NMEA_2000. It is also capable of using the UBLOX protocol. The serial configuration needed for the GP-20U7 is:

Serial Configuration

  • Baud Rate = 9600
  • Data Bits = 8
  • Parity = None
  • Stop Bits = 1
  • Handshake = None

/media/uploads/zbraun6/screen_shot_2016-10-30_at_1.40.23_am.png

/media/uploads/zbraun6/img_7910.jpg

A typical output will look similar to the following: /media/uploads/zbraun6/screen_shot_2016-10-30_at_1.30.16_am.png

It is a combination of 6 different standard strings GGA, GLL, GSA, GSV, RMC, and VTG.

The NMEA string parsing can be very tricky in order to combat this I imported a library that I was familiar with from Arduino tinkering called TinyGPS.

Import libraryTinyGPS

Port of Arduino TinyGPS library to mbed. Added extra methods to flag receipt/parsing of particular sentences.

The above library has been encapsulated in the new c++ class contained in my GPS 20u7 library.

Import libraryGPS_20u7

Library to operate GPS 20u7 with Mbed

Here is the Hello World example code to use the GPS 20u7 library.

main.cpp

#include "gps.h"

// serial
GPS gps(p13, p14);
Serial serial_pc(USBTX, USBRX);    // tx, rx

int main() {
   
   serial_pc.printf("Hello World\n");


 while(1) {
           if(gps.isConnected()){
               //serial_pc.printf("Serial device is here \n"); 
               if(gps.isLocked()){
                   gps.parseNMEA();
                    
            serial_pc.printf("UTC: %d-%02d-%02d %02d:%02d:%02d, \n\r", gps.year, gps.month, gps.day, gps.hour, gps.minute, gps.second);
            serial_pc.printf("As doubles- Latitude: %f, Longitude: %f Altitude: %f Course: %f \n\r", gps.f_lat, gps.f_lon, gps.f_altitude, gps.f_course);
            serial_pc.printf("Speed: %f mph, %f mps, %f kmph \n\r", gps.mph, gps.mps, gps.kmph);
            serial_pc.printf("Horizontal Dilution as double: %f \n\r", gps.f_hdop);  
            serial_pc.printf("Less Precise- Latitude: %l, Longitude: %l Altitude: %l Course: %ul \n\r", gps.lat, gps.lon, gps.altitude, gps.course);
            serial_pc.printf("Horizontal Dilution as long: %f \n\r", gps.hdop); 
            serial_pc.printf("Age of fix: %lu ms \n\r", gps.age); 
            serial_pc.printf("Number of Satelites: %lu Speed: %lu 1/100ths of a knot \n\r", gps.sat_count, gps.speed);  
            wait(5);  
        }
    }
}
}

Demo

unknown revision 'shortlog'