Let's Make Robots!

Getting data from gps module GTPA010

I bought  a gps unit i've never thought of trying out and this morning i wanted to get my geolocation!

I got my GPS from here MicroGPS Module

Bellow is a diagram of the gps unit and its pinouts for the with arduino and probably mbed too

 

 

 

 

 

 

 

Here is an image of the program bellow in action

 

 

 

 

 

 

 

I've created a simple program (Nothing snazzy) which catches the serial data and displays the values although long and lat are offset, which is the devices fault. (I'm actually wondering why gps hates me, even my phone wont display gps coodinates properly for me, but oh well atleast we have the values we wanted and we can work with them!

Oh BTW!! Make sure you set your serialports baud rate and comport to the correct COM!


 

Public Class Form1
    Dim ggaUTC_Time, ggaLatitude, ggaNS_Indicator, _
        ggaLongitude, ggaEW_Indicator, ggaPosition_Fix_Indicator, _
        ggaSatalitesUsed, ggaMSL_Altitude, ggaUnits_Altitude, _
        gsvNumberOfMsgs, gsvMsgNumber, gsvSatalites_In_View, _
        gsvSatalite_ID, gsvElevation, gsvAzimuth, gps_speed, _
        gps_heading, gps_sats_vis

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        CheckForIllegalCrossThreadCalls = False
        SerialPort1.Open()
    End Sub

    Private Sub SerialPort1_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
        Try 'Make sure we're not going to cause a null exception
            Dim Information = SerialPort1.ReadLine
            Dim gpsinfo = Information.Split(",")
            If gpsinfo(0) = "$GPGGA" Then
                ggaUTC_Time = gpsinfo(1)
                ggaLatitude = gpsinfo(2)
                ggaNS_Indicator = gpsinfo(3)
                ggaLongitude = gpsinfo(4)
                ggaEW_Indicator = gpsinfo(5)
                ggaPosition_Fix_Indicator = gpsinfo(6)
                ggaSatalitesUsed = gpsinfo(7)
                ggaMSL_Altitude = gpsinfo(9)
                ggaUnits_Altitude = gpsinfo(10)
            End If

            If gpsinfo(0) = "$GPRMC" Then
                gps_speed = gpsinfo(7)
            End If
            If gpsinfo(0) = "$GPVTG" Then
                gps_heading = gpsinfo(1)
            End If

            If gpsinfo(0) = "$GPGSV" Then
                gps_sats_vis = gpsinfo(3)
            End If

            'Lat/Long are offset (Stupid gps?)
            Dim lat = CInt(ggaLatitude.replace(".", "")) + 309299'Offset
            Dim lon = CInt(ggaLongitude.replace(".", "")) + 169675'Offset
            lon = -lon
            TextBox1.Text = "UTC Time: " + ggaUTC_Time.ToString.Replace(".000", "").Insert(2, ":").Insert(5, ":") + vbCrLf + _
                "Position Fix: " + ggaPosition_Fix_Indicator + vbCrLf + _
                "Lat/Lon: " + CStr(lat).Insert(2, ".") + " / " + CStr(lon).Insert(2, ".") + vbCrLf + _
                "NS Indicator: " + ggaNS_Indicator + vbCrLf + _
                "EW Indicator: " + ggaEW_Indicator + vbCrLf + _
                "Knots: " + gps_speed + vbCrLf + _
                "Magnetic Heading: " + gps_heading + vbCrLf + _
                "Altitude: " + ggaMSL_Altitude + " (" + ggaUnits_Altitude + ")" + vbCrLf + _
                "Satalites Visible: " + gps_sats_vis + vbCrLf + _
                "Satalites Used: " + ggaSatalitesUsed
        Catch ex As Exception
            'Catch Error
        End Try
    End Sub
End Class

 


 

The arduinocode is pretty simple, Although for some reason it would only work with software serial!


 

#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3, false);
void setup() 
{Serial.begin(4800);
  mySerial.begin(4800);}
void loop()
{if (mySerial.available())
    Serial.write(mySerial.read());}

 


 

I hope this helps anyone new with gps receivers!!! :)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

I found some code, probably an early version of a component of the ardupilot code pack that supposedly decodes the NMEA data coming from the GPS:

https://docs.google.com/file/d/0ByI4WbhJsiyqMDYzMjVmYTItMzc4Ni00NTRlLTg2NjctNzFiNmEwOWM2OTI4/edit?usp=drive_web&hl=en&pli=1

However, this was meant to be used with an Arduino Mega so it utilized Serial and Serial1. I'm trying to hook up the GPS to softserial, D0 nad D1 on the wild thumper robot controller. So i edited the .cpp file like so:

http://pastebin.com/XdTdfDgy 

and the arduino code like this:

http://pastebin.com/H3Che11m 

Anything obviously wrong? I tried editing and writing my own code using the tinyGPS library and got the gps to send chars but i wasn't having luck decoding them.

For reference here's the data sheet https://docs.google.com/file/d/0B_dHj7E2weiiNmUzNDA3OTktNTNhNy00Y2Y5LTg0YTQtMzIyNzJhZmFiNjcy/edit?usp=drive_web&urp=http://store.3drobotics.com/products/mediatek-mt33&pli=1&hl=en# 

This gps is pretty cheap and i think a good how-to on LMR is a great thing to have for what could be a widely used sensor.

Where can i get the include (gps) files?

I have the same gps module and I'm having some problems with it.

I got mine from 3DR http://store.3drobotics.com/products/mediatek-mt3329-gps-v2-0 

The user manual isnt very clear, and I had to solder VCC and Enable wires onto the soldering pads after removing the plastic case, even though there were 6 wires coming out of a port, one of which, the red, seems to not be connected to anything.

Did you experience this issue with yours? 

 

Just a quick note that your device is not generating inaccurate data that needs "offsetting" to correct.  You're misinterpreting the NMEA specification for how the data is presented.  That is, when you see a latitude of

xxyy.zzzz,N

this does NOT mean

xx.yyzzzz degrees north latitude.  It means xx degrees and yy.zzzz MINUTES north latitude.  It's a common error, but makes a significant difference.

Thanks for the write up. I am sure this info will help others who plan to use gps with their projects.

the reason for softserial working is because we could figure out how to set the serial up to be non-inverting. Hardware serial seems to be inverted in, well, hardware. MarkusB seemed to have a clue as to how to get non-inverted data to/from the hardware serial.