Capture GPS data and store it

hi i am trying to capture GPS data as a bit stream store it in the flash memory then send it via TX every 5 seconds or so

i have the code that captures the GPS data i just dont know how to store it and spit it out at those time intervals.

thanks

here is the capture code

#include <string.h>
#include <ctype.h>
int ledPin = 13; // LED test pin ( we really dont have to do this )
int inputPin = 0; // RX PIN input
int outputPin = 1; // TX TX trans output
int byteGPS=-1;
char linea[300] = “”;
prog_char string_1 PROGMEM = “String 1”;
char comandoGPR[7] = “$GPRMC”;
int cont=0;
int good=0;
int conta=0;
int indices[13];
void setup() {
pinMode(ledPin, OUTPUT); // Initialize LED pin
pinMode(inputPin, INPUT);
pinMode(outputPin, OUTPUT);
Serial.begin(38400);
for (int i=0;i<300;i++){ // this is a buffer to start receiving the data
linea*=’ ';*

  • } *
    }
    void loop() {
  • digitalWrite(ledPin, HIGH);*
  • byteGPS=Serial.read(); // Read a byte of the serial port*
  • if (byteGPS == -1) { // See if the port is empty yet*
  • delay(100);*
  • } else {*
  • linea[conta]=byteGPS; // If there is serial port data,start buffer*
  • conta++; *
  • Serial.print(byteGPS, BYTE);*
  • if (byteGPS==13){ // If the received byte is = to 13, end of transmission*
  • digitalWrite(ledPin, LOW);*
  • cont=0;*
  • good=0;*
  • for (int i=1;i<7;i++){ // Verifies if the received command starts with $GPR*
    _ if (linea*==comandoGPR[i-1]){_
    _
    good++;_
    _
    }_
    _
    }_
    _
    if(good==6){ // If yes, continue and process the data*_
    * for (int i=0;i<300;i++){*
    _ if (linea*==’,’){ // check for the position of the “,” separator*
    * indices[cont]=i;
    cont++;
    }
    if (linea==’’){ // … and the “"
    indices[12]=i;
    cont++;
    }
    }
    Serial.println(”"); // write to the serial port*

    * Serial.println("");
    Serial.println("---------------");
    for (int i=0;i<12;i++){
    switch(i){
    case 0 :Serial.print("Time in UTC (HhMmSs): ");break;
    case 1 :Serial.print("Status (A=OK,V=KO): ");break;
    case 2 :Serial.print("Latitude: ");break;
    case 3 :Serial.print("Direction (N/S): ");break;
    case 4 :Serial.print("Longitude: ");break;
    case 5 :Serial.print("Direction (E/W): ");break;
    case 6 :Serial.print("Velocity in knots: ");break;
    case 7 :Serial.print("Heading in degrees: ");break;
    case 8 :Serial.print("Date UTC (DdMmAa): ");break;
    case 9 :Serial.print("Magnetic degrees: “);break;
    case 10 :Serial.print(”(E/W): ");break;
    case 11 :Serial.print(“Mode: “);break;
    case 12 :Serial.print(“Checksum: “);break;
    }
    for (int j=indices;j<(indices[i+1]-1);j++){
    Serial.print(linea[j+1]);
    }
    Serial.println(””);
    }
    Serial.println(”---------------”);
    }
    conta=0; // start the buffer*

    * for (int i=0;i<300;i++){ //
    linea=’ ';
    }
    }
    }
    }*_

You can’t (easily) store to flash memory. Did you mean EEPROM?

Yes please !! store it anywhere possible !

ThAnks

How much data do you need to store, and for how long? EEPROM has a limited number of erase/write cycles, so may not be suitable here. You may need to look at some external storage medium, like an SD card.

Ok let's say that I don't need to capture it and store. Let's say I know the string and it's something luke this:" $GPGGA,154654,4428.2011,N,00440.5161,W,0,00,,-00044.7,M,051.6,M,,*6B" I wanna be able to spit that string out of the tx pin in the same format it was captured. Meaning if I would hook it up to a device that receives gps data it would think that it is getting it from a gps module.

Thanks

You are already collecting the data in an array, linea. That array is sized to hold 300 characters. All that you need to do is to NULL terminate the array when byteGPS is 13.

if (byteGPS==13){            // If the received byte is = to 13, end of transmission
   linea[conta] = '\0';

I wanna be able to spit that string out of the tx pin in the same format it was captured.

So, Serial.print(linea); will do that.

If you are connecting the GPS module to the Arduino, and connecting something else to it that needs GPS data, what is the Arduino doing? Why not simply connect the GPS module to whatever needs the data?

Because the device is located at a place where it can't get gps reception and it needs it's gps coordinates inorder for it to be activated. It needs to be receiving the data the same way it does from the gps module. I need to do that for many locations and feed it to these multiple devices so it's cheaper to use arduinos. I have a question

When I have serial print ! Does the serial monitor window have to be open for it to continue transmitting through the tx ? Thanks

Does the serial monitor window have to be open for it to continue transmitting through the tx ?

No, it doesn't.

Because the device is located at a place where it can't get gps reception and it needs it's gps coordinates inorder for it to be activated.

I think I would just use wire to connect the two gizmos together. If you need to boost the rs232 signal, there are probably much better/cheaper ways to do that.