Neo M8N GPS can't show lat and lon

Halo, I use this scetch http://www.iforce2d.net/sketches/gpsTracker.zip but gps can't show lat and lon. some body help me ? I try change TX to RX, RX to TX but can't show lat and lon.

blinking LED lights on the GPS hardness lit. I think GPS is locked. but can not display lat and lon

have you tried outdoor? maybe you don't get a GPS signal where you are (and may be best if your antenna is not under plenty of wires)

J-M-L:
have you tried outdoor? maybe you don't get a GPS signal where you are (and may be best if your antenna is not under plenty of wires)

course, I try in outdoor, and position GPS is locked, but can't show lat and lon

how have you configured the first few lines of the sketch (#define GPS_PORT) and how have you wired your GPS to your Arduino for Software Serial (SoftwareSerial softSerial(6, 7); // RX, TX)?

J-M-L:
how have you configured the first few lines of the sketch (#define GPS_PORT) and how have you wired your GPS to your Arduino for Software Serial (SoftwareSerial softSerial(6, 7); // RX, TX)?

I use this scetch, RX to pin 0, TX to pin 1

Please provide detailed information - the above is useless

the sketch in the link your provided needs customization. Which one did you did (or did not do)?
the hardware wiring needs to match the code expectations. What is wired where? (in details, all the wires)
How is the whole thing powered?

J-M-L:
Please provide detailed information - the above is useless

the sketch in the link your provided needs customization. Which one did you did (or did not do)?
the hardware wiring needs to match the code expectations. What is wired where? (in details, all the wires)
How is the whole thing powered?

I use software serial 6, 7 (RX, TX) for GSM

#define GSM_PORT softSerial // 'softSerial' is a software serial connection declared below (pins 6,7)

and GPS port pin 0, 1 (RX, TX)

#define GPS_PORT Serial // use hardware serial (pins 0,1) for GPS. Remember to disconnect it when uploading the sketch!

If you attach the sketch, I can give you a better answer. Press the "Preview" button to get the complete post editor, the select Attachments and other options in the lower left.

I will guess that you are not using the NeoGPS library. It is the only library that can parse all the sentences that the newest GPS devices send. In your case, the older GPS library is expecting lat/lon in a GPRMC sentence, but the NEO-8M is sending the newer GNRMC or GLRMC sentence. These are called "talker IDs" (see this).

There are other reasons to try NeoGPS:

* It's smaller than all other GPS libraries, sometimes saving thousands of bytes of program space and hundreds of bytes of RAM.

* It's faster, sometimes twice as fast.

* It's more accurate, preserving all the precision provided by the GPS device. All other libraries use floating-point numbers, which can lose some significant digits. Their distance and bearing calculations are also less accurate.

* It's more reliable, because it always uses the NMEA error detection checksum, and can optionally use additional character and field validations. This allows NeoGPS to filter out bad data. All NeoGPS data fields have validity flags for your sketch to use.

* It can be configured to parse only the pieces you actually need, saving even more space and execution time.

* The numerous examples are structured correctly. Many questions here are the result of modifying other libraries' example programs. They are "fragile" WRT to modifications, because they weren't written with that goal in mind.

If you want to try it, NeoGPS is available from the Arduino IDE Library Manager, under the menu Sketch -> Include Library -> Manage Libraries.

It is good that you are using Serial (pins 0 & 1) for the GPS, but I would suggest NOT using SoftwareSerial. SoftwareSerial is very inefficient, because it disables interrupts for long periods of time. This can interfere with other libraries or prevent receiving data on Serial (this could be your problem). It cannot transmit and receive at the same time. You should seriously consider other alternatives. NeoSWSerial is a drop-in replacement for SoftwareSerial, and could use the same pins. AltSoftSerial is better, but it can only use two specific pins -- you would have to move some wires.

Cheers,
/dev

beryindo:
I use software serial 6, 7 (RX, TX) for GSM

#define GSM_PORT softSerial // 'softSerial' is a software serial connection declared below (pins 6,7)

and GPS port pin 0, 1 (RX, TX)

#define GPS_PORT Serial // use hardware serial (pins 0,1) for GPS. Remember to disconnect it when uploading the sketch!

I'm sorry this is not answering my questions... can't help

-dev:
If you attach the sketch, I can give you a better answer. Press the "Preview" button to get the complete post editor, the select Attachments and other options in the lower left.

I will guess that you are not using the NeoGPS library. It is the only library that can parse all the sentences that the newest GPS devices send. In your case, the older GPS library is expecting lat/lon in a GPRMC sentence, but the NEO-8M is sending the newer GNRMC or GLRMC sentence. These are called "talker IDs" (see this).

There are other reasons to try NeoGPS:

* It's smaller than all other GPS libraries, sometimes saving thousands of bytes of program space and hundreds of bytes of RAM.

* It's faster, sometimes twice as fast.

* It's more accurate, preserving all the precision provided by the GPS device. All other libraries use floating-point numbers, which can lose some significant digits. Their distance and bearing calculations are also less accurate.

* It's more reliable, because it always uses the NMEA error detection checksum, and can optionally use additional character and field validations. This allows NeoGPS to filter out bad data. All NeoGPS data fields have validity flags for your sketch to use.

* It can be configured to parse only the pieces you actually need, saving even more space and execution time.

* The numerous examples are structured correctly. Many questions here are the result of modifying other libraries' example programs. They are "fragile" WRT to modifications, because they weren't written with that goal in mind.

If you want to try it, NeoGPS is available from the Arduino IDE Library Manager, under the menu Sketch -> Include Library -> Manage Libraries.

It is good that you are using Serial (pins 0 & 1) for the GPS, but I would suggest NOT using SoftwareSerial. SoftwareSerial is very inefficient, because it disables interrupts for long periods of time. This can interfere with other libraries or prevent receiving data on Serial (this could be your problem). It cannot transmit and receive at the same time. You should seriously consider other alternatives. NeoSWSerial is a drop-in replacement for SoftwareSerial, and could use the same pins. AltSoftSerial is better, but it can only use two specific pins -- you would have to move some wires.

Cheers,
/dev

i'm new in C language, can you give an easier example for parshing timestamp, lat, lon, speed, bearing, altitude, accuracy, batt

Did you look at the examples, like NMEAsimple.ino?

-dev:
Did you look at the examples, like NMEAsimple.ino?

how and where to setting port serial ?

bro -dev, how to show date and time, fix satelite in NMEASimple.ino ? I try DEBUG_PORT.print( fix.satellites() ); but not work

beryindo:
how and where to setting port serial ?

I assume you got this working. There are lots of instructions on the Installation page and in GPSport. Otherwise, ask a specific question and put your code in a post with [code] tags... [/code],

 ... so your code
  shows up in this box.

You can also select the code lines and press the "</>" button in the upper left.

how to show date and time

You can print the complete date/time with the "streaming" operator:

    DEBUG_PORT << fix.dateTime;

If you don't like that format, you can print the fields however you want. A time example is here. Use DEBUG_PORT.print instead of logfile.print.

If you want a different format, the fix.dateTime structure also contains the date fields (see Data Model page):

Data Model:
● a date/time structure (see Time.h), accessed with
º fix.dateTime.year,
º fix.dateTime.month,
º fix.dateTime.date, the day-of-month,
º fix.dateTime.hours,
º fix.dateTime.minutes,
º fix.dateTime.seconds, and
º fix.dateTime.day, the day-of-the-week.

You could print the fix.dateTime.year, month and date in same way as the fix.dateTime.hours, minutes and seconds.

I try DEBUG_PORT.print( fix.satellites() ); but not work

Also from the Data Model page:

● fix.satellites, a satellite count

No parens, just do

    DEBUG_PORT.print( fix.satellites );

how to send post http with interval 5 sec ?

void loop()
{
  while (gps.available( gpsPort )) {
    fix = gps.read();
    if (fix.satellites > 0) {
      GSM_PORT.print("AT+HTTPPARA=\"URL\",\"http://myweb.com/?id=123456789");
      GSM_PORT.print( F("&lat=") );
        GSM_PORT.print( fix.latitude(), 7 );
      GSM_PORT.print( F("&lon=") );
        GSM_PORT.print( fix.longitude(), 7 );
      GSM_PORT.print( F("&timestamp=") );
        GSM_PORT.print(fix.dateTime+946710266); 
      GSM_PORT.print( F("&hdop=") );
        GSM_PORT.print( fix.hdop );
      GSM_PORT.print( F("&altitude=") );
        GSM_PORT.print( fix.altitude() ); 
      GSM_PORT.print( F("&speed=") );
        GSM_PORT.print( fix.speed_kph() );      
      GSM_PORT.println("\""); 
      sendGSM("AT+HTTPACTION=1");
      sendGSM("AT+HTTPPARA=\"CONTENT\",\"application/x-www-form-urlencoded\"");   
  }
}

You can use the fixes as a one-second timer:

uint8_t fixCount = 0;

void loop()
{
  while (gps.available( gpsPort )) {
    fix = gps.read();
    fixCount++;

    if (fixCount >= 5) {
      fixCount = 0; // reset 5-second timer

      if (fix.satellites > 0) {
        GSM_PORT.print("AT+HTTPPARA=\"URL\",\"http://myweb.com/?id=123456789");
          ...

whether to send to server repeatedly / continuously? how to create with interval 5 seconds once to send to server

whether to send to server repeatedly / continuously? how to create with interval 5 seconds once to send to server

Sorry, I don't understand your question.

fix.satellites, a satellite count, how to get total satelit ? I think fix. satellites is lock, I need to total satelit lock and not lock

beryindo:
I need to total satelit lock and not lock

Try the NMEAGSV.ino example. The comments at the top describe how you need to enable the GSV sentence in NMEAGPS_cfg.h, and make sure your M8 is sending them. It sends them by default, but you can check with NMEAorder.ino. You may need to set LAST_SENTENCE to GGA.

The GSV sentences will set the gps.sat_count variable. Only read that variable after you read a new fix.

gps.sat_count tells how many satellites are "visible", and fix.satellites tells how many are locked (tracked).

The NMEAGSV.ino example shows how to access the satellite IDs, azimuth, elevation and signal strength (SNR). They are all stored in the gps.satellites array.

Here is a way to display a table form of the satellites array:

void loop()
{
  while (gps.available( gpsPort )) {
    fix = gps.read();

    TableSatellitesInView();
  }

} // loop

//-----------------

#define CF(x) ((const __FlashStringHelper *) x) // a helper macro for the headers

static const char   NB_HEADER[] PROGMEM  = "nb ";
static const int8_t NBCOL_WIDTH          = sizeof(NB_HEADER)-1;

static const char   SAT_HEADER[] PROGMEM = " id el  az tr ";
static const int8_t SAT_COL_WIDTH        = sizeof(SAT_HEADER)-1;

static const int8_t NBCOL = 7;

void TableSatellitesInView()
{
  int i = 0;

  if (fix.valid.time && fix.valid.date) {
    Serial.print( F("time and date are : ") );
    Serial << fix.dateTime; // this "streaming" operator outputs date and time
    Serial.println();
  }

  Serial.print( CF(NB_HEADER) );
  Serial.print( '|' );
  for ( i=0; i < NBCOL; i++) {
    Serial.print( CF(SAT_HEADER) );
    Serial.print( '|' );
  }
  Serial.println();

  repeat( '-', NBCOL_WIDTH );
  Serial.print( '|' );
  for ( i=0; i < NBCOL; i++) {
    repeat( '-', SAT_COL_WIDTH );
    Serial.print( '|' );
  }
  Serial.println();

  print( gps.sat_count, NBCOL_WIDTH-1 );
  Serial.print( F(" |") );

  for ( i=0; i < gps.sat_count; i++) {
    print( gps.satellites[i].id       , 3 );
    print( gps.satellites[i].elevation, 3 );
    print( gps.satellites[i].azimuth  , 4 );
    if (gps.satellites[i].tracked)
      print( gps.satellites[i].snr, 3 );
    else
      Serial.print( F(" - ") );
    Serial.print( F(" |") );

    if ((i % NBCOL) == (NBCOL-1)) {
      Serial.println();
      repeat( ' ', NBCOL_WIDTH );
      Serial.print( '|' );
    }
  }

  i = (i % NBCOL);
  while (i++ < NBCOL) {
    repeat( ' ', SAT_COL_WIDTH );
    Serial.print( '|' );
  }
  Serial.println();

  repeat( '=', (NBCOL_WIDTH+1) + NBCOL * (SAT_COL_WIDTH+1) );
  Serial.println();

} // TableSatellitesInView

//-----------------
//  Print utilities

static void repeat( char c, int8_t len )
{
  for (int8_t i=0; i<len; i++)
    Serial.write( c );
}

static void print( int32_t val, int8_t len )
{
  char s[16];
  ltoa( val, s, 10 );
  repeat( ' ', len - strlen(s) );
  Serial.print( s );
}

This is a snippet from a long discussion in this thread.