Arduino GPS real time clock with NEO-6M module

There are different ways to build an Arduino based real time clock, one of the ways is using a real time clock chip (like: DS1302, DS1307, DS3231 …) and another way is by using a GPS module. The GPS based clock receives time from satellites and automatically sets its time. This topic shows how to build an Arduino GPS clock with NEO-6M GPS module where time and date are displayed on 16×2 LCD screen.

Related Projects:
Last time I made a simple interfacing of Arduino with NEO-6M GPS module in order to get position, time, date and speed, project page link is below:
Interfacing Arduino with NEO-6M GPS module
Arduino GPS clock with local time using NEO-6M module

and the links below shows how to build a real time clock using Arduino and RTC chips:
Arduino real time clock with DS1307
Arduino and DS3231 real time clock

Hardware Required:
To build this project the following components are needed:

  • Arduino (or compatible) board
  • NEO-6M GPS module
  • 16×2 LCD screen
  • 10k ohm variable resistor (or potentiometer)
  • 330 ohm resistor
  • Breadboard
  • Jumper wires

Arduino GPS clock with U-Blox NEO-6M GPS module

Arduino GPS real time clock with NEO-6M module circuit:
Project circuit diagram is shown below.

Arduino GPS real time clock with NEO-6M and LCD

NEO-6M GPS module has 4 pins where:
NEO-6M GPS board GND pin goes to Arduino GND
TX pin goes to Arduino digital pin 9
RX pin is not connected
VCC pin goes to Arduino 5V pin (can be connected to 3.3V pin)

The 1602 LCD screen is used to display the real time clock time and date where:
RS —> Arduino digital pin 2
E  —> Arduino digital pin 3
D4 —> Arduino digital pin 4
D5 —> Arduino digital pin 5
D6 —> Arduino digital pin 6
D7 —> Arduino digital pin 7
VSS, RW, D0, D1, D2, D3 and K are connected to Arduino GND (ground)
VEE to the variable resistor (or potentiometer) output
VDD to Arduino 5V and A to Arduino 5V through 330 ohm resistor

VEE pin is used to control the contrast of the LCD. A (anode) and K (cathode) are the back light LED pins.

Arduino GPS clock code:
The Arduino code below uses TinyGPS++ library, it can be downloaded from the link below. After downloading the library, unzip the folder and add it to Arduino libraries folder (for example: C:\Program Files\Arduino\libraries). You should rename the folder “TinyGPSPlus”.
TinyGPS++ Library  —  direct link

Full Arduino code is below.

The following video shows how a hardware circuit should work (UTC time):


    1. No need for an internet connection.
      The Arduino is getting the time from the GPS unit.

      It is reading the data from the GPS unit (line 37) through a serial connection (connected to pins 8 and 9) then extracting the time and date from that GPS data (lines 39 thru 55).

  1. Your wiring diagram shows connection from the GPS to the Arduino on Digital pin 9 but your text description says “TX pin goes to Arduino digital pin 4 “. The code is written for pin 9 so I guess it’s just a typo.

      1. Yes, I’m doing this in the 16×2 display sketch; I changed the Time Zone as follows:
        from: #define time_offset 3600
        to: #define time_offset -7200 (Brazil -3) but nothing is changing on the display.

          1. I want to adapt the code “Arduino GPS clock with local time using NEO-6M module” in the sketch “Arduino GPS real time clock with NEO-6M module” for the Display 16×2 because I need to change the Timezone in Display 16×2.

  2. I need a little help
    I’m working on a project for a local church.
    It is necessary to ring the bells every day at 7 am and 7 pm.
    The bells are connected with relay.
    What I need to add to code to turn on the relay at 7 am and 7 pm.

  3. Thank You. Works perfectly for me with a’ GoouuuTech’ clone GPS receiver. This even gives me a 1PPS output, which is very useful for synchronising other clocks.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.