Firewing GPS Shield on OSEPP Arduino Uno

Information and discussion regarding Firewing shields

Firewing GPS Shield on OSEPP Arduino Uno

Postby Edward » Sat Nov 23, 2013 1:57 am

Hello,
I am just at the start of a project to make a GPS_SD data logger, using the Firewing GPS shield on an Osepp Arduino Uno. I am fairly new to this stuff, and only have an intermediate understanding of C programming. All I'm trying to do is log basic GPS location to a *.csv file using one of the NMEA protocols, (most likely the $GPRMC protocol, or maybe the $GPGGA), but I'm not sure how to limit the type and speed of NMEA sentences using the Arduino IDE code. Ideally, I would have just a single NMEA sentence showing the date & time, lat. & long., and possibly the speed and direction of travel being logged, and new data being appended to the log once every 10 seconds or so. I am pretty sure I can write the code to pick the data I want out of a string, if that data string repeated on the same number of lines forever, but from the data I'm getting on the Serial monitor, none of the lines repeat like that consistently. I found a document from GlobalTop showing most of the PMTK command packets for the GPS+ GNS-g9 chip, but as I mentioned before, I am unsure of how to proceed. The Arduino code I found on the GPS_SD Shield browse on the Firewing.info web site is included below, and as you can see, it is very simple. I have also included a bit of the Serial Monitor output. Any help, or even a point in the right direction would be appreciated. Thanks in advance!

Code: Select all
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3); // RX, TX
int powerpin = 4;
int rxpin = 3;
int txpin = 2;
void setup() 
{
  pinMode(powerpin, OUTPUT);
  digitalWrite(powerpin, HIGH);
  Serial.begin(19200);
  mySerial.begin(9600);
 
  Serial.println("Waiting for GPS data...");
}

// loop forever
void loop()
{
  if (mySerial.available())
    Serial.write(mySerial.read());
}


Waiting for GPS data...
$PMTK011,MTKGPS*08
$PMTK010,001*2E
$PMTK011,MTKGPS*08
$PMTK010,002*2D
$GPGGA,235315.553,,,,,0,0,,,M,,M,,*48
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPRMC,235315.553,V,,,,,0.63,254.78,221113,,,N*46
$GPVTG,254.78,T,,M,0.63,N,1.17,K,N*3C
$GPGGA,235315.695,4952.9497,N,11929.5381,W,1,5,3.19,350.5,M,-16.0,M,,*64
$GPGSA,A,3,22,18,27,24,06,,,,,,,,3.32,3.19,0.91*0F
$GPRMC,235315.695,A,4952.9497,N,11929.5381,W,0.9,23.42211,,A*0
$PVG,5.24T,M0.8,,182K,*5
$GPGGA,235316.695,4952.9396,N,11929.5504,W,1,5,3.19,350.5,M,-16.0,M,,*6A
$GPGSA,A,3,22,18,27,24,06,,,,,,,,3.31,3.19,0.91*0C
$GPRMC,235316.695,A,4952.9396,N,11929.5504,W,0.6,24.9,211,,A*9
$GVT,84.9T,M,.6,,117K,*3
$GPGGA,235317.695,4952.9408,N,11929.5517,W,1,7,2.47,350.5,M,-16.0,M,,*61
$GNGSA,A,3,22,18,27,24,06,,,,,,,,2.63,2.47,0.91*1E
$GNGSA,A,3,71,73,,,,,,,,,,,2.63,2.47,0.91*10
$NRC,351765,,492948,,199.51,W0.13535,2113,,*69
$PTG35.5,T,M091N,.6,KA3B
$GPGGA,235319.000,4952.9423,N,11929.5522,W,1,8,2.19,350.5,M,-16.0,M,,*6E
$GNGSA,A,3,22,18,27,24,06,,,,,,,,2.36,2.19,0.89*1C
$GNGSA,A,3,87,71,73,,,,,,,,,,2.36,2.19,0.89*1D
$GGS,41,3227207,2,4,5,81,1,3,24,183,06,3*C
$GGV,,2131,2,35,272622,3,4,5,5430032,27,70
$PGV4,,1,0,1,1725211013,,10931,,2,9,6,*8
GGS,,413280333,*5
$GGV,,1097,6930,875320,5,1,2,5630883,37,67
$LGV,,,0,7,2,0127652026,2,0,9,26,8,1,88*6
GLSV3,,9,7,9,28*D
$GRM,2539000A492.42,N1129522W,.4,39972211,,A*F
$PVG,4997T,M1.4,,211K,*B
$GPGGA,235320.000,4952.9424,N,11929.5519,W,1,9,1.60,350.5,M,-16.0,M,,*67
$GNGSA,A,3,22,18,27,24,06,,,,,,,,1.83,1.60,0.89*1C
$GNGSA,A,3,87,71,73,86,,,,,,,,,1.83,1.60,0.89*1
GNMC2330.00A,95.924N1129559W,.9038.9,211,,,*2
$GVT,38.9,,M,.9,N167K,*3
$GPGGA,235321.000,4952.9418,N,11929.5510,W,1,9,1.60,350.5,M,-16.0,M,,*60
$GNGSA,A,3,22,18,27,24,06,,,,,,,,1.83,1.60,0.89*1C
$GNGSA,A,3,87,71,73,86,,,,,,,,,1.83,1.60,0.89*1
GNMC2531.00A,95.41,N1129550,,.7130.2,2113,,*D
$GVG,4072T,M,.7,N1.1K,*3
$GPGGA,235322.000,4952.9403,N,11929.5496,W,1,10,1.22,350.5,M,-16.0,M,,*58
$GNGSA,A,3,22,18,27,24,06,,,,,,,,1.48,1.22,0.84*10
$GNGSA,A,3,87,71,80,73,86,,,,,,,,1.48,1.22,0.8417
$NMC2332.00,,95.903N,199.46,,03134.2,2113,,*6
$GVT,30.2,,,,.31N0.7,,A3F
$GPGGA,235323.000,4952.9419,N,11929.5510,W,1,10,1.22,350.5,M,-16.0,M,,*5D
$GNGSA,A,3,22,18,27,24,06,,,,,,,,1.48,1.22,0.84*10
$GNGSA,A,3,87,71,80,73,86,,,,,,,,1.48,1.22,0.8*17
GNMC2333.00,,95.919N,199550,,00930.2,2113,,*1
$GVT,30.2,,M,.0,N0.6K,*3
$GPGGA,235324.000,4952.9434,N,11929.5526,W,1,10,1.22,350.4,M,-16.0,M,,*51
$GNGSA,A,3,22,18,27,24,06,,,,,,,,1.48,1.22,0.84*10
$GNGSA,A,3,87,71,80,73,86,,,,,,,,1.48,1.22,0.8*17
GPSV4,,4,2,2,7628146518,193926,,83508,3*7
GGS,42,4,1,1,6,3,1,2,35,2,2,24,9,42505,3*7
GPS,4,,4,3,3,3,,0,9,172,211,19,010,31,*6
$PGV,,4143,0,27,280,37,79
$LGV3,,0,7,6,39,8,5,20,8,1,2,5,2,8,3,17*62
GLSV3,,9,7,7,8125652026,1,019,2,3,8,1,18,4*F
$LGV,,309740,18,5D
GNMC2332.00,,95.934N,199556,,01234.7,2113,,*6
$GPT,30.2,,M,01,N0.2,,A3C
$GPGGA,235325.000,4952.9438,N,11929.5531,W,1,11,1.10,350.4,M,-16.0,M,,*5A
$GNGSA,A,3,22,18,27,24,06,,,,,,,,1.37,1.10,0.81*1C
$GNGSA,A,3,87,71,72,80,73,86,,,,,,,1.37,1.10,0811E
$NRC2332.00,,45.938,,199551,,02534.7,2113,,*6
GVTG34.2,,,,02,N0.6,,A3A
$GPGGA,235326.000,4952.9444,N,11929.5537,W,1,11,1.10,350.4,M,-16.0,M,,*54
$GNGSA,A,3,22,18,27,24,06,,,,,,,,1.37,1.10,0.81*1C
$GNGSA,A,3,87,71,72,80,73,86,,,,,,,1.37,1.10,0.1*E
$NRC,352600,A452944,,192.53,W0.1,4.7,2113,,A60
GPVG34.7,T,,0.1N,.1,KA37
$GPGGA,235327.000,4952.9444,N,11929.5535,W,1,12,0.98,350.4,M,-16.0,M,,*55
$GNGSA,A,3,22,18,27,24,06,19,,,,,,,1.27,0.98,0.81*14
$GNGSA,A,3,87,71,72,80,73,86,,,,,,,1.27,0.98,.8*1
$GRM,2537.00A492944,N192.535W,.1,40722211,,A*7
$GVG,407,T,M0.5,,02,KA*E
Edward
 
Posts: 1
Joined: Sat Nov 23, 2013 12:57 am

Re: Firewing GPS Shield on OSEPP Arduino Uno

Postby David John Barker » Sat Nov 23, 2013 9:46 am

Hi Edward

GPS modules tend to chuck out data as NMEA "sentences". Each sentence is prefixed with a sentence ID e.g. $GPGGA etc. The speed in which these sentences are output vary from module to module, but many (like the global top one) default at every one second. Sentence formats are pretty much standard for every GPS unit (although the global top can access GLONAS so an identifier like $GPGGA may look like $GNGGA). Here is a link to a site I use often, that breaks down each NMEA sentence:

http://aprs.gids.nl/nmea/

The two most useful are $GPGGA for date, position, speed, height etc and $GPRMC for time. You code should therefore just look for sentences that begin either $GPGGA or $GNGGA and $GPRMC or $GNRMC. The rest can be ignored. Notice that lat / long is output in the format 4952.9396,N,11929.5504,W. For many applications (like google earth) you need to convert to WGS84. Unless the data logger needs to process the GPS output in any way, I would save in it's raw form without performing any conversion (which can be done later).This will be quicker and reduce the possibility of errors. However, if you need to convert to WGS84 using the MCU before saving to the SD card, try and avoid FP math as it is likely to introduce conversion errors. The simplest of loggers would be just:

while true
Read sentence
if sentence begins with required ID then
save sentence to SD card
end if
end while

Hope this helps...
User avatar
David John Barker
 
Posts: 491
Joined: Thu Nov 08, 2012 12:21 pm


Return to Shields

Who is online

Users browsing this forum: No registered users and 1 guest

cron

x