Maker Pro
Maker Pro

Help with Arduino Serial communication.

Dear friends.

I am working on a project where an arduino uno and a GPS receiver are involved.

The gps unit transmitts serial data NMEA.

The data string on Hyperterminal looks like this :

$GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47
$GPGSA,A,3,04,05,,09,12,,,24,,,,,2.5,1.3,2.1*39
$GPGSV,2,1,08,01,40,083,46,02,17,308,41,12,07,344,39,14,22,228,45*75

Here is a link that explains in detail what the above strings are about:
https://www.gpsinformation.org/dale/nmea.htm

what i want the arduino to do is read the below string (sentence) and ignore the rest.
$GPGSA,A,3,04,05,,09,12,,,24,,,,,2.5,1.3,2.1*39
With picaxe, i was able to do this by using these bits ( GSA ) as a qualifier and store all rest bits for later calculations ,A,3,04,05,,09,12,,,24,,,,,2.5,1.3,2.1*39

Also i need the serial to "timeout" if this ( GSA ) string is not transmitted for a period longer than 1 second.

The reason for the above is that first i only need the GSA sentence while i dont want my Microcontroller to "hang" waiting to receive this sentence (or any other) if the GPS unit is not connected.

I am open to ideas :) Thank you.
 
I forgot to mention that so far i have managed to receive all serial strings transmitted by the gps unit and echo them back to the PC using this example code:
https://www.arduino.cc/en/Tutorial/SoftwareSerialExample

#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11); // RX, TX

void setup()
{
Serial.begin(57600);
while (!Serial) { ; }
Serial.println("Goodnight moon!");
mySerial.begin(4800);
mySerial.println("Hello, world?");
}

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