Go Down

Topic: GPS Sensor Data (Read 94 times) previous topic - next topic

architmuchhal

I am working on ESP8266 Arduino with GPS Sensor (GY-NEO-6M-0-001). The code is as below -

Code: [Select]
#include <SoftwareSerial.h>
#include <TinyGPS.h>
 
long lat,lon; // create variable for latitude and longitude object
static const int RXPin = 2, TXPin = 3;
 
SoftwareSerial gpsSerial(RXPin, TXPin); // create gps sensor connection
TinyGPS gps; // create gps object
 
void setup(){
  Serial.begin(9600); // connect serial
  gpsSerial.begin(4800); // connect gps sensor
}
 
void loop(){
  while(gpsSerial.available()){ // check for gps data
   if(gps.encode(gpsSerial.read())){ // encode gps data
    gps.get_position(&lat,&lon); // get latitude and longitude
    // display position
    Serial.print("Position: ");
    Serial.print("lat: ");
    Serial.print(lat);
    Serial.print(" ");// print latitude
    Serial.print("lon: ");
    Serial.println(lon); // print longitude
   }
  }
}



The code was compiled correctly. But this is the output I am able to see on the serial monitor (see the attached picture).

I am not sure as to where the error is present.
Please help!
Thanks!


-dev

Show/describe your wiring.  I wonder if the GPS TX pin is connected to the ESP8266 TX pin instead of pin 2?

The Serial Monitor looks like the wrong baud rate, so maybe it's showing the GPS output.

You might be interested in my NeoGPS.  It's smaller, faster and more accurate than all other libraries.  The example NMEAsimple.ino is similar to your sketch.

Cheers,
/dev

Go Up