Interfacing uBlox NEO6M GPS Module with Arduino

NEO6M-GPS-Tutorial-FactoryForward

Interfacing uBlox NEO6M GPS Module with Arduino

GPS was widely used in Marine navigations mostly in olden days. After that, governments decided to provide access to all users in the world to use GPS navigation. Nowadays it is used widely by all people on their Mobile phones, Car Navigation Systems, Drones, Asset Tracking systems in logistics, Anti-Theft for motorcycles, etc. Almost all of us might have used Google Maps in anyway. So we are aware about what a GPS does. So let’s go deeper into it on how do we use this GPS Module with Arduino to get location, time date, etc.

A GPS module receives signals from the GPS Satellites. There are minimum 3 satellites to get an accurate 3D Fix location; otherwise it can detect location using one satellite only (but not accurate).The number of satellite signals it gets the accuracy of the location increases.

The uBlox NEO6M GPS Module has a big 25mmx25mm antenna along with a battery and EEPROM to lock the satellites faster. The module has a GPS Antenna connected via an uFl connector. It doesn’t have any power indicator LED, but it has an onboard LED that indicates the satellite is fixed. Whenever the LED blinks the satellite is fixed and sending the data via the Serial Communication pins. It continuously sends the data via the serial pins. All we have to do is to get the data and parse it to get our required information using the Microcontroller/Microprocessor. The default baud rate for NEO6M GPS Module is 9600bps.

GPS-Module-details

In this tutorial, we will see how to use this GPS Module with Arduino.

Components required:

Circuit Diagram:

GY-NEO6MV2_bb

We will be using Software Serial Library for this as we are going to print the data from GPS to Serial Monitor. If you use the same communication port both the data will clash together and we get invalid data. Arduino MEGA has 4 Dedicated COM Ports, but in UNO we need to use the Software Library only.

Arduino Pins NEO6M GPS Pins
GND GND
Pin 9 (RX) TX
Pin 8 (TX) RX
VCC (+5V) VCC (3.6 to 5V)

 

Note: As per the uBlox NEO6M datasheet the voltage level for GPS Module is 3.6V. But we didn’t face any heating issue with 5V. You can try with 3.3V initially (for TX/RX also) and can shift to 5V if needed. But still it is recommended to use a Level Shifter for long time purpose.

Code to get RAW GPS Data:

 

In the above code, we declared pin 9 as RX and Pin 8 as TX for SoftwareSerial. We named it as mySerial for simple use.

In the setup loop, we set the baud rate for GPS as 9600 (default NEO6M Baud rate).

Inside the main loop, when the data is available we store the data in rawData variable from the GPS Module and then print it on the serial monitor.

Now upload the full code and open serial monitor, Make sure the baud rate is set as 9600 and the GPS LED is blinking. If everything is perfect you can see the data like this below.

 

“$GPRMC,045103.000,A,3014.1984,N,09749.2872,W,0.67,161.46,030913,,,A*7C\r\n”

“$GPGGA,045104.000,3014.1985,N,09749.2873,W,1,09,1.2,211.6,M,-22.5,M,,0000*62\r\n”

“$GPRMC,045200.000,A,3014.3820,N,09748.9514,W,36.88,65.02,030913,,,A*77\r\n”

“$GPGGA,045201.000,3014.3864,N,09748.9411,W,1,10,1.2,200.8,M,-22.5,M,,0000*6C\r\n”

“$GPRMC,045251.000,A,3014.4275,N,09749.0626,W,0.51,217.94,030913,,,A*7D\r\n”

“$GPGGA,045252.000,3014.4273,N,09749.0628,W,1,09,1.3,206.9,M,-22.5,M,,0000*6F\r\n”;

 

It might look confusing because these are huge bytes of data coming in GPS Language. These are called NMEA Sentences. NMEA Stands for National Marine Electronics Association. There are some online parsers available to decode the information. But we need to parse it in our Arduino Board. For that, there is a library available called TinyGPS++ to parse the GPS Data. We will see how to use it easily.

Parsing data using TinyGPS++ Library:

  • Download the TinyGPS++ Library.
  • In Arduino IDE, go to Sketch > Include Library > Add .ZIP Library > Select the downloaded .zip library.
  • Close and Re-Open your IDE. Copy paste the following code.

Coding to parse Latitude and Longitude data using TinyGPS++ Library:

Upload the code and you can see the latitude and longitude values get displayed every second, once the data is parsed.

Share this post

Leave a Reply

Your email address will not be published. Required fields are marked *