Hey,
I recently took delivery of an Ultimate GPS logger shield and followed this tutorial to log data to the sd card
https://learn.adafruit.com/adafruit-ult ... sd-logging
In the code you have this line
GPS.sendCommand(PMTK_SET_NMEA_UPDATE_5HZ); // 100 millihertz (once every 10 seconds), 1Hz or 5Hz update rate
I see in the spec sheet that the GPS module is capable of 10hz updates but I was wondering how I enable that?
Thanks
10hz Update rate with ultimate GPS logger shield
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- martycochrane
- Posts: 2
- Joined: Fri Aug 22, 2014 3:27 pm
- Franklin97355
- Posts: 23912
- Joined: Mon Apr 21, 2008 2:33 pm
Re: 10hz Update rate with ultimate GPS logger shield
Code: Select all
GPS.sendCommand(PMTK_SET_NMEA_UPDATE_10HZ);
- martycochrane
- Posts: 2
- Joined: Fri Aug 22, 2014 3:27 pm
Re: 10hz Update rate with ultimate GPS logger shield
Thanks. I guess I should have added that I tried that but I didn't seem to get any faster an output.
I'll look into it a bit more maybe its the speed its printing to the serial thats slowing it down now
I'll look into it a bit more maybe its the speed its printing to the serial thats slowing it down now
- madawson
- Posts: 6
- Joined: Tue Feb 22, 2011 1:11 am
Re: 10hz Update rate with ultimate GPS logger shield
Hey I am having a similar problem. I change the update Hz from 1 to 5 to 10 and the output speed remain around 1 Hz. I have no other delays written in my code(arduino)
Did you get yours to increase serial output speed? if so, how please.
Thank you Michael
Did you get yours to increase serial output speed? if so, how please.
Thank you Michael
- adafruit_support_mike
- Posts: 67454
- Joined: Thu Feb 11, 2010 2:51 pm
Re: 10hz Update rate with ultimate GPS logger shield
What command are you using to set the update rate?
- madawson
- Posts: 6
- Joined: Tue Feb 22, 2011 1:11 am
Re: 10hz Update rate with ultimate GPS logger shield
#include <Adafruit_GPS.h> //Load the GPS Library
#include <SoftwareSerial.h> //Load the Software Serial Library. This library in effect gives the arduino additional serial ports
#define PMTK_SET_NMEA_UPDATE_5HZ "$PMTK220,200*2C"
#define PMTK_API_SET_FIX_CTL_5HZ "$PMTK300,200,0,0,0,0*2F"
...
GPS.sendCommand("$PGCMD,33,0*6D"); // Turn Off GPS Antenna Update
// GPS.sendCommand(PMTK_SET_NMEA_OUTPUT_RMCGGA);
GPS.sendCommand(PMTK_SET_NMEA_OUTPUT_RMCONLY); //I read this is the fastest setting
GPS.sendCommand(PMTK_SET_NMEA_UPDATE_5HZ);
Here's I believe relevant parts of my code. I found the #define statements on this pdf http://learn.adafruit.com/downloads/pdf ... te-gps.pdf
#include <SoftwareSerial.h> //Load the Software Serial Library. This library in effect gives the arduino additional serial ports
#define PMTK_SET_NMEA_UPDATE_5HZ "$PMTK220,200*2C"
#define PMTK_API_SET_FIX_CTL_5HZ "$PMTK300,200,0,0,0,0*2F"
...
GPS.sendCommand("$PGCMD,33,0*6D"); // Turn Off GPS Antenna Update
// GPS.sendCommand(PMTK_SET_NMEA_OUTPUT_RMCGGA);
GPS.sendCommand(PMTK_SET_NMEA_OUTPUT_RMCONLY); //I read this is the fastest setting
GPS.sendCommand(PMTK_SET_NMEA_UPDATE_5HZ);
Here's I believe relevant parts of my code. I found the #define statements on this pdf http://learn.adafruit.com/downloads/pdf ... te-gps.pdf
- adafruit_support_mike
- Posts: 67454
- Joined: Thu Feb 11, 2010 2:51 pm
Re: 10hz Update rate with ultimate GPS logger shield
Your $PMTK command looks okay, but let's check a technical detail:
Hook the GPS module up for the Direct Connect method: GPS TX to Arduino TX, same for RX, load a blank sketch and open the Serial Monitor. Set the line ending to "Both NL & CR" and the baudrate to 9600. Enter the $PMTK command as above and see what response you get from the GPS module.
Hook the GPS module up for the Direct Connect method: GPS TX to Arduino TX, same for RX, load a blank sketch and open the Serial Monitor. Set the line ending to "Both NL & CR" and the baudrate to 9600. Enter the $PMTK command as above and see what response you get from the GPS module.
- madawson
- Posts: 6
- Joined: Tue Feb 22, 2011 1:11 am
Re: 10hz Update rate with ultimate GPS logger shield
OK I have done as directed. After restarting the GPS it shows a lot of data and entering the recommended sentences seems to have no effect!
I enter $PMTK220,1000*1F<CR><LF> and it shows $PMTK001,220,3*30 //1Hz setting
I enter $PMTK220,200*2C and it shows $PMTK001,220,2*31 //5Hz setting
but no visible change occurs in the receiving data...
I accidentally got it to work once (it was only showing one type of line and I could change the speed by entering the command line) but then I restarted it and cannot seem to redo it.
I enter $PMTK220,1000*1F<CR><LF> and it shows $PMTK001,220,3*30 //1Hz setting
I enter $PMTK220,200*2C and it shows $PMTK001,220,2*31 //5Hz setting
but no visible change occurs in the receiving data...
I accidentally got it to work once (it was only showing one type of line and I could change the speed by entering the command line) but then I restarted it and cannot seem to redo it.
- adafruit_support_mike
- Posts: 67454
- Joined: Thu Feb 11, 2010 2:51 pm
Re: 10hz Update rate with ultimate GPS logger shield
That's what I thought..
The last '2' in the '$PMTK001,220,2*31' response is a failure code. It means the GPS module doesn't think it can emit all the characters in the NMEA sentences at 9600 baud within 200ms.
Kick the baudrate up to about 38400 and try again.
The last '2' in the '$PMTK001,220,2*31' response is a failure code. It means the GPS module doesn't think it can emit all the characters in the NMEA sentences at 9600 baud within 200ms.
Kick the baudrate up to about 38400 and try again.
- madawson
- Posts: 6
- Joined: Tue Feb 22, 2011 1:11 am
Re: 10hz Update rate with ultimate GPS logger shield
Ok, the " $PMTK251,38400*27<CR><LF> " successfully (with repeat ability) changes the baud from 9600 to 38400
Entering the 10Hz command " $PMTK220,100*2F<CR><LF> " works successfully (with repeat ability) the command window at 38400 baud
returns " $PMTK001,220,3*30 ". Which is the same response I get when changing it back to 1Hz (successfully) so I believe that is an acceptance response.
Entering the 5Hz command " $PMTK220, 200*2C<CR><LF> " has no response. 10 Hz is great, now I just need to make a sketch do it... which could be a little tricky in setup.
Are you satisfied with with the test response?
Entering the 10Hz command " $PMTK220,100*2F<CR><LF> " works successfully (with repeat ability) the command window at 38400 baud
returns " $PMTK001,220,3*30 ". Which is the same response I get when changing it back to 1Hz (successfully) so I believe that is an acceptance response.
Entering the 5Hz command " $PMTK220, 200*2C<CR><LF> " has no response. 10 Hz is great, now I just need to make a sketch do it... which could be a little tricky in setup.
Are you satisfied with with the test response?
- adafruit_support_mike
- Posts: 67454
- Joined: Thu Feb 11, 2010 2:51 pm
Re: 10hz Update rate with ultimate GPS logger shield
Looks like you have a space in the last one between the comma and the 200.
That will throw the checksum off, and the module doesn't process any command whose checksum is wrong.
That will throw the checksum off, and the module doesn't process any command whose checksum is wrong.
- madawson
- Posts: 6
- Joined: Tue Feb 22, 2011 1:11 am
Re: 10hz Update rate with ultimate GPS logger shield
You are correct! nice. I wrote this hoping to Make GPS a software serial, change it from 9800 to 38400, then change from 1Hz to 10Hz.
//************************************//
#include <Adafruit_GPS.h>
#include <SoftwareSerial.h>
SoftwareSerial mySerial(11, 10);
Adafruit_GPS GPS(&mySerial);
String NMEA1; //We will use this variable to hold our first NMEA sentence
String NMEA2; //We will use this variable to hold our second NMEA sentence
char c; //Used to read the characters spewing from the GPS module
void setup(){
Serial.begin(38400);
GPS.begin(9600);
GPS.sendCommand(PMTK_SET_NMEA_OUTPUT_RMCONLY);
GPS.sendCommand("$PMTK251,38400*27<CR><LF>"); // Change GPS baud to 38400
GPS.begin(38400);
delay(250); //Pause
GPS.sendCommand("$PMTK220,100*2F<CR><LF>"); // 10 Hz update rate
Serial.println("Finished Setup");
delay(500); //Pause
}
//**************************//
the result from this: output is around 3 Hz
I run a blank sketch and see what the pure GPS output is and it is 10Hz. So that indicates a slow loop or my setup might be incorrect. Can you comment on that?
//************************************//
#include <Adafruit_GPS.h>
#include <SoftwareSerial.h>
SoftwareSerial mySerial(11, 10);
Adafruit_GPS GPS(&mySerial);
String NMEA1; //We will use this variable to hold our first NMEA sentence
String NMEA2; //We will use this variable to hold our second NMEA sentence
char c; //Used to read the characters spewing from the GPS module
void setup(){
Serial.begin(38400);
GPS.begin(9600);
GPS.sendCommand(PMTK_SET_NMEA_OUTPUT_RMCONLY);
GPS.sendCommand("$PMTK251,38400*27<CR><LF>"); // Change GPS baud to 38400
GPS.begin(38400);
delay(250); //Pause
GPS.sendCommand("$PMTK220,100*2F<CR><LF>"); // 10 Hz update rate
Serial.println("Finished Setup");
delay(500); //Pause
}
//**************************//
the result from this: output is around 3 Hz
I run a blank sketch and see what the pure GPS output is and it is 10Hz. So that indicates a slow loop or my setup might be incorrect. Can you comment on that?
- adafruit_support_mike
- Posts: 67454
- Joined: Thu Feb 11, 2010 2:51 pm
Re: 10hz Update rate with ultimate GPS logger shield
I'd guess you're printing the NMEA sentences with Serial.print(), yes?
What baudrate are you using for that?
What baudrate are you using for that?
- madawson
- Posts: 6
- Joined: Tue Feb 22, 2011 1:11 am
Re: 10hz Update rate with ultimate GPS logger shield
Im trying to make a very simple sketch work that only Serial.prints latitude and longitude. Ive tried both 9600 and 38400. There isnt arduino example code out there for 10hz is there?
Ive tried Serial.begin(9600
GPS.begin(9600
GPS.sendCommand(change baud 38400
GPS.begin(38400
GPS.sendCommand( 10hz
Serial.begin(38400
....Failure it returns 1 every 20second ish
Ive tried Serial.begin(9600
GPS.begin(9600
GPS.sendCommand(change baud 38400
GPS.begin(38400
GPS.sendCommand( 10hz
Serial.begin(38400
....Failure it returns 1 every 20second ish
- adafruit_support_mike
- Posts: 67454
- Joined: Thu Feb 11, 2010 2:51 pm
Re: 10hz Update rate with ultimate GPS logger shield
The Serial connection exists between the Arduino and your computer, so it doesn't have any effect on the GPS module except to compete for CPU time.
Try kicking that up to 115200 so is spits information out as fast as possible, leaving more free time for the code that reads data from the GPS module.
Try kicking that up to 115200 so is spits information out as fast as possible, leaving more free time for the code that reads data from the GPS module.
Please be positive and constructive with your questions and comments.