ublox NEO6MV2 / uno r3 sketch/library

I have an ublox neo-6m (gy-gps6mv2) & an Uno r3.

http://www.ebay.com/itm/GY-NEO6MV2-Flight-Controller-GPS-Module-For-Arduino-EEPROM-MWC-APM-2-5-/390647042336?pt=LH_DefaultDomain_0&hash=item5af460d120

I have it connected as such;
uno - gps
tx - rx
rx - tx
5v - vcc
gnd - gnd

getting a blinking green led on the gps.

Question(s)

  1. which sketch (library) would be the easiest to implement for testing & compiling data?
  2. what would i need to edit (if any) to get it communicating.

fyi, I am no stranger to electronics but new to arduino however I have been reading as much as possible to understand the basics.

thanks

Shawn

I am now able to receive lat / long data after following the sketch I found here;

and making the following pin changes;

The red lead goes from 3.3V Arduino to 3.3V GPS Module
The black lead, GND to GND
The yellow lead Arduino Pin 10 to TX on the GPS Module

also using

#include <SoftwareSerial.h>

I am interested in editing this sketch to include all the gps data capable of being gathered so I would appreciate any help that could be sent my way.

I am interested in editing this sketch to include all the gps data capable of being gathered so I would appreciate any help that could be sent my way.

You could use the TinyGPS library. Or you could print the data received, and see what is present that you are not currently extracting, and add code to extract that. It's hard to offer much more advice without knowing what kind of sentences you are receiving, and what output you are getting.

currently I am trying to fine tune Tinygps with my uno r3 but I am not sure what pin(s) on my arduino to use. My gps has only 4 pins - vcc, gnd, tx & rx and a baud rate of 9600 which I have changed below. I do not get any errors compiling or uploading to the uno however I only get ******* when I check the serial monitor under the below headings.


#include <SoftwareSerial.h>

#include <TinyGPS.h>

/* This sample code demonstrates the normal use of a TinyGPS object.
It requires the use of SoftwareSerial, and assumes that you have a
4800-baud serial GPS device hooked up on pins 3(rx) and 4(tx).
*/

TinyGPS gps;
SoftwareSerial nss(3, 4);

static void gpsdump(TinyGPS &gps);
static bool feedgps();
static void print_float(float val, float invalid, int len, int prec);
static void print_int(unsigned long val, unsigned long invalid, int len);
static void print_date(TinyGPS &gps);
static void print_str(const char *str, int len);

void setup()
{
Serial.begin(9600);
nss.begin(9600);

Serial.print(“Testing TinyGPS library v. “); Serial.println(TinyGPS::library_version());
Serial.println(“by Mikal Hart”);
Serial.println();
Serial.print(“Sizeof(gpsobject) = “); Serial.println(sizeof(TinyGPS));
Serial.println();
Serial.println(“Sats HDOP Latitude Longitude Fix Date Time Date Alt Course Speed Card Distance Course Card Chars Sentences Checksum”);
Serial.println(” (deg) (deg) Age Age (m) — from GPS ---- ---- to London ---- RX RX Fail”);
Serial.println(”--------------------------------------------------------------------------------------------------------------------------------------”);
}

void loop()
{
bool newdata = false;
unsigned long start = millis();

// Every second we print an update
while (millis() - start < 1000)
{
if (feedgps())
newdata = true;
}

gpsdump(gps);
}

static void gpsdump(TinyGPS &gps)
{
float flat, flon;
unsigned long age, date, time, chars = 0;
unsigned short sentences = 0, failed = 0;
static const float LONDON_LAT = 51.508131, LONDON_LON = -0.128002;

print_int(gps.satellites(), TinyGPS::GPS_INVALID_SATELLITES, 5);
print_int(gps.hdop(), TinyGPS::GPS_INVALID_HDOP, 5);
gps.f_get_position(&flat, &flon, &age);
print_float(flat, TinyGPS::GPS_INVALID_F_ANGLE, 9, 5);
print_float(flon, TinyGPS::GPS_INVALID_F_ANGLE, 10, 5);
print_int(age, TinyGPS::GPS_INVALID_AGE, 5);

print_date(gps);

print_float(gps.f_altitude(), TinyGPS::GPS_INVALID_F_ALTITUDE, 8, 2);
print_float(gps.f_course(), TinyGPS::GPS_INVALID_F_ANGLE, 7, 2);
print_float(gps.f_speed_kmph(), TinyGPS::GPS_INVALID_F_SPEED, 6, 2);
print_str(gps.f_course() == TinyGPS::GPS_INVALID_F_ANGLE ? "*** " : TinyGPS::cardinal(gps.f_course()), 6);
print_int(flat == TinyGPS::GPS_INVALID_F_ANGLE ? 0UL : (unsigned long)TinyGPS::distance_between(flat, flon, LONDON_LAT, LONDON_LON) / 1000, 0xFFFFFFFF, 9);
print_float(flat == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : TinyGPS::course_to(flat, flon, 51.508131, -0.128002), TinyGPS::GPS_INVALID_F_ANGLE, 7, 2);
print_str(flat == TinyGPS::GPS_INVALID_F_ANGLE ? "*** " : TinyGPS::cardinal(TinyGPS::course_to(flat, flon, LONDON_LAT, LONDON_LON)), 6);

gps.stats(&chars, &sentences, &failed);
print_int(chars, 0xFFFFFFFF, 6);
print_int(sentences, 0xFFFFFFFF, 10);
print_int(failed, 0xFFFFFFFF, 9);
Serial.println();
}

static void print_int(unsigned long val, unsigned long invalid, int len)
{
char sz[32];
if (val == invalid)
strcpy(sz, “*******”);
else
sprintf(sz, “%ld”, val);
sz[len] = 0;
for (int i=strlen(sz); i<len; ++i)
sz = ’ ';

  • if (len > 0)*
  • sz[len-1] = ’ ';*
  • Serial.print(sz);*
  • feedgps();*
    }
    static void print_float(float val, float invalid, int len, int prec)
    {
  • char sz[32];*
  • if (val == invalid)*
  • {*
    _ strcpy(sz, “*******”);_
  • sz[len] = 0;*
  • if (len > 0)*
  • sz[len-1] = ’ ';*
  • for (int i=7; i<len; ++i)*
    _ sz = ’ ';_
    * Serial.print(sz);*
    * }*
    * else*
    * {*
    * Serial.print(val, prec);*
    * int vi = abs((int)val);*
    * int flen = prec + (val < 0.0 ? 2 : 1);*
    * flen += vi >= 1000 ? 4 : vi >= 100 ? 3 : vi >= 10 ? 2 : 1;*
    * for (int i=flen; i<len; ++i)*
    * Serial.print(" ");*
    * }*
    * feedgps();*
    }
    static void print_date(TinyGPS &gps)
    {
    * int year;*
    * byte month, day, hour, minute, second, hundredths;*
    * unsigned long age;*
    * gps.crack_datetime(&year, &month, &day, &hour, &minute, &second, &hundredths, &age);
    if (age == TinyGPS::GPS_INVALID_AGE)
    _ Serial.print("****** ******* ");
    * else*
    * {*
    * char sz[32];*
    * sprintf(sz, "%02d/%02d/%02d %02d:%02d:%02d ",*
    * month, day, year, hour, minute, second);*
    * Serial.print(sz);*
    * }*
    * print_int(age, TinyGPS::GPS_INVALID_AGE, 5);
    _
    feedgps();*

    }
    static void print_str(const char str, int len)
    _
    {_
    _
    int slen = strlen(str);_
    _
    for (int i=0; i<len; ++i)_
    _ Serial.print(i<slen ? str : ’ ');
    feedgps();
    }
    static bool feedgps()
    {
    while (nss.available())
    {
    if (gps.encode(nss.read()))
    return true;
    }
    return false;
    }*_

currently I am trying to fine tune Tinygps with my uno r3 but I am not sure what pin(s) on my arduino to use.

TinyGPS collects and manipulates data. It does not use any pins.

The nss instance of SoftwareSerial is what you are using to read from the GPS, so that really should provide a clue as to where to connect the TX and RX pins of the GPS. If you still have them connected to pins 0 and 1, I'm curious what you expect the GPS to do with all the stuff you are sending it.

Thanks for the tip! I am now getting all the data I was looking for.

Sats HDOP Latitude Longitude Fix Date Time Date Alt Course Speed Card Distance Course Card Chars Sentences Checksum
(deg) (deg) Age Age (m) --- from GPS ---- ---- to London ---- RX RX Fail

6 122 39.92055 -104.94356348 01/18/2014 01:28:53 376 1595.80 0.00 0.26 N 7524 40.58 NE 615 2 9
6 122 39.92054 -104.94358422 01/18/2014 01:28:54 453 1596.00 0.00 0.87 N 7524 40.58 NE 1092 4 14
6 122 39.92054 -104.94358496 01/18/2014 01:28:55 527 1596.10 0.00 0.61 N 7524 40.58 NE 1569 6 20

thanks for your help.

I am now getting all the data I was looking for.

Yeah!

I have the same problem.. I am getting all ******** what did you actually do to make it work please?

Never mind just started to function by it self after a while.... curios ...

lol Its true, I am not understanding exactly what is happening. I am more used to python then to C++ and in python this would have worked perfectly. An other curios thing is that the array generator function must be a pointer.. I cant understand why. I made it like that cause an error message said so.,.

? don't understand which ports must be used :frowning:

i connect

3.3V to Vcc
Gnd to Gnd
digital-3 to rx
digital-4 to tx but only i get

ats HDOP Latitude Longitude Fix Date Time Date Alt Course Speed Card Distance Course Card Chars Sentences Checksum
(deg) (deg) Age Age (m) --- from GPS ---- ---- to London ---- RX RX Fail

**** **** ******* ******* **** ******* ******* **** ******* ****** ***** *** 0 0.00 *** 263 0 2
**** **** ******* ******* **** ******* ******* **** ******* ****** ***** *** 0 0.00 *** 425 0 2
**** **** ******* ******* **** ******* ******* **** ******* ****** ***** *** 0 0.00 *** 587 0 2
**** **** ******* ******* **** ******* ******* **** ******* ****** ***** *** 0 0.00 *** 749 0 2
**** **** ******* ******* **** ******* ******* **** ******* ****** ***** *** 0 0.00 *** 911 0 2

i connect

3.3V to Vcc
Gnd to Gnd
digital-3 to rx
digital-4 to tx but only i get

With what code?

TinyGPS's sample program i guess..

Did you forget to change ss.begin(4800); to ss.begin(9600); ?

This was the case for me, and i was getting all stars :slight_smile:

Still misses some values but;

**** **** 40.899703 29.177904 524 10/28/2014 21:01:30 570 ****** 0.00 0.63 N 2522 307.79 NW 1650 4 17
**** **** 40.899707 29.177898 538 10/28/2014 21:01:31 584 ****** 0.00 0.80 N 2522 307.79 NW 2016 5 21

When you have a U-blox GPS, you can use U-center programm (from the same website)
to view and programm the GPS-parameters. It's working via serial port. I use an Atmega
for that as repeater (with an Arduino standard programm).

U-blox has no 1PPS connection....Yes, it has but it is not bring
to the outside. You only need to solder a small wire between
the IC outputpin corresponding to the LED circuit.

Always use the GPS with a 3.3V/5V level shifter. For rx-data
it is not so problem, But when tx'ing data to the GPS you
put 5V on it.