GPS Sending incorrect Date to TFT via SoftwareSerial/TinyGPS

Dear Readers,

I would appreciate any help in regard to my current issue.

I have connected the Ultimate Adafruit_GPS to my tft display via Digital pins 2 and 3.

I have used SoftwareSerial mySerial(3,2) to initialise the serial port on pins 2 and 3. (I think this is the correct terminology).

Upon hook-up I received the correct time in UTC and the correct date. However, after some time I believe the date changed to return an incorrect date of 31:12:1999.

I have tried increasing the buffer size of the SoftwareSerial from 62 to 128 and 256… But the output still remains the same. I also tried using the RX and TX on my Arduino Nano but this would result in me failing to upload a sketch. (Still unsure as to why this is the case) I have reached the conclusion, rightly or wrongly, that the serial port is getting full and not receiving new data or atleast discarding it.

I would appreciate any help on this. Additionally, If anyone has an idea how I can offset the time to +1 (UK) time I would also appreciate any advice.

My code is also attached.

Many thanks

Laurence

TimeDate.txt (1.39 KB)

Some GPS units suffer from a date bug that shows up on April 6 this year, similar to Y2K.

Print out the raw GPS output (NMEA sentences) to determine if that is the problem.

The Arduino Time library can help with time zone changes.

I use an Adafruit Ultimate GPS (Ugps) and #include <TinyGPS++.h>. I do not have an issue with getting/setting times. Did you solder on the battery holder and put in a battery to the holder on the Ultimate GPS? Soldering on the battery holder and putting in a battery is quite helpful to the operation of the Ultimate GPS.

here is the code I use to get data from the Ugps:

void fGPS_Parse(  void *pvParameters )
{
  for (;;)
  {
    xEventGroupWaitBits (eg, evtGPS_Parse, pdTRUE, pdTRUE, portMAX_DELAY) ;
    if ( xSemaphoreTake( sema_GPS_Gate, xTicksToWait0 ) == pdTRUE )
    {
      //query GPS: has a new complete chunk of data been received?
      if ( GPSSerial.available() > 1 )
      {
        if ( GPS.encode(GPSSerial.read()) )
        {
          if (  GPS.location.isValid())
          {
            if ( xSemaphoreTake( sema_Posit, xSemaphoreTicksToWait ) == pdTRUE )
            {
              xPosit.Lat = GPS.location.lat();// store data into structure
              xPosit.Lon = GPS.location.lng();
              xSemaphoreGive( sema_Posit );
            }
          } // if (  GPS.location.isValid())
          if (GPS.speed.isValid())
          {
            if ( xSemaphoreTake( sema_Posit, xSemaphoreTicksToWait ) == pdTRUE )
            {
              xPosit.MPH = GPS.speed.mph();
              xPosit.KPH = GPS.speed.kmph();
              xSemaphoreGive( sema_Posit );
            }
          } //  if (GPS.speed.isValid())
          if (GPS.time.isValid())
          {
            if ( xSemaphoreTake( sema_Time, xSemaphoreTicksToWait ) == pdTRUE )
            {
              xTime.iSeconds = GPS.time.second();
              xTime.iMinutes = GPS.time.minute();
              xTime.iHours = GPS.time.hour();
              xSemaphoreGive( sema_Time );
            }
          } // if (GPS.time.isValid())
          if (GPS.date.isValid())
          {
            if ( xSemaphoreTake( sema_Date, xSemaphoreTicksToWait ) == pdTRUE )
            {
              xDate.iMonth = GPS.date. month();
              xDate.iDay = GPS.date.day();
              xDate.iYear = GPS.date.year();
              xSemaphoreGive( sema_Date );
            }
          } // if (GPS.date.isValid())
          if (  GPS.altitude.isValid() )
          {
            if ( xSemaphoreTake( sema_Posit, xSemaphoreTicksToWait ) == pdTRUE )
            {
              xPosit.Alti = GPS.altitude.meters();
              xSemaphoreGive( sema_Posit );
            }
          } //  if (  GPS.altitude.isValid() )
          if ( GPS.course.isUpdated() )
          {
            if ( xSemaphoreTake( sema_Posit, xSemaphoreTicksToWait ) == pdTRUE )
            {
              xPosit.Hdg = GPS.course.deg();
              xSemaphoreGive( sema_Posit );
            }
          } // if ( GPS.course.isUpdated() )
          if ( xSemaphoreTake( sema_Posit, xSemaphoreTicksToWait ) == pdTRUE )
          {
            xQueueOverwrite( xQ_Posit, (void *) &xPosit );
            xSemaphoreGive( sema_Posit );
          }
        } // if ( GPS.encode(GPSSerial.read()))
      } // if ( GPSSerial.available() > 0 )
      xSemaphoreGive( sema_GPS_Gate );
    }
  } // for (;;)
  vTaskDelete( NULL );
} // void fGPS_Parse(  void *pvParameters )

Notice the use if the .isValid(). I trigger the fGPS_Parse once a mS.

jremington:
Some GPS units suffer from a date bug that shows up on April 6 this year, similar to Y2K.

Print out the raw GPS output (NMEA sentences) to determine if that is the problem.

The Arduino Time library can help with time zone changes.

I read that the problem is the week counter rolls over to zero and the base # for the calculation has to be reset in the software to a new date. If your unit cannot be updated with new software, it is pretty much a paper weight.

Paul

GPS is a deep subject but makes for great Arduino projects.

There are two basic & indispensable tools:

It's easy to get the NMEA sentences straight to the IDE monitor without any programming. Connect the GPS TX pin to pin 1 on the UNO & open the monitor. The sentences will appear. You musn't have a sketch running on that uses the serial port (Blink or BareMinimum). Or, just press and hold the reset button -- that kills the sketch.

The IDE uploads a sketch thru the builtin (hardware) serial port & that's why the two operations can't work at the same time.

The other tool is u-blox's programme u-centre. This shows loads of info coming from the GPS. Explore.

To use u-centre the physical arrangement is as with the first tool: the TX pin of the GPS to pin 1 of the UNO. In u-centre connect to the port. You must first close the IDE monitor as the two conflict over the serial port. Only one of them can be operating.

It can be confusing which pin on the Arduino to use for receiving data. Ignore the labels alongside the pins ("TX" and "RX") on the Arduino. Observe the on-board leds -- they don't lie.

I hope this helps.