GPS Time Centisecond Problem

Hi all members,

I’m using “GY-NEO6MV2” with “TinyGPS++” library.

Everything is working fine but centisecond info not work.

// cseconds = gps.time.centisecond();

Centisecond information does not come with this code.

Why?

Please check it picture on the “Attachments”.

Thanks…

Image 4.png

I'm using "GY-NEO6MV2" with "TinyGPS++" library.

It depends what data you are actually getting from the device.

Some GPS devices report centiseconds, some do not.

mich2016:
It depends what data you are actually getting from the device.

Some GPS devices report centiseconds, some do not.

I’m using “GY-NEO6MV2”.

In this model? Or which model?

Image embedded for our convenience:

64c87a5d3794a02042a5667f71ef734092f33cc1.png

(Here’s how to do that.)

Actually, it is working. With a 1-second update interval, the ublox devices will always report when cs == 0. If you increase the update rate to 5 times per second, you would get centiseconds of 00, 20, 40, 60 and 80.

You might be interested in my library NeoGPS. Besides being faster and smaller, the example programs are much easier and more robust. If you increase the update rate, they will still work, unlike most other libraries’ examples. It will also save you several hundred bytes of RAM.

Cheers,
/dev

/dev:
Image embedded for our convenience:

64c87a5d3794a02042a5667f71ef734092f33cc1.png

(Here’s how to do that.)

Actually, it is working. With a 1-second update interval, the ublox devices will always report when cs == 0. If you increase the update rate to 5 times per second, you would get centiseconds of 00, 20, 40, 60 and 80.

You might be interested in my library NeoGPS. Besides being faster and smaller, the example programs are much easier and more robust. If you increase the update rate, they will still work, unlike most other libraries’ examples. It will also save you several hundred bytes of RAM.

Cheers,
/dev

Hi my friend,

Thanks for reply.

I reviewed your library but very complicated.

How do i write most simple? One by one…

Day, mount, year, hour, minute, second, centisecond, speed(kmph), altitute(meter)…

How do i write most simple? One by one…

Day, mount, year, hour, minute, second, centisecond, speed(kmph), altitute(meter)…

Ok, I modified with NMEAloc.ino:

#include <Arduino.h>
#include "NMEAGPS.h"

//  PICK ONE and declare your serial port for the GPS
//#include <NeoHWSerial.h>
//#include <NeoICSerial.h>
//#include <AltSoftSerial.h>
#include <NeoSWSerial.h>
//#include <SoftwareSerial.h> /* NOT RECOMMENDED */

NeoSWSerial gps_port( 3, 4 );

static NMEAGPS  gps;
static gps_fix  fix;

//--------------------------

void printSomeThings()
{
  if (fix.valid.date) {
    Serial.print( fix.dateTime.date );
    Serial.print( ',' );
    Serial.print( fix.dateTime.month );
    Serial.print( ',' );
    Serial.print( fix.dateTime.full_year() );
  } else {
    Serial.print( F(",,") );
  }
  Serial.print( ',' );
  
  if (fix.valid.time) {
    Serial.print( fix.dateTime.hours );
    Serial.print( ',' );
    Serial.print( fix.dateTime.minutes );
    Serial.print( ',' );
    Serial.print( fix.dateTime.seconds );
    Serial.print( ',' );
    Serial.print( fix.dateTime_cs );
  } else {
    Serial.print( F(",,,") );
  }
  Serial.print( ',' );

  if (fix.valid.speed) {
    Serial.print( fix.speed_kph(), 3 );
  }
  Serial.print( ',' );

  if (fix.valid.altitude) {
    Serial.print( fix.altitude(), 3 );
  }
  Serial.println();

} // printSomeThings

//--------------------------

void setup()
{
  // Start the normal trace output
  Serial.begin(9600);
  while (!Serial)
    ;

  gps_port.begin( 9600 );
}

//--------------------------

void loop()
{
  while (gps.available( gps_port )) {
    fix = gps.read();
    printSomeThings();
  }
}

It displays lines like this:

    18,6,2016,18,26,40,0,0.485,236.600
    18,6,2016,18,26,41,0,0.205,237.200
    18,6,2016,18,26,42,0,0.190,237.500
    18,6,2016,18,26,43,0,0.150,238.200
    18,6,2016,18,26,44,0,0.576,238.700

Cheers,
/dev

/dev:
Ok, I modified with NMEAloc.ino:

#include <Arduino.h>

#include “NMEAGPS.h”

//  PICK ONE and declare your serial port for the GPS
//#include <NeoHWSerial.h>
//#include <NeoICSerial.h>
//#include <AltSoftSerial.h>
#include <NeoSWSerial.h>
//#include <SoftwareSerial.h> /* NOT RECOMMENDED */

NeoSWSerial gps_port( 3, 4 );

static NMEAGPS  gps;
static gps_fix  fix;

//--------------------------

void printSomeThings()
{
 if (fix.valid.date) {
   Serial.print( fix.dateTime.date );
   Serial.print( ‘,’ );
   Serial.print( fix.dateTime.month );
   Serial.print( ‘,’ );
   Serial.print( fix.dateTime.full_year() );
 } else {
   Serial.print( F(",") );
 }
 Serial.print( ‘,’ );
 
 if (fix.valid.time) {
   Serial.print( fix.dateTime.hours );
   Serial.print( ‘,’ );
   Serial.print( fix.dateTime.minutes );
   Serial.print( ‘,’ );
   Serial.print( fix.dateTime.seconds );
   Serial.print( ‘,’ );
   Serial.print( fix.dateTime_cs );
 } else {
   Serial.print( F(",") );
 }
 Serial.print( ‘,’ );

if (fix.valid.speed) {
   Serial.print( fix.speed_kph(), 3 );
 }
 Serial.print( ‘,’ );

if (fix.valid.altitude) {
   Serial.print( fix.altitude(), 3 );
 }
 Serial.println();

} // printSomeThings

//--------------------------

void setup()
{
 // Start the normal trace output
 Serial.begin(9600);
 while (!Serial)
   ;

gps_port.begin( 9600 );
}

//--------------------------

void loop()
{
 while (gps.available( gps_port )) {
   fix = gps.read();
   printSomeThings();
 }
}



It displays lines like this:



18,6,2016,18,26,40,0,0.485,236.600
   18,6,2016,18,26,41,0,0.205,237.200
   18,6,2016,18,26,42,0,0.190,237.500
   18,6,2016,18,26,43,0,0.150,238.200
   18,6,2016,18,26,44,0,0.576,238.700




Cheers,
/dev

///////////////////////////////////////////

Hi my friend,

Thanks for your help.

I did the test with “NMEAGPS” and “NeoSWSerial” library.

But centiseconds still do not seem. :frowning:

And but ram size is a bit smaller.

Image 4.jpg

I think, i must change gps module... :/

IT IS WORKING. CENTISECONDS WILL ALWAYS BE 0.

As I said:

With a 1-second update interval, the ublox devices will always report when cs == 0. If you increase the update rate to 5 times per second, you would get centiseconds of 00, 20, 40, 60 and 80.

I have only seen a few cases when CS is not 0, usually after a cold start. It may have been resyncing the internal RTC with the GPS satellites.

/dev:
IT IS WORKING. CENTISECONDS WILL ALWAYS BE 0.

As I said:
I have only seen a few cases when CS is not 0, usually after a cold start. It may have been resyncing the internal RTC with the GPS satellites.

There is a problem. Please check it code:

#include <Arduino.h>
#include "NMEAGPS.h"

#include <NeoSWSerial.h>
NeoSWSerial gps_port(9, 255);
static NMEAGPS  gps;
static gps_fix  fix;

void setup {
gps_port.begin(9600);
}

void loop {   

while (gps.available(gps_port)) {
    fix = gps.read();
  }

speeddd = fix.speed_kph();

}

Please check it datalog. Log type is (second, csecond, speed kmph)

Speed is only updated every second. If gps module freq is 5 hz, must update 20 milliseconds? Why 1 second?

13,42,5
13,45,5
13,47,5
13,50,5
13,53,5
13,55,5
13,57,5
13,60,5
13,62,5
13,65,5
13,68,5
13,70,5
13,73,5
13,75,5
13,78,5
13,80,5
13,83,5
13,85,5
13,88,5
13,90,5
13,93,5
13,95,5
13,98,5
14,00,5
14,02,5
14,05,5
14,07,5
14,10,5
14,13,5
14,15,5
14,17,5
14,20,5
14,22,5
14,25,5
14,27,5
14,29,5
14,32,5
14,35,5
14,37,5
14,40,5
14,42,12
14,45,12
14,47,12
14,50,12
14,53,12
14,55,12
14,58,12
14,60,12
14,63,12
14,65,12
14,68,12
14,70,12
14,73,12
14,75,12
14,78,12
14,80,12
14,83,12
14,85,12
14,88,12
14,90,12
14,93,12
14,95,12
14,98,12
15,00,12
15,02,12
15,05,12
15,07,12
15,10,12
15,12,12
15,14,12
15,17,12
15,19,12
15,21,12
15,24,12
15,26,12
15,28,12
15,31,12
15,33,12
15,36,12
15,38,12
15,41,22
15,43,22
15,46,22
15,48,22
15,52,22
15,54,22
15,57,22
15,59,22
15,62,22
15,65,22
15,68,22
15,70,22
15,73,22
15,77,22
15,79,22
15,82,22
15,84,22
15,86,22
15,89,22
15,91,22
15,94,22
15,96,22
15,99,22
16,01,22
16,03,22
16,06,22
16,08,22
16,10,22
16,13,22
16,15,22
16,17,22
16,20,22
16,22,22
16,24,22
16,27,22
16,29,22
16,32,22
16,34,22
16,37,22
16,39,22
16,42,32
16,44,32
16,47,32
16,49,32
16,52,32
16,54,32
16,57,32
16,59,32
16,62,32
16,64,32
16,67,32
16,69,32
16,72,32
16,74,32
16,77,32
16,79,32
16,82,32
16,84,32
16,87,32
16,90,32
16,92,32
16,96,32
16,98,32
17,00,32
17,03,32
17,05,32
17,07,32
17,10,32
17,12,32
17,14,32
17,17,32
17,20,32
17,22,32
17,25,32
17,27,32
17,30,32
17,32,32
17,34,32
17,37,32
17,39,32
17,42,41
17,44,41
17,47,41
17,50,41
17,52,41
17,55,41
17,57,41
17,60,41
17,62,41
17,65,41
17,67,41
17,70,41
17,72,41
17,75,41
17,77,41
17,80,41
17,82,41
17,85,41
17,87,41
17,90,41
17,92,41
17,95,41
17,97,41
17,99,41
18,02,41
18,04,41
18,06,41
18,10,41
18,12,41
18,14,41
18,17,41
18,19,41
18,21,41
18,24,41
18,26,41
18,28,41
18,30,41
18,33,41
18,36,41
18,39,41
18,41,50
18,44,50
18,47,50
18,49,50
18,52,50
18,54,50
18,57,50
18,59,50
18,62,50
18,65,50
18,68,50
18,71,50
18,73,50
18,76,50
18,78,50
18,81,50
18,83,50
18,86,50
18,88,50
18,91,50
18,93,50
18,96,50
18,98,50
19,01,50
19,03,50
19,06,50
19,08,50
19,10,50
19,13,50
19,15,50
19,17,50
19,20,50
19,22,50
19,24,50
19,27,50
19,29,50
19,32,50
19,34,50
19,37,50
19,39,50
19,42,57
19,44,57
19,47,57
19,49,57
19,52,57
19,54,57
19,57,57
19,59,57
19,62,57
19,65,57
19,67,57
19,70,57
19,72,57
19,75,57
19,77,57
19,81,57
19,83,57
19,86,57
19,88,57
19,91,57
19,94,57
19,96,57
19,98,57
20,01,57
20,03,57
20,05,57
20,09,57
20,11,57
20,14,57
20,16,57
20,18,57
20,21,57
20,23,57
20,26,57
20,28,57
20,30,57
20,33,57
20,35,57
20,38,57
20,40,62
20,43,62
20,45,62
20,48,62

Please check it code:

That code doesn't print anything.

speed is only updated every second. If gps module freq is 5 hz, must update 20 milliseconds? Why 1 second?

The default GPS update rate is 1Hz. You have to send a command to change the update rate to 5Hz. I don't see any code that sends a command to change the update rate. See section 31.17 of the ublox NEO-6 Protocol document, or use the u-center application to change it and save the configuration in non-volatile RAM.

Please check it datalog. Log type is (second, csecond, speed kmph)

13,42,5 13,45,5 13,47,5 13,50,5 13,53,5

First, please modify your post and put a ``` [code] ``` tag before all that sample output, and a ``` [/code] ``` tag after all those numbers, so it looks like this:

13,42,5
13,45,5
13,47,5
13,50,5
13,53,5
  ...

Second, please show us the code that printed that output, because the NEO-6M does not report GPS information every 0.02 or 0.03 seconds.

Also, I doubt that fix.dateTime_cs is 40. You must be calculating that centisecond value from millis(), and it is not aligned with the GPS clock.

Cheers, /dev

/dev: The default GPS update rate is 1Hz. You have to send a command to change the update rate to 5Hz. I don't see any code that sends a command to change the update rate. See section 31.17 of the ublox NEO-6 Protocol document, or use the u-center application to change it and save the configuration in non-volatile RAM.

Cheers, /dev [/b]

Hi dev,

You can help me with this?

How change 1Hz to 5 Hz ?

Thanks...

See section 31.17 of the ublox NEO-6 Protocol document for the bytes to send. Then put those bytes in an array an send them in setup.

OR

Use the u-center Windows application (on your PC) to change it and save the configuration in the NEO-6M non-volatile RAM.

/dev: See section 31.17 of the ublox NEO-6 Protocol document for the bytes to send. Then put those bytes in an array an send them in setup.

OR

Use the u-center Windows application (on your PC) to change it and save the configuration in the NEO-6M non-volatile RAM.

But i don't know how to do it.

Why can’t you modify your previous post to fix the looooong output sample?

Look at your post, Reply #10, in the lower right-hand corner. It says “Quick Edit” and “More… v”. Click on the “More…” and select “Modify”. Then put the code tags around the output, as I described in Reply #11. If you can’t even modify your post, I’m afraid that Arduino programming will be much too difficult for you.

i don’t know how to do it.

Start trying something and tell us where you get stuck. I gave you two choices: (1) send the command in your setup OR (2) use the u-center app to send the command and make that configuration permanent.

For choice (1), here’s how you put bytes in an array:

uint8_t array[] = { 48, 49, 50, 51, 52 };

These aren’t the command bytes, they’re just an example. The ublox NEO-6 Protocol document says what those bytes should be. google for that document, download it and read section 31.17.

And here’s how you send those bytes:

 Serial.write( array, sizeof(array) );

OR

For choice (2), here’s where you get the u-center application. You should download it, install it, and read the User Guide. u-center expects the NEO-6M GPS module to be directly connected to your PC – no Arduino. You would need a USB-to-serial (3.3V) converter module to do that. They are also called FTDI USB adapters.

Cheers,
/dev

Changed update freq to 10hz, 5hz, 4hz, 3hz, 2hz…

Only good work with 2 Hz.

Other freqs, low signal or staccato signal…

74a89edac8a45a481fea5af33689d2c4c50f2d50.png

I think not eprom for config settings on the this gps module. Because settings are not saved. If not power, return default config settings. (9600 boud rate, 1 hz, etc)

I think, must send config setting with arduino. But why?

Sorry for bad english.

Im working on a project using this module and have struggled following the above posts. I understand the principle but I think it’s not clear how to make a change code-wise with the Arduino.

I’ve got the below in my set up and it gives me a somewhat scrambled, but surly changed output.

#include <SoftwareSerial.h>

// The serial connection to the GPS module
SoftwareSerial ss(2, 3);


void setup(){
  Serial.begin(9800);
  ss.begin(9800);
  Serial.print("go");
  int FREQ_LEN = 14;
   byte updateFreq[FREQ_LEN] = {
  0xB5, // sync char 1
  0x62, // sync char 2
  0x06, // class
  0x08, // id
  0x06, // length
  0x00, // length
  0x64, // payload-- output ms-?
  0x00, // payload
  0x01, // payload
  0x00, // payload
  0x01, // payload
  0x00, // payload
  0x7A, // CK_A
  0x12, // CK_B
 };
  //uint8_t array[] = { 200, 1,0 };
  ss.write( updateFreq, FREQ_LEN );
  
}

void loop(){
  while (ss.available()> 0){
    // get the byte data from the GPS
    byte gpsData = ss.read();
    Serial.write(gpsData);
  }
  Serial.println();
}

I think it really reasonable to use the Arduino for this as it saving getting extra cables we don’t all have.

My question is how to properly calibrate the frequencies, best I can tell the relevant part of the payload is the first 2 bytes. The documentation is here:

i guess we should just pick out ideal output rate in Ms then convert it to hex then replace it there.

Then fix baudrates to get it to print right