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!!! :)