Robert Eisele
Systems Engineer, Architect and DBA

NEO6MV2 GPS Module with Arduino

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

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);
});

You might also be interested in the following

Leave a comment

10 * 2