I'm sure I don't need to tell you I'm a "Newb" because I'm here asking a question!

I've been trying to parse GPS data from a 3G phone module but only when called. The output from the module is formatted as GPSACP and not the generic GPRMC sentence as would be the case with dedicated free running GPS. I have no trouble getting the data from the module as required but without re-inventing the wheel and writing the parsing code myself I can't figure out how to use for example Tiny GPS to simplify the task. Is there a way to get this Library to recognise the GPSACP: sentence from the 3G module? The code below is based on the work of others so I'm confident that with a valid GPRMC sentence output it would work fine.

Any assitance would be greatly appreciated.

CheersGreg.

// In order for this sketch to work, you will need to download //TinyGPS libraries from arduiniana.org and put them // into the hardware->libraries folder in your ardiuno directory.// Here are the lines of code that point to those libraries.

#include <TinyGPS.h>

TinyGPS gps;

//void getgps(TinyGPS &gps);

void setup(){ // This is the serial rate for your terminal program. It must be this // fast because we need to print everything before a new sentence // comes in. If you slow it down, the messages might not be valid and // you will likely get checksum errors. Serial.begin(115200);

// This is the main loop of the code. All it does is check for data on // the RX pin of the ardiuno, makes sure the data is valid NMEA sentences, // then jumps to the getgps() function.void loop(){ Serial.println ("AT$GPSACP"); // Call for GPS data while(Serial.available()) // While there is data on the RX pin... { int c = Serial.read(); // load the data into a variable... if(gps.encode(c)) // if there is a new valid sentence... { getgps(gps); // then grab the data. } }

delay(10000); //delay before next loop}

// The getgps function will get and print the values we want.

void getgps(TinyGPS &gps)

{ // To get all of the data into varialbes that you can use in your code, // all you need to do is define variables and query the object for the // data. To see the complete list of functions see keywords.txt file in // the TinyGPS and NewSoftSerial libs.

// Define the variables that will be used float latitude, longitude; // Then call this function gps.f_get_position(&latitude, &longitude); // You can now print variables latitude and longitude Serial.print("Lat/Long: "); Serial.print(latitude,5); Serial.print(", "); Serial.println(longitude,5);

I have no trouble getting the data from the module as required but without re-inventing the wheel and writing the parsing code myself I can't figure out how to use for example Tiny GPS to simplify the task.

You can't. TinyGPS doesn't know about GPSACP mode.

Quote

Is there a way to get this Library to recognise the GPSACP: sentence

Yes. You can add code to TinyGPS to make it parse GPSACP sentences, IF you know what all the values mean.

I'm interested to know if the changes to Tiny GPS would need to be made in the .h file, or the .cpp file... Or both? (Never edited a library before)... Also, I would expect that simply adding the string definition to those that already exist in the Library would be the best option.

In what form do you want the data and what do you plan to do with it? As a simple parsing start, load the below code into the arduino, copy the sample string you posted, paste the string in the serial monitor (ctrl-v), then send it to the arduino.

Sorry for the delay in getting back to this... after studying all your input I've been trying different solutions and have come up with one that seems quite elegant at first glance... Trouble is once incorporated into my complete code it doesn't work. Everything appears fine but in the "real world" situation the variables areeither not being populated, or the results are not being printed to the serial bus. For bothe the simulator and serial monitor run I manually enter the GPS response ($GPSACP: 234423.31,2728.3913S,15302.3418E,1.00,38.81,3,0,00,0.01,0.02,180313,07) into the serial monitor input and the correctly formatted output appears on the output.

The Parsing/printing code which works both on an arduino using the serial monitor, and in the simulator is here.

The delays are simply for stability. The GPS/3G module responses are fairly quick but I want reliability over absolute speed.

It seems to me that from my testing with the first block of code I've included that perhaps the issue is with the response from the GPS not actually being available on the serial bus??? Other comands that come in via text message are recognised, and in fact the entire sequence is called in this manner. I can also confirm that watching the serial data output from both the arduino and the GPS/3G module the correct calls and responses are present.

This was discussed at the beginning of the topic. TinyGPS doesn't recognise or handle GPSACP strings natively and I figured it was just as easy (and far more educational) to attack the problem head on.