Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By Stevenelson
#22110 Has anyone experimented with the Neo6m GPS module and the esp?

I'm attempting to get it to work with an esp12. I'm getting data, but something wrong with it. I'm just getting bunch of numbers, I was expecting a series of NMEA strings.

It works with a serial port. So the way I've been doing it is to upload my sketch via my ftdi, then turn off the esp, switch the ftdi's wire from gpio1 (tx) to gpio 2 which is serial1. Then I plug in the gps to gpio1 and gpio3 and fire it up using the tiny++ gps libary.

I was just getting INVALID messages from the tiny++ gps library, so I tried debugging it by just reading the serial data directly. It just looks like this:
149138192223190238642161317432810196185238238731491367212237025548111128140132741961852382387314913672140157168173173253173661731

I was expecting something like this:

$GPGGA,124519,2807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47
$GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47

Does anyone have any suggestions on what I should try?

Steve
User avatar
By Stevenelson
#22118 What I just discovered is that if I plug the gps module right into the ftdi with a 3.3v VCC and open up the serial monitor, I get the NEMA codes i was expecting, like this:

$GPRMC,,V,,,,,,,,,,N*53
$GPVTG,,,,,,,,,N*30
$GPGGA,,,,,,0,00,99.99,,,,,,*48
$GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*30
$GPGLL,,,,,,V,N*64

So that's telling me the gps module itself is working correctly. So either my wiring is wrong on the esp12 or my code is.
User avatar
By Stevenelson
#22120 AWWW yeah! I got it working, thanks to rheslip! Thanks for the help. For anyone interested.... You need http://arduiniana.org/libraries/tinygpsplus/


Code: Select all#include <TinyGPS++.h>
static const uint32_t GPSBaud = 9600;
TinyGPSPlus gps;

void setup() {
  Serial1.begin(115200);
  Serial.begin(GPSBaud, SERIAL_8N1);
 
  Serial1.println("GPS example");
  Serial1.println(TinyGPSPlus::libraryVersion());
}


static char sentence[80],c;  // NMEA sentence from external device
static int line= 0; // data available flag
static int i=0;
static long timer=0;

void loop() {
  readGPS();
}

void readGPS(){
  int j;
  if (Serial.available() > 0) {
    c=Serial.read();
    sentence[i]=c;
    ++i;
    if (c== 0x0d) line=1;
  }
  if (i > 79) i=79;  // line too long
  if (line) {
    for (j=0; j<i;++j) {
      //Serial1.print(sentence[j]);
    }
    Serial1.println(sentence);
    gps.encode(*sentence);
    displayInfo();

    line=i=0; // reset the sentence buffer
  }
}


void displayInfo()
{
  Serial1.print(F("Location: "));
  if (gps.location.isValid())
  {
    Serial1.print(gps.location.lat(), 6);
    Serial1.print(F(","));
    Serial1.print(gps.location.lng(), 6);
  }
  else
  {
    Serial1.print(F("INVALID"));
  }

  Serial1.print(F("  Date/Time: "));
  if (gps.date.isValid())
  {
    Serial1.print(gps.date.month());
    Serial1.print(F("/"));
    Serial1.print(gps.date.day());
    Serial1.print(F("/"));
    Serial1.print(gps.date.year());
  }
  else
  {
    Serial1.print(F("INVALID"));
  }

  Serial1.print(F(" "));
  if (gps.time.isValid())
  {
    if (gps.time.hour() < 10) Serial1.print(F("0"));
    Serial1.print(gps.time.hour());
    Serial1.print(F(":"));
    if (gps.time.minute() < 10) Serial1.print(F("0"));
    Serial1.print(gps.time.minute());
    Serial1.print(F(":"));
    if (gps.time.second() < 10) Serial1.print(F("0"));
    Serial1.print(gps.time.second());
    Serial1.print(F("."));
    if (gps.time.centisecond() < 10) Serial1.print(F("0"));
    Serial1.print(gps.time.centisecond());
  }
  else
  {
    Serial1.print(F("INVALID"));
  }

  Serial1.println();
}
User avatar
By TEwing
#26047 Great to hear! I've been researching a project using the neo-6m, esp8266 and tinygpsplus arduino library. Glad they all work together.