NEO-6M GPS module
The GY-NEO6MV2 breakout: a u-blox NEO-6M, a square ceramic patch antenna and a green LED that blinks once a second when it knows where it is.
To a sketch it is a serial port that talks NMEA at 9600 baud. Aliases: GPS, GNSS receiver, u-blox.
There is no sky in Mokxi. The position is a property of the part, and whether the
module has a fix is a switch you throw by clicking it. What is real is everything
the board sees: the bytes on TX, bit by bit, in the sentences a real NEO-6M
sends from the factory.
Pins
| Pin | What it does |
|---|---|
VCC |
Supply, 3 to 5 V. The breakout has its own 3.3 V regulator. |
RX |
Into the module. Accepted and ignored: see below. |
TX |
Out of the module: NMEA at baud, 8N1, swinging to 3.3 V. |
GND |
Ground. |
Wire TX to a receive pin on the board. On a Mega that is RX1 (pin 19) and the
sketch reads Serial1. The Uno's only hardware UART is the serial monitor's, so
on an Uno the tutorials reach for SoftwareSerial, which Mokxi does not ship yet;
use a Mega, or a board with a second UART.
Properties
lat and lon are where the module is, in decimal degrees (north and east are
positive). altitude is meters above sea level. satellites is how many it
reports using, 0 to 12; fewer than three is no fix. speed in km/h and course
in degrees from north make the position move along that heading once a second.
fix is whether it starts with one. start is the UTC date and time at the first
sentence. baud is 9600, as shipped.
While it runs
Click the module to lose the fix and click again to get it back. The badge on the face says which, and the green LED blinks for 100 ms each second while there is a fix, as the real one's timepulse does.
What is modeled
The default u-blox 6 output: every second, $GPRMC, $GPVTG, $GPGGA, $GPGSA,
one to three $GPGSV and $GPGLL, each with its checksum and CR LF. About 450
bytes, which at 9600 baud keeps the wire busy for nearly half of every second,
exactly as on the bench. The position goes out to five decimal places of a minute.
Without a fix the sentences are the empty ones a receiver sends indoors: status
V, fix quality 0, no time and no position.
TinyGPS++.h reads it: gps.encode(c) on every byte, then gps.location.lat(),
gps.location.lng(), gps.date, gps.time, gps.speed.kmph(),
gps.course.deg(), gps.altitude.meters(), gps.satellites.value() and
gps.hdop.hdop(), with isValid(), isUpdated() and age() on each, and
TinyGPSPlus::cardinal() for the compass point of a course.
Every value comes back as a double built from the whole numbers in the
sentence, so it prints exactly, with as many decimals as you ask for, and a
sketch can do sums on it like any other number. distanceBetween and
courseTo work too: the great-circle distance in meters and the course in
degrees, as the upstream library gives them. On the AVR boards a double is
32 bits, so a position there is good to about a meter.
The GPS logger in the gallery puts this module and a microSD card on a Mega and writes a track you can download.
What is not modeled
The radio and everything that comes from it: acquiring satellites, the half
minute a cold start really takes (here the fix is there at the first second), a
stationary fix wandering by a few meters, multipath, the backup battery. Commands
on RX (UBX or $PUBX) change nothing, so the rate cannot be changed from a
sketch. The geoid separation is always 0.0.