The GPS module that I am using is Ublox neo 6M V2 with an external antenna.
There are a few prerequisites before u start using the module.
- If the module has a tiny flat cell on it, then it needs to be charged for an hour or two when first powered on. The cell is there to provide charge to the EEPROM and the onboard RTC.
- The green light flashes when the module is charged to indicate the fix.
- You do not get a valid data sentence out of the GPS until the RTC can sync time.
Making connections:
Neo 6 m Arduino
Vcc 5v/3.3v both are fine
RX 10(in my case)
Tx 11(in my case)
GND GND
The gps module gives NMEA data. When you normally read the serial monitor for the gps data you will see stuff like this:
The basic code for raw data is to simply read at the serial pins.
This is the NMEA data. And needs to be parsed and processed.
For this u may require the tinygps or the tinygps ++ library.
I used the tinygps library to get the longitude, latitude and speed of the object.
Here is the code –parseddata. The output looks like as shown below.
The both the gps library explains how to use the various functions to get the desired data.
There is one additional code to parse the data and get the desired data without using the tinygps library.
The output looks like as shown below. And the code for that is available here