Neo 6m GPS Module
৳795.00
Description
Guide to NEO-6M GPS Module with Arduino
This guide shows how to use the NEO-6M GPS module with the Arduino to get GPS data. GPS stands for Global Positioning System and can be used to determine position, time, and speed if you’re travelling.

You’ll learn how to:
- Wire the NEO-6M GPS module to the Arduino UNO
- Get raw GPS data
- Parse raw data to obtain selected and readable GPS information
- Get location
Introducing the NEO-6M GPS Module
The NEO-6M GPS module is shown in the figure below. It comes with an external antenna, and does’t come with header pins. So, you’ll need to get and solder some.

- This module has an external antenna and built-in EEPROM.
- Interface: RS232 TTL
- Power supply: 3V to 5V
- Default baudrate: 9600 bps
- Works with standard NMEA sentences
The NEO-6M GPS module is also compatible with other microcontroller boards. To learn how to use the NEO-6M GPS module with the Raspberry Pi, you can read: Email Alert System on Location Change with Raspberry Pi and GPS Module.
Where to buy?
You can get the NEO-6M GPS module for a price between $5 to $20. We recommend checking the NEO-6M GPS module page on Maker Advisor to compare the price in different stores and find the best one.
Pin Wiring
The NEO-6M GPS module has four pins: VCC, RX, TX, and GND. The module communicates with the Arduino via serial communication using the TX and RX pins, so the wiring couldn’t be simpler:
NEO-6M GPS Module | Wiring to Arduino UNO |
VCC | 5V |
RX | TX pin defined in the software serial |
TX | RX pin defined in the software serial |
GND | GND |
Getting GPS Raw Data
To get raw GPS data you just need to start a serial communication with the GPS module using Software Serial. Continue reading to see how to do that.
Parts Required
For testing this example you’ll need the following parts:
You can use the preceding links or go directly to MakerAdvisor.com/tools to find all the parts for your projects at the best price!
Wire the NEO-6M GPS module to your Arduino by following the schematic below.

- The module GND pin is connected to Arduino GND pin
- The module RX pin is connected to Arduino pin 3
- The module TX pin is connected to Arduino pin 4
- The module VCC pin is connected to Arduino 5V pin
Code
Copy the following code to your Arduino IDE and upload it to your Arduino board.
/*
* Rui Santos
* Complete Project Details https://randomnerdtutorials.com
*/
#include <SoftwareSerial.h>
// The serial connection to the GPS module
SoftwareSerial ss(4, 3);
void setup(){
Serial.begin(9600);
ss.begin(9600);
}
void loop(){
while (ss.available() > 0){
// get the byte data from the GPS
byte gpsData = ss.read();
Serial.write(gpsData);
}
}
This sketch assumes you are using pin 4 and pin 3 as RX and TX serial pins to establish serial communication with the GPS module. If you’re using other pins you should edit that on the following line:
SoftwareSerial ss(4, 3);
Also, if your module uses a different default baud rate than 9600 bps, you should modify the code on the following line:
ss.begin(9600);
This sketch listen to the GPS serial port, and when data is received from the module, it is sent to the serial monitor.
while (ss.available() > 0){
// get the byte data from the GPS
byte gpsData = ss.read();
Serial.write(gpsData);
}
Open the Serial Monitor at a baud rate of 9600.

You should get a bunch of information in the GPS standard language, NMEA. Each line you get int the serial monitor is an NMEA sentence.
NMEA stands for National Marine Electronics Association, and in the world of GPS, it is a standard data format supported by GPS manufacturers.
Understanding NMEA Sentences
NMEA sentences start with the $ character, and each data field is separated by a comma.
$GPGGA,110617.00,41XX.XXXXX,N,00831.54761,W,1,05,2.68,129.0,M,50.1,M,,*42 $GPGSA,A,3,06,09,30,07,23,,,,,,,,4.43,2.68,3.53*02 $GPGSV,3,1,11,02,48,298,24,03,05,101,24,05,17,292,20,06,71,227,30*7C $GPGSV,3,2,11,07,47,138,33,09,64,044,28,17,01,199,,19,13,214,*7C $GPGSV,3,3,11,23,29,054,29,29,01,335,,30,29,167,33*4E $GPGLL,41XX.XXXXX,N,00831.54761,W,110617.00,A,A*70 $GPRMC,110618.00,A,41XX.XXXXX,N,00831.54753,W,0.078,,030118,,,A*6A $GPVTG,,T,,M,0.043,N,0.080,K,A*2C
There are different types of NMEA sentences. The type of message is indicated by the characters before the first comma.
The GP after the $ indicates it is a GPS position. The $GPGGA is the basic GPS NMEA message, that provides 3D location and accuracy data. In the following sentence:
$GPGGA,110617.00,41XX.XXXXX,N,00831.54761,W,1,05,2.68,129.0,M,50.1,M,,*42
- 110617 – represents the time at which the fix location was taken, 11:06:17 UTC
- 41XX.XXXXX,N – latitude 41 deg XX.XXXXX’ N
- 00831.54761,W – Longitude 008 deg 31.54761′ W
- 1 – fix quality (0 = invalid; 1= GPS fix; 2 = DGPS fix; 3 = PPS fix; 4 = Real Time Kinematic; 5 = Float RTK; 6 = estimated (dead reckoning); 7 = Manual input mode; 8 = Simulation mode)
- 05 – number of satellites being tracked
- 2.68 – Horizontal dilution of position
- 129.0, M – Altitude, in meters above the sea level
- 50.1, M – Height of geoid (mean sea level) above WGS84 ellipsoid
- empty field – time in seconds since last DGPS update
- empty field – DGPS station ID number
- *42 – the checksum data, always begins with *
The other NMEA sentences provide additional information:
- $GPGSA – GPS DOP and active satellites
- $GPGSV – Detailed GPS satellite information
- $GPGLL – Geographic Latitude and Longitude
- $GPRMC – Essential GPS pvt (position, velocity, time) data
- $GPVTG – Velocity made good
To know what each data field means in each of these sentences, you can consult NMEA data here.
Parsing NMEA Sentences with TinyGPS++ Library
You can work with the raw data from the GPS, or you can convert those NMEA messages into a readable and useful format, by saving the characters sequences into variables. To do that, we’re going to use the TinyGPS++ library.
This library makes it simple to get information on location in a format that is useful and easy to understand. You can click here for more information about the TinyGPS++ Library.
Installing the TinyGPS++ Library
Follow the next steps to install the TinyGPS++ library in your Arduino IDE:
- Click here to download the TinyGPSPlus library. You should have a .zip folder in your Downloads folder
- Unzip the .zip folder and you should get TinyGPSPlus-master folder
- Rename your folder from
TinyGPSPlus-masterto TinyGPSPlus - Move the TinyGPSPlus folder to your Arduino IDE installation libraries folder
- Finally, re-open your Arduino IDE
The library provides several examples on how to use it. In your Arduino IDE, you just need to go to File > Examples > TinyGPS++, and choose from the examples provided.
Note: the examples provided in the library assume a baud rate of 4800 for the GPS module. You need to change that to 9600 if you’re using the NEO-6M GPS module.
Getting Location Using the NEO-6M GPS Module and the TinyGPS++ Library
You can get the location in a format that is convenient and useful by using the TinyGPS++ library. Below, we provide a code to get the location from the GPS. This is a simplified version of one of the library examples.
/*
* Rui Santos
* Complete Project Details https://randomnerdtutorials.com
*/
#include <TinyGPS++.h>
#include <SoftwareSerial.h>
static const int RXPin = 4, TXPin = 3;
static const uint32_t GPSBaud = 9600;
// The TinyGPS++ object
TinyGPSPlus gps;
// The serial connection to the GPS device
SoftwareSerial ss(RXPin, TXPin);
void setup(){
Serial.begin(9600);
ss.begin(GPSBaud);
}
void loop(){
// This sketch displays information every time a new sentence is correctly encoded.
while (ss.available() > 0){
gps.encode(ss.read());
if (gps.location.isUpdated()){
Serial.print("Latitude= ");
Serial.print(gps.location.lat(), 6);
Serial.print(" Longitude= ");
Serial.println(gps.location.lng(), 6);
}
}
}
You start by importing the needed libraries: TinyGPSPlus and SoftwareSerial
#include <TinyGPS++.h>
#include <SoftwareSerial.h>
Then, you define the software serial RX and TX pins, as well as the GPS baud rate. If you are using other pins for software serial you need to change that here. Also, if your GPS module uses a different default baud rate, you should also modify that.
static const int RXPin = 4, TXPin = 3;
static const uint32_t GPSBaud = 9600;
Then, you create a TinyGPS++ object:
TinyGPSPlus gps;
And start a serial connection on the pins you’ve defined earlier
SoftwareSerial ss(RXPin, TXPin);
In the setup(), you initialize serial communication, both to see the readings on the serial monitor and to communicate with the GPS module.
void setup() {
Serial.begin(9600);
ss.begin(GPSBaud);
}
In the loop is where you request the information. To get TinyGPS++ to work, you have to repeatedly funnel the characters to it from the GPS module using the encode() method.
while (ss.available() > 0){
gps.encode(ss.read());
Then, you can query the gps object to see if any data fields have been updated:
if (gps.location.isUpdated()){
Serial.print("Latitude="); Serial.print(gps.location.lat(), 6);
Serial.print("Longitude="); Serial.println(gps.location.lng(), 6);
}
Getting the latitude and longitude is has simple has using gps.location.lat(), and gps.location.lng(), respectively.
Upload the code to your Arduino, and you should see the location displayed on the serial monitor. After uploading the code, wait a few minutes while the module adjusts the position to get a more accurate data.

Getting More GPS Information Using the TinyGPS++ Library
The TinyGPS++ library allows you to get way more information than just the location, and in a simple way. Besides the location, you can get:
- date
- time
- speed
- course
- altitude
- satellites
- hdop
The code below exemplifies how you can get all that information in a simple way.
/*
* Rui Santos
* Complete Project Details https://randomnerdtutorials.com
*
* Based on the example TinyGPS++ from arduiniana.org
*
*/
#include <TinyGPS++.h>
#include <SoftwareSerial.h>
static const int RXPin = 4, TXPin = 3;
static const uint32_t GPSBaud = 9600;
// The TinyGPS++ object
TinyGPSPlus gps;
// The serial connection to the GPS device
SoftwareSerial ss(RXPin, TXPin);
void setup(){
Serial.begin(9600);
ss.begin(GPSBaud);
}
void loop(){
// This sketch displays information every time a new sentence is correctly encoded.
while (ss.available() > 0){
gps.encode(ss.read());
if (gps.location.isUpdated()){
// Latitude in degrees (double)
Serial.print("Latitude= ");
Serial.print(gps.location.lat(), 6);
// Longitude in degrees (double)
Serial.print(" Longitude= ");
Serial.println(gps.location.lng(), 6);
// Raw latitude in whole degrees
Serial.print("Raw latitude = ");
Serial.print(gps.location.rawLat().negative ? "-" : "+");
Serial.println(gps.location.rawLat().deg);
// ... and billionths (u16/u32)
Serial.println(gps.location.rawLat().billionths);
// Raw longitude in whole degrees
Serial.print("Raw longitude = ");
Serial.print(gps.location.rawLng().negative ? "-" : "+");
Serial.println(gps.location.rawLng().deg);
// ... and billionths (u16/u32)
Serial.println(gps.location.rawLng().billionths);
// Raw date in DDMMYY format (u32)
Serial.print("Raw date DDMMYY = ");
Serial.println(gps.date.value());
// Year (2000+) (u16)
Serial.print("Year = ");
Serial.println(gps.date.year());
// Month (1-12) (u8)
Serial.print("Month = ");
Serial.println(gps.date.month());
// Day (1-31) (u8)
Serial.print("Day = ");
Serial.println(gps.date.day());
// Raw time in HHMMSSCC format (u32)
Serial.print("Raw time in HHMMSSCC = ");
Serial.println(gps.time.value());
// Hour (0-23) (u8)
Serial.print("Hour = ");
Serial.println(gps.time.hour());
// Minute (0-59) (u8)
Serial.print("Minute = ");
Serial.println(gps.time.minute());
// Second (0-59) (u8)
Serial.print("Second = ");
Serial.println(gps.time.second());
// 100ths of a second (0-99) (u8)
Serial.print("Centisecond = ");
Serial.println(gps.time.centisecond());
// Raw speed in 100ths of a knot (i32)
Serial.print("Raw speed in 100ths/knot = ");
Serial.println(gps.speed.value());
// Speed in knots (double)
Serial.print("Speed in knots/h = ");
Serial.println(gps.speed.knots());
// Speed in miles per hour (double)
Serial.print("Speed in miles/h = ");
Serial.println(gps.speed.mph());
// Speed in meters per second (double)
Serial.print("Speed in m/s = ");
Serial.println(gps.speed.mps());
// Speed in kilometers per hour (double)
Serial.print("Speed in km/h = ");
Serial.println(gps.speed.kmph());
// Raw course in 100ths of a degree (i32)
Serial.print("Raw course in degrees = ");
Serial.println(gps.course.value());
// Course in degrees (double)
Serial.print("Course in degrees = ");
Serial.println(gps.course.deg());
// Raw altitude in centimeters (i32)
Serial.print("Raw altitude in centimeters = ");
Serial.println(gps.altitude.value());
// Altitude in meters (double)
Serial.print("Altitude in meters = ");
Serial.println(gps.altitude.meters());
// Altitude in miles (double)
Serial.print("Altitude in miles = ");
Serial.println(gps.altitude.miles());
// Altitude in kilometers (double)
Serial.print("Altitude in kilometers = ");
Serial.println(gps.altitude.kilometers());
// Altitude in feet (double)
Serial.print("Altitude in feet = ");
Serial.println(gps.altitude.feet());
// Number of satellites in use (u32)
Serial.print("Number os satellites in use = ");
Serial.println(gps.satellites.value());
// Horizontal Dim. of Precision (100ths-i32)
Serial.print("HDOP = ");
Serial.println(gps.hdop.value());
}
}
}
The TinyGPS++ library is well commented on how to use all its functionalities.
Reviews
There are no reviews yet.