raw arduino

NEO6MV2 GPS Module with Arduino

Robert Eisele

After using USB receivers for GPS, I needed a module to shrink down a project and found the GY-NEO6MV2 module. Here is how to connect it to an Arduino board.

Hardware

The NEO6MV2 GPS module comes with 4 connections: RX, TX, VCC and GND, which is quite easy to incorporate with using SoftwareSerial on an Arduino Uno or a serial interface on an Arduino Mega. There is only one little problem: The module uses 3v3 logic, which is not compatible with the 5v supplied by Arduino. However, a simple voltage divider can solve this issue.

Parts

Wiring

GY-GPS6MV2 Arduino Wiring

That means, you simple connect the 5V Power/VCC and Ground of your Arduino directly to the receiver. The same goes for the TX (green) wire, which gets conected to digital port 3 of your Arduino. For the RX wire, a small voltage divider is set in place, using a 4.7kOhm (with pink stripe) and a 10kOhm resistor (black/orange stripes). That means for the RX wire, a wire from digital port 4 to the 4.7k resistor, then to the 10k, which is tied to Ground. Where the two resistors are connected, we get the voltage from to the RX port of the GPS module.

Note: The power supply of the NEO6M should be 3.6V at max according to the datasheet. The typical China-produced breakout-boards you get from eBay or Amazon contain a voltage regulator so that 3-5V VCC is totally okay and does not harm the board. Since the digital pins also produce 5V, the voltage divider is used on the receivers RX channel since this is not regulated. So beware if your NEO6M accepts 5V or if you have regulate the voltage (for example by using Arduino's 3.3V output). The voltage divider (and therefore the resistors) are necessary in any case with an Arduino!

The Fritzing sketch can be downloaded from github.

Software

Getting the data from the GPS module is pretty straightforward, using SoftwareSerial and TinyGPS:

#include <SoftwareSerial.h>
#include <TinyGPS.h>

SoftwareSerial mySerial(3, 4); // RX, TX
TinyGPS gps;

void setup()  {
  mySerial.begin(9600);
}

void loop() {
  bool ready = false;
  if (mySerial.available()) {
    char c = mySerial.read();
    if (gps.encode(c)) {
      ready = true;
    }
  }

  // Use actual data
  if (ready) {
    // Use `gps` object
  }
}

An alternative could be streaming the GPS data off the Arduino to another device like your computer and use node.js to interpret the data. Here is the simple modification to use the Arduino as a bridge:

#include <SoftwareSerial.h>

SoftwareSerial mySerial(3, 4); // RX, TX

void setup()  {
  Serial.begin(9600);
  mySerial.begin(9600);
}

void loop() {
  bool ready = false;
  if (mySerial.available()) {
    char c = mySerial.read();
    Serial.write(c);
  }
}

On your computer, you can simply use the gps module as follows (which has tons of examples on github as well, like live preview on Google Maps, a live dashboard using D3 and more):

var file = '/dev/tty.usbmodem1411'; // Your Arduino serial device

var GPS = require('gps');
var SerialPort = require('serialport');
var port = new SerialPort.SerialPort(file, {
  baudrate: 9600,
  parser: SerialPort.parsers.readline('\r\n')
});

var gps = new GPS;

gps.on('data', function(data) {
  console.log(data);
});

port.on('data', function(data) {
  gps.update(data);
});