top of page
Search
Writer's pictureGenius BRO!!

GPS Module with Arduino (NEO6MV2)


GPS Module with Arduino (NEO6MV2)










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

That means you simply connect the 5V Power/VCC and Ground of your Arduino directly to the receiver. The same goes for the TX (green) wire, which gets connected 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 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 receiver RX channel since this is not regulated. So beware if your NEO6M accepts 5V or if you have to 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.


Code

Getting the data from the GPS module is pretty straightforward, using Software Serial 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 of the Arduino to another device like your computer and using node.js to interpret the data. Here is the sample 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);
  }
}

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


359 views0 comments

Comments


bottom of page