Skip to main content
Added reference to the Arduino's time library after @Tvr4 suggested it.
Source Link
st2000
  • 7.5k
  • 2
  • 13
  • 20

Since you have not posted your code we need to make several assumptions.

Display "waiting for sats" ... continue when a successful GPS signal is received

You are (or the Arduino library you are using is) using the time.h library which starts on January 1st, 1970. If no adjustments are made, time.h will report January 1st, 1970.

You are not (or the Arduino library you are using is not) waiting for a "good GPS signal" indication from the GPS module before displaying the time.

adjust GPS time & date to local

If you are using time.h you (or the Arduino library you are using) should set a time-zone offset instead of correcting the time by hand. This will take advantage of the time.h library utilities which take care of troublesome cases like calculating a time & date which crosses midnight with respect to UTC (aka GMT).

display date and time

The time.h library stores the date / time as the number of seconds since January 1st, 1970. So when displaying the current time, use time.h function calls to convert this counter to the current local time.

Hints / Suggestions:

  • The GPS module is a radio receiver. It works best when the view of the sky is unobstructed by buildings, trees, hills or bad weather. Such obstructions results in slow lock times or no lock at all. The more satellites the GPS module can see the better.
  • The GPS module is a computer in and of its self. The computer will analyze messages form satellites several times before it is ready to report location and time data. If possible, leave the GPS module powered up even if the Arduino is not. This should likely reduce or eliminate the delay the GPS module needs before reporting location and time.

Added later...

@Tvr4 brings up a good point. While time.h is more ubiquitous (used almost everywhere in C programming), in the Arduino paradigm, the built in Arduino time library is often used. For more, this is discussed in this stackoverflow question / answer. If you want to dive into the Arduino time library, the code is in this github repository. Also, you should find more help with this time libaray in the readme file displayed on that web page.

Since you have not posted your code we need to make several assumptions.

Display "waiting for sats" ... continue when a successful GPS signal is received

You are (or the Arduino library you are using is) using the time.h library which starts on January 1st, 1970. If no adjustments are made, time.h will report January 1st, 1970.

You are not (or the Arduino library you are using is not) waiting for a "good GPS signal" indication from the GPS module before displaying the time.

adjust GPS time & date to local

If you are using time.h you (or the Arduino library you are using) should set a time-zone offset instead of correcting the time by hand. This will take advantage of the time.h library utilities which take care of troublesome cases like calculating a time & date which crosses midnight with respect to UTC (aka GMT).

display date and time

The time.h library stores the date / time as the number of seconds since January 1st, 1970. So when displaying the current time, use time.h function calls to convert this counter to the current local time.

Hints / Suggestions:

  • The GPS module is a radio receiver. It works best when the view of the sky is unobstructed by buildings, trees, hills or bad weather. Such obstructions results in slow lock times or no lock at all. The more satellites the GPS module can see the better.
  • The GPS module is a computer in and of its self. The computer will analyze messages form satellites several times before it is ready to report location and time data. If possible, leave the GPS module powered up even if the Arduino is not. This should likely reduce or eliminate the delay the GPS module needs before reporting location and time.

Display "waiting for sats" ... continue when a successful GPS signal is received

You are (or the Arduino library you are using is) using the time.h library which starts on January 1st, 1970. If no adjustments are made, time.h will report January 1st, 1970.

You are not (or the Arduino library you are using is not) waiting for a "good GPS signal" indication from the GPS module before displaying the time.

adjust GPS time & date to local

If you are using time.h you (or the Arduino library you are using) should set a time-zone offset instead of correcting the time by hand. This will take advantage of the time.h library utilities which take care of troublesome cases like calculating a time & date which crosses midnight with respect to UTC (aka GMT).

display date and time

The time.h library stores the date / time as the number of seconds since January 1st, 1970. So when displaying the current time, use time.h function calls to convert this counter to the current local time.

Hints / Suggestions:

  • The GPS module is a radio receiver. It works best when the view of the sky is unobstructed by buildings, trees, hills or bad weather. Such obstructions results in slow lock times or no lock at all. The more satellites the GPS module can see the better.
  • The GPS module is a computer in and of its self. The computer will analyze messages form satellites several times before it is ready to report location and time data. If possible, leave the GPS module powered up even if the Arduino is not. This should likely reduce or eliminate the delay the GPS module needs before reporting location and time.

Added later...

@Tvr4 brings up a good point. While time.h is more ubiquitous (used almost everywhere in C programming), in the Arduino paradigm, the built in Arduino time library is often used. For more, this is discussed in this stackoverflow question / answer. If you want to dive into the Arduino time library, the code is in this github repository. Also, you should find more help with this time libaray in the readme file displayed on that web page.

Source Link
st2000
  • 7.5k
  • 2
  • 13
  • 20

Since you have not posted your code we need to make several assumptions.

Display "waiting for sats" ... continue when a successful GPS signal is received

You are (or the Arduino library you are using is) using the time.h library which starts on January 1st, 1970. If no adjustments are made, time.h will report January 1st, 1970.

You are not (or the Arduino library you are using is not) waiting for a "good GPS signal" indication from the GPS module before displaying the time.

adjust GPS time & date to local

If you are using time.h you (or the Arduino library you are using) should set a time-zone offset instead of correcting the time by hand. This will take advantage of the time.h library utilities which take care of troublesome cases like calculating a time & date which crosses midnight with respect to UTC (aka GMT).

display date and time

The time.h library stores the date / time as the number of seconds since January 1st, 1970. So when displaying the current time, use time.h function calls to convert this counter to the current local time.

Hints / Suggestions:

  • The GPS module is a radio receiver. It works best when the view of the sky is unobstructed by buildings, trees, hills or bad weather. Such obstructions results in slow lock times or no lock at all. The more satellites the GPS module can see the better.
  • The GPS module is a computer in and of its self. The computer will analyze messages form satellites several times before it is ready to report location and time data. If possible, leave the GPS module powered up even if the Arduino is not. This should likely reduce or eliminate the delay the GPS module needs before reporting location and time.