Category:PCB Arduino

Group Administrators: 1 | Group Member: 81 | Group Threads: 86

Arduino is an open-source electronics platform based on easy-to-use hardware and software. It's intended for anyone making interactive projects. About Arduino and Arduino Projects sharing are appreciated.

Thread Reply
Make a Arduino-based GPS Clock Reply 2017-02-10 02:17:20
596 views
1 comments
137 likes

Bernard

Leave A Message

Follow

Do you need GPS time on your desk? This article will show you how to use a GPS module to get time, date and your location displayed on an LCD with an Arduino.

Requirements


  • Computer with Arduino IDE installed
  • An Arduino (I'm using the Arduino Mega)
  • An LCD
  • A GPS module (I'm using the EM-411)
  • Breadboard, jumperwires and a 5k pot
  • TinyGPS library (Link below)

Introduction
The development of the Global Positioning System, or GPS, started in the early 1970's. Each country (Russia, US, China, etc) has its own system, but most of the GPS units around the world are use the US system.
Each satellite for each system has an atomic clock, which is continously monitored and set by NORAD every single day:
"Conceptually, the receiver measures the TOAs (according to its own clock) of four satellite signals. From the TOAs and the TOTs, the receiver forms four time of flight (TOF) values, which are (given the speed of light) approximately equivalent to receiver-satellite range differences. The receiver then computes its three-dimensional position and clock deviation from the four TOFs." (Wikipedia)
$$\text{Note: TOA = Time of arrival, TOT = Time of transmission}$$
The most inexpensive GPS receivers have about 20 meters accuracy for most places on Earth. Here we'll be learning how to learn our own GPS clock using Arduino.
Hardware
My GPS module has 6 pins: GND, Vin, Tx, Rx & GND. The 6th pin is NC. GND is connected to GND, Vin to Vin, TX is connected to Arduino pin 10, and the Rx pin is not connected to anything since I am not sending any messages to the GPS module. My module is transmitting satellite data using RS-232 with 4800 bps, which is received on pin 10.
This is the module, front and back.
The module is sending what is known as NMEA-sentences. Here you can see an example of one NMEA sentence and the explanation of that sentence (excerpt from datasheet):
All this data is received by the Arduino Mega on pin 10. The TinyGPS library is reading the GPGGA sentence and the GPRMC sentence. (See the datasheet for details about GPRMC.)
The Arduino is not in the schematic, so please follow the connections.
Software
When power is applied, the GPS module takes some time to get a valid fix on the satellites. When a fixed position is made, the module sends the NMEA sentences to the Arduino. The TinyGPS library has one function to get the date and time from the GPRMC sentence. It is calledcrack_datetime(), and it takes seven variables: year, month, day, hour, minute, seconds, and hundredths. A function call looks like this:
gps.crack_datetime(&year, &month, &day, &hour, &minute, &second, &hundredths);
Calling this function gives you the right values in the variables as long as everything with the hardware is ok.
To get our position, you call the functionf_get_position().This function takes two variables, latitude and longitude. To call this function you write this in your code:
gps.f_get_position(&latitude, &longitude);
The sketch in the link shows how both functions works.
Conclusion
In this article, I have shown you how to get the time, date, and location from a GPS module, then display it all on an LCD. Now you know where you are!
Pictures & Video
In the pictures and video, I have added an offset to the latitude and longitude for my privacy. The room I am working in is in the basement and has four concrete walls. To get better reception, I had to solder a cable between the GPS module and the connections header. Then I placed the GPS in the window.
137 likes
Statement: This post is only the personal view of the author and does not represent the opinions of ALLPCB.com.

el.mehdi.fakir

Leave A Message

Follow

Your article answered all my puzzles.
ThreadReply