Robert Eisele
Engineer, Systems Architect and DBA

NEO6MV2 GPS Module with Raspberry PI

Using the GY-NEO6MV2 module with the Arduino was shown previously. Here is how to make it work with an Raspberry PI, when you don't want to use an USB device to save power or USB ports. A test against a USB receiver is still ongoing.

Hardware

The NEO6MV2 GPS module comes with 4 connections: RX, TX, VCC and GND, which is quite easy to incorporate with using the UART connector on the Raspberry PI and much easier as we can use the 3v3 logic directly.

Parts

Wiring

  • TX to Pin 10 (GPIO15)
  • RX to Pin 8, (GPIO14)
  • Gnd to Pin 6
  • VCC to Pin 1

The Fritzing sketch can be downloaded from github.

Software

Raspberry PI uses the UART interface as a serial console by default. We have to deactivate this first! Connect to the PI and run:

$ sudo raspi-config

Go to advanced settings:

Go to serial:

Select no/nein to turn it off:

Done!

Now restart the PI and you're ready to proceed. You can give it a trial and see if you get GPS/NMEA data:

cat /dev/ttyAMA0

Coding

If everything went fine, you're ready to write some code to use your module. I'll use node.js and the GPS module via serialport. The procedure is fairly simple:

var file = '/dev/ttyAMA0';

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

The library comes with a lot of examples. Let's have some fun with it. Try open the dashboard:

or see the live stream via the Google Maps API:

For details see the documentation and don't forget to change the serial device path!

Troubleshooting

If you get data with a lot of null values, you probably have no fix yet. The module needs quite some time for the first fix. Keep it running or go outside to improve the radio reception.

You might also be interested in the following

 

Sorry, comments are closed for this article. Contact me if you want to leave a note.