Interfacing Arduino with NEO-6M GPS module

This post shows how to connect the Arduino with GPS module in order to receive data from satellites where the GPS module used in this project is u-blox NEO-6M (other modules also should work). With the NEO-6M GPS module we can measure position (latitude, longitude and altitude), time, date, speed and some other data. GPS: Global Positioning System.

The NEO-6M GPS module which I’m using is similar to the one shown below:

NEO-6M GPS module

Generally the GPS module has 4 pins: VCC, RX, TX and GND. It uses serial communication (UART protocol) to communicate with the microcontroller where RX/TX pins are for receiving/transmitting data from/to the microcontroller.

Hardware Required:

  • Arduino board
  • NEO-6M GPS module
  • Breadboard
  • Jumper wires

Interfacing Arduino with NEO-6M GPS module circuit:
The connection of the Arduino with the NE0-6M GPS module is shown below.

Arduino NEO-6M GPS module

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

Note that the RX pin of the GPS module is not connected because there is no need to send data from the Arduino to it, in this project the Arduino just receives data from the GPS module (the GPS module receives data only from the satellites).

Arduino Code:
With the code below we can get the following data from the NEO-6M GPS module:
latitude, longitude, altitude, time, date and number of satellites in use. After I uploaded the sketch into my Arduino I got the result shown below (you’ve to wait for some time if the position is not displayed):

Arduino NEO-6M GPS example

Actually the NEO-6M GPS module sends raw data to the microcontroller repeatedly, this raw data is known as NMEA sentences. NMEA: National Marine Electronics Association.
We can read NEMA sentences but it’s better to (if I can say) decode (or parse) it, for that reason used an Arduino library called TinyGPS++ (TinyGPSPlus). As they said: “this library provides compact and easy-to-use methods for extracting position, date, time, altitude, speed, and course from consumer GPS devices” —> TinyGPS library.

The TinyGPS++ library can be downloaded using 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

Also, I used another library named SoftwareSerial (SoftwareSerial.h) because the Arduino UNO has 1 hardware UART module which is used for the communication between it and the laptop, we need an other serial interface for the communication between the Arduino and the NEO-6M GPS module, here we can use software UART using the built-in library SoftwareSerial.

Full Arduino code is below.

GPS Module Proteus simulation:
This project can be simulated with Proteus, a small library for the GPS module is included in version 8.6 (and higher) of the software. The small video below shows the simulation of the project.

Proteus simulation file download (for version 8.6 or higher):
Arduino GPS

Leave a Reply

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