shield_sdlog, ultimate GPS logger Shield, UNO,

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
tom_w
 
Posts: 32
Joined: Mon Mar 03, 2014 11:32 am

shield_sdlog, ultimate GPS logger Shield, UNO,

Post by tom_w »

I am using the Ultimate GPS Logger Shield and an UNO to record GPS data while I spin an object with a stepper motor. This will involve spinning four objects, and I would like four separate text files on the SD card when I am finished.

I understand that shield_sdlog saves the NMEA sentences to an incremented text file each time the sketch is run. I would like to integrate the code in shield_sdlog into my code to spin the motor such that I begin recording NMEA sentences, I complete a full rotation, and I close and stop saving to the SD card. Then when I am ready to run the rotation again, it will save to a new file.

It is and preferable that the GPS continue to maintain a fix, but I would like to refrain from saving to the SD card in the down time between rotations. Also, a primary goal is for the initial time stamp of each new file indicate when each rotation begins.

So to summarize, I will push a button that will begin to save NMEA sentences in a text file on an SD card, followed by a rotation of the stepper motor. Upon completion of a full rotation, the data recording will stop, the file will be saved and the system will wait until the button is pressed again when it will repeat the process.

Below is the code for rotating the object using the stepper motor:

Code: Select all

 
else if( analogRead(A3)<500 && analogRead(A2)<500 && analogRead(A1)>500 )  //*** DATA ROTATION GATHERING ***//
  {
    lcd.clear();
    lcd.setCursor(3,0);
    lcd.print("COLLECTING");
    lcd.setCursor(4,1);
    lcd.print("GPS DATA");
    delay(100);
    
    while(c < TRUE){
    rotate_phone();
    c++;
  }

void rotate_phone()
{
  int b = 0;
  int c = 0;
  while (b < 16)
  {
          for (int i = 0; i <133; i++)
            {
            digitalWrite(Enable, LOW);      //Turns Enable low and allows the driver to operate.  
            digitalWrite(stepper, HIGH);   // turn the LED on (HIGH is the voltage level)
            delay(3);               //Wait for 5ms
            digitalWrite(stepper, LOW);    // turn the LED off by making the voltage LOW
            delay(3); 
            }   
            digitalWrite(Enable, HIGH); //Turns Enable HIGH which turns off the driver. We do this to conserve power and to keep motor temperature down.
            delay (29202);
            
          for (int i = 0; i <134; i++)
            {
            digitalWrite(Enable, LOW);      //Turns Enable low and allows the driver to operate.  
            digitalWrite(stepper, HIGH);   // turn the LED on (HIGH is the voltage level)
            delay(3);               //Wait for 5ms
            digitalWrite(stepper, LOW);    // turn the LED off by making the voltage LOW
            delay(3);
            }   
            digitalWrite(Enable, HIGH); //Turns Enable HIGH which turns off the driver. We do this to conserve power and to keep motor temperature down.
            delay (29196); 
            
          for (int i = 0; i <133; i++)
            {
            digitalWrite(Enable, LOW);      //Turns Enable low and allows the driver to operate.  
            digitalWrite(stepper, HIGH);   // turn the LED on (HIGH is the voltage level)
            delay(3);               //Wait for 5ms
            digitalWrite(stepper, LOW);    // turn the LED off by making the voltage LOW
            delay(3); 
            }  
            digitalWrite(Enable, HIGH); //Turns Enable HIGH which turns off the driver. We do this to conserve power and to keep motor temperature down.
            delay (29202); 
            b++;

    }
 

}


User avatar
engineercarl
 
Posts: 56
Joined: Fri Nov 22, 2013 6:47 pm

Re: shield_sdlog, ultimate GPS logger Shield, UNO,

Post by engineercarl »

You may want to follow my thread on using the GPS Logger.http://forums.adafruit.com/viewtopic.php?f=31&t=50509 I ran into a SRAM crash when I tied to make the "shield_sdlog" example store a more user friendly file format. Basically, the GPS and SD libraries are rather SRAM hungry, so you need to be careful.

User avatar
tom_w
 
Posts: 32
Joined: Mon Mar 03, 2014 11:32 am

Re: shield_sdlog, ultimate GPS logger Shield, UNO,

Post by tom_w »

Adafruit_GPS.cpp only has functionality for RMC and GGA sentences. It will not write to the SD any other types of sentences without modification. Furthermore, it only parses RMC or GGA sentences without further modification.

In Adafruit_GPS.cpp, after the checksum test, the code "looks for NMEA sentences." It is originally configured to only look for RMC and GGA. I simply added the following code to this series of if statements in order to log GSV sentences to the SD card. I did not add any parsing code, because I parse the NMEA sentences in my data reduction program.

Code: Select all

if (strstr(nmea, "$GPGSV")) {
    // found GSV
    char *p = nmea;
        return true;
  }
Thanks, EngineerCarl and adafruit_support_bill for your help. Since this issue did not seem to be affected by SRAM issues, I apologize for dominating the thread with a separate issue.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Shields from Adafruit”