GPS AdaFruit Ultimate + Micro SD + Teensy 3.1

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
fersical
 
Posts: 19
Joined: Sun Jul 19, 2015 6:08 pm

GPS AdaFruit Ultimate + Teensy 3.1

Post by fersical »

Hello everyone!
Question to start this topic .. Someone performed a code to calculate the distance traveled by each sample valid???

I have this code:

Code: Select all


char character;

void setup() 

{
delay(750);  
Serial.begin(9600);
Serial1.begin(9600);
delay(100);
Serial1.write("$PMTK251,57600*2C\r\n");
delay(100);
Serial1.end();
Serial1.begin(57600);
delay(100);
Serial1.write("$PMTK314,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29\r\n");
delay(100);
Serial1.write("$PMTK300,100*2C\r\n");
        
}


void loop() 

{
   
  while (Serial1.available()>0)
  { 
   
    character = Serial1.read();
    Serial.print(character);

}
}


User avatar
fersical
 
Posts: 19
Joined: Sun Jul 19, 2015 6:08 pm

GPS AdaFruit Ultimate + Micro SD + Teensy 3.1

Post by fersical »

Hello!!
I tell them that I'm working with a project that will measure the travel distance of an athlete using a GPS Adafruit ( 10Hz ) and a Micro SD .

The code is:

Code: Select all


#include <SPI.h>
#include <SdFat.h>
#include <Wire.h>

#define SD_CS_PIN SS

SdFat SD;

char character;
String dataString;
File dataFile;

void setup() 

{

delay(750);  
Serial.begin(9600);
Serial1.begin(9600);
delay(100);
Serial1.write("$PMTK251,57600*2C\r\n");
delay(100);
Serial1.end();
Serial1.begin(57600);
delay(100);
Serial1.write("$PMTK314,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29\r\n");  // Only GPRMC
delay(100);
Serial1.write("$PMTK300,100*2C\r\n");  // 10HZ Rate


delay(100);
pinMode(10, OUTPUT);
pinMode(led, OUTPUT);

// see if the card is present and can be initialized:
 if (!SD.begin(SD_CS_PIN,SPI_HALF_SPEED)) 
   {
   Serial.println("Card failed, or not present");
   return;
     }
   Serial.println("Card initialized.");
   Serial.println("Starting...");
   Serial.println("");

   delay(100);
   dataString="";

   dataFile = SD.open("tGPS.csv",FILE_WRITE);

      
}



void loop() 

{
   while (Serial1.available()>0)
  { 
   
    character = Serial1.read(); 
    Serial.print(character);
     
    if(character==13)
      {  
        dataFile = SD.open("tGPS.csv",FILE_WRITE);
       
          if (dataFile)
            {
              dataFile.print(dataString);
              dataString="";
              dataFile.close();
                      
              }  
         else {Serial.print("Error");} 
                     
                      
             }
            
  else{
    dataString+=String(character);
     }
    
   
   }

}


With this code I could generate a excel with a list of values ​​GPRMC .
For example:

$GPRMC,204000.000,A,3437.3184,S,05823.2009,W,2.72,33.36,180715,,,A*55
$GPRMC,204000.100,A,3437.3183,S,05823.2008,W,2.71,33.72,180715,,,A*51
$GPRMC,204000.200,A,3437.3182,S,05823.2008,W,2.70,33.91,180715,,,A*5F
$GPRMC,204000.300,A,3437.3181,S,05823.2007,W,2.68,33.66,180715,,,A*53
$GPRMC,204000.400,A,3437.3180,S,05823.2007,W,2.66,33.35,180715,,,A*5D
$GPRMC,204000.500,A,3437.3178,S,05823.2007,W,2.63,32.86,180715,,,A*57
$GPRMC,204000.600,A,3437.3177,S,05823.2007,W,2.59,31.89,180715,,,A*5E
$GPRMC,204000.700,A,3437.3176,S,05823.2008,W,2.55,30.68,180715,,,A*53
$GPRMC,204000.800,A,3437.3175,S,05823.2008,W,2.51,29.65,180715,,,A*5E



Now!!

I went testing with the GPS on my cell phone and GPS Adafruit . Active GPS at the same time :
I made a comparison between Adafruit GPS Ultimate and Smartphone (Motog)
The result wasn't good
BANNED
BANNED
comparacion.jpg (93.62 KiB) Viewed 769 times
My question is :

There's something I'm doing wrong ?

It is normal?

Another way to improve the measurement ?

Is there a better way to begin to calculate the distance ?

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: GPS AdaFruit Ultimate + Micro SD + Teensy 3.1

Post by adafruit_support_mike »

Are you sure you're reading the values correctly?

The GPS module's output is formatted as degrees and decimal-minutes, not degrees-minutes-seconds. The fact that the curve on the right turns the wrong direction looks like an error in interpretation.

User avatar
fersical
 
Posts: 19
Joined: Sun Jul 19, 2015 6:08 pm

Re: GPS AdaFruit Ultimate + Micro SD + Teensy 3.1

Post by fersical »

I'm using this tool (I think that is performing the conversion correctly)

http://www.sramp.com/tools/nmeatranslator.html

comparacion1.jpg
comparacion1.jpg (122.59 KiB) Viewed 716 times

Other Idea??? :(

User avatar
fersical
 
Posts: 19
Joined: Sun Jul 19, 2015 6:08 pm

Re: GPS AdaFruit Ultimate + Teensy 3.1

Post by fersical »

Somebody has that code??

Thanks!!

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: GPS AdaFruit Ultimate + Micro SD + Teensy 3.1

Post by adafruit_support_mike »

The tool you linked doesn't mention how it handles coordinates, but for now let's assume it's translating them correctly.

Try collecting a set of readings using the $GPGGA sentence instead of $GPRMC.

The $GPGGA sentence has more information about how the position value was calculated. For the path above, it's possible that the module lost its fix and was estimating position rather than getting actual GPS data.

User avatar
fersical
 
Posts: 19
Joined: Sun Jul 19, 2015 6:08 pm

Re: GPS AdaFruit Ultimate + Micro SD + Teensy 3.1

Post by fersical »

Well, there GPGGA realize a test . I see that the measurement is improved.
GPS.JPG
GPS.JPG (46.3 KiB) Viewed 657 times
I observed a small shift between the two graphs.
I can not tell if the link http://www.gpsvisualizer.com/map_input?form=google correctly converts GPS data .

Any Comments?
You have some converter GPGGA a map ?

I attached the log if you are interested .
Attachments
tGPS.csv
(7.01 KiB) Downloaded 43 times

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: GPS AdaFruit Ultimate + Micro SD + Teensy 3.1

Post by adafruit_support_mike »

Hmm.. the $GPGGA sentences show that the module is basing its readings on satellite data, but the fix is minimal (only 3 satellites for most of the sequence) and dilution of precision is flat-out awful for the first few readings:

Code: Select all

                                               SAT   DOP
-----------------------------------------------------------------------------
$GPGGA,201614.000,3434.4854,S,05826.1447,W,1,  03,  30.68,  135.3,M,14.6,M,,*58
$GPGGA,201616.000,3434.4840,S,05826.1436,W,1,  03,  30.65,  135.3,M,14.6,M,,*54
$GPGGA,201617.000,3434.4833,S,05826.1430,W,1,  03,   2.55,  135.3,M,14.6,M,,*65
$GPGGA,201618.000,3434.4825,S,05826.1427,W,1,  03,   2.54,  135.3,M,14.6,M,,*6A
$GPGGA,201619.000,3434.4815,S,05826.1417,W,1,  03,  30.62,  135.3,M,14.6,M,,*5F
Are you beginning the sequence of readings from a cold-start of the GPS module? Also, do you have a coin cell installed to keep the unit's memory fresh while it's powered down?

User avatar
fersical
 
Posts: 19
Joined: Sun Jul 19, 2015 6:08 pm

Re: GPS AdaFruit Ultimate + Micro SD + Teensy 3.1

Post by fersical »

Cold -start ? mmmmm once I program the microcontroller I go out to do the testing.
The first measurements are blank :

GPGGA ,,, ,,,,,, 0.00 M , 0.0 , M ,, 0000 * 48 $

After a few minutes it starts recording valid data.
I do not know if I answered your question .

I don´t have a coin cell installed.That's wrong?
If needed , you got a few lines of code ?

Thank You!! Gradually I came to the solution.

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: GPS AdaFruit Ultimate + Micro SD + Teensy 3.1

Post by adafruit_support_mike »

fersical wrote:After a few minutes it starts recording valid data.
Yep, that's a cold start.

GPS modules work by predicting where the satellites will be in another second, then comparing their prediction to the next reading that comes in. Then they improve their next prediction based on the error from the previous one. The longer they can do that, the better their predictions get.

Every time you disconnect the power, the GPS module loses that history of improved predictions and has to start over from scratch.
fersical wrote:I don´t have a coin cell installed.That's wrong?
It isn't wrong, but having a coin cell keeps the GPS module's memory active and clock running. The radio doesn't receive any new signals from the satellites, but the history of predictions remains useful for a day or so. When you connect power and the radio starts getting updates from the satellites, the module can improve its predictions more quickly.

Your cell phone probably collects updates every 10 seconds while it isn't actively using the GPS, and that keeps its prediction history up to date with good information. Then it uses additional information, like triangulation from nearby cell towers whose positions are mapped in a database, to improve the estimate.

Go ahead and add a coin cell.. they don't cost much and last for a couple of years. Give the module 30 minutes to an hour to build a good prediction history, then give it a few minutes to get up to date when you power it up.

User avatar
fersical
 
Posts: 19
Joined: Sun Jul 19, 2015 6:08 pm

Re: GPS AdaFruit Ultimate + Micro SD + Teensy 3.1

Post by fersical »

Now place the coin cell .. The LED should blink ??
how does it work ??
I haven't to cut the trace ( I use the v3)

User avatar
fersical
 
Posts: 19
Joined: Sun Jul 19, 2015 6:08 pm

Re: GPS AdaFruit Ultimate + Micro SD + Teensy 3.1

Post by fersical »

Okay.....
Insert the coin cell and leave one hours taking satellites. After that I went outside to make a new route .

The result is as follows:
GPS.jpg
GPS.jpg (42.55 KiB) Viewed 581 times

Even I do not see good measurements .
I leave the .csv with the samples.
Another idea?
Thanks!!
Attachments
tGPS.csv
(132.81 KiB) Downloaded 36 times

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: GPS AdaFruit Ultimate + Micro SD + Teensy 3.1

Post by adafruit_support_mike »

That output looks like it's within the 15m base accuracy of the GPS system, but still shows some big errors.

The CSV file shows you're only reading 4-6 satellites, which will have some effect on the quality of the reading, and the DOP still goes up above 2m.

Try turning on the DGPS feature. Connect with the Arduino IDE's Serial monitor, set the terminal to emit both NL and CR line endings, and enter the following commands, one at a time:

Code: Select all

$PMTK313,1*2E
$PMTK301,2*2E
The first command tells the module to look for extra satellites that help refine the position reading, and the second tells the module to use the WAAS system.

You should see the output change like so:

Code: Select all

$GPGGA,164542.900,3437.3147,S,05823.2348,W,1,06,1.52,20.2,M,14.6,M,,*5A
$GPGGA,164542.900,3437.3147,S,05823.2348,W,2,06,1.52,20.2,M,14.6,M,0000,0000*59
The '2' before the DOP value tells you the module has a DGPS fix, and the two groups of zeros before the checksum tell you how long it's been since the module got information from the DGPS system.

User avatar
fersical
 
Posts: 19
Joined: Sun Jul 19, 2015 6:08 pm

Re: GPS AdaFruit Ultimate + Micro SD + Teensy 3.1

Post by fersical »

Ok , now I could use the DGPS mode , but the 2 groups Zeros don't change me!

Code: Select all


$GPGGA,225215.200,3437.3199,S,05823.1759,W,2,05,1.64,-2.2,M,14.6,M,0000,0000*4E
$GPGGA,225215.300,3437.3199,S,05823.1759,W,2,05,1.64,-2.2,M,14.6,M,0000,0000*4F
$GPGGA,225215.400,3437.3199,S,05823.1759,W,2,05,1.64,-2.2,M,14.6,M,0000,0000*48
$GPGGA,225215.500,3437.3199,S,05823.1760,W,2,05,1.64,-2.2,M,14.6,M,0000,0000*43
$GPGGA,225215.600,3437.3199,S,05823.1760,W,2,05,1.64,-2.2,M,14.6,M,0000,0000*40
$GPGGA,225215.700,3437.3199,S,05823.1760,W,2,05,1.64,-2.2,M,14.6,M,0000,0000*41
$GPGGA,225215.800,3437.3199,S,05823.1760,W,2,05,1.64,-2.2,M,14.6,M,0000,0000*4E
$GPGGA,225215.900,3437.3199,S,05823.1761,W,2,05,1.64,-2.2,M,14.6,M,0000,0000*4E
$GPGGA,225216.000,3437.3199,S,05823.1761,W,2,05,1.64,-2.2,M,14.6,M,0000,0000*44
$GPGGA,225216.100,3437.3199,S,05823.1761,W,2,05,1.64,-2.2,M,14.6,M,0000,0000*45
$GPGGA,225216.200,3437.3199,S,05823.1761,W,2,05,1.64,-2.2,M,14.6,M,0000,0000*46


They are always 0000,0000 ??
Thanks

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: GPS AdaFruit Ultimate + Micro SD + Teensy 3.1

Post by adafruit_support_mike »

It may mean your module can't find a DGPS source, or it may mean the module doesn't care about the DGPS source's ID and is making a query every time it emits a NMEA sentence.

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

Return to “Other Arduino products from Adafruit”