1

I tried to get the gps coordinates with this program:

#include <DFRobot_sim808.h>
#include <SoftwareSerial.h>
#define PIN_TX 8
#define PIN_RX 7
SoftwareSerial mySerial(PIN_RX,PIN_TX);
DFRobot_SIM808 sim808(&mySerial);//Connect RX,TX,PWR,
//DFRobot_SIM808 sim808(&Serial);
void setup() {
 mySerial.begin(9600);
 Serial.begin(9600);
 //******** Initialize sim808 module *************
 while(!sim808.init()) { 
 delay(1000);
 Serial.print("Sim808 init error\r\n");
 }
 //************* Turn on the GPS power************
 if( sim808.attachGPS())
 Serial.println("Open the GPS power success");
 else 
 Serial.println("Open the GPS power failure");
 
}
void loop() {
 //************** Get GPS data *******************
 if (sim808.getGPS()) {
 Serial.print(sim808.GPSdata.year);
 Serial.print("/");
 Serial.print(sim808.GPSdata.month);
 Serial.print("/");
 Serial.print(sim808.GPSdata.day);
 Serial.print(" ");
 Serial.print(sim808.GPSdata.hour);
 Serial.print(":");
 Serial.print(sim808.GPSdata.minute);
 Serial.print(":");
 Serial.print(sim808.GPSdata.second);
 Serial.print(":");
 Serial.println(sim808.GPSdata.centisecond);
 Serial.print("latitude :");
 Serial.println(sim808.GPSdata.lat);
 Serial.print("longitude :");
 Serial.println(sim808.GPSdata.lon);
 Serial.print("speed_kph :");
 Serial.println(sim808.GPSdata.speed_kph);
 Serial.print("heading :");
 Serial.println(sim808.GPSdata.heading);
 Serial.println();
 //************* Turn off the GPS power ************
 sim808.detachGPS();
 }
}

But when I run it, I'm getting the "Open the GPS power failure" message.

I think my gps is working because If I try with AT commands Im getting a response:

 AT+CGPSSTATUS?
+CGPSSTATUS: Location 3D Fix
OK
AT+CGPSINF=0
+CGPSINF: 0,2543.585143,10018.826326,483.868110,20221118025902.000,19,10,0.509509,266.733459
OK

I even tried to get NMEA info and parse that in python, I was getting my actual position so it seems is working properly.

The problem comes when I tried to use DFRobot_sim808 library or TinyGps libraries.

I would like to know what might be causing this issue or is there a way to parse NMEA info coordinates without using a library?

asked Nov 18, 2022 at 2:49
7
  • this may help ... gpsworld.com/what-exactly-is-gps-nmea-data Commented Nov 18, 2022 at 2:55
  • 1
    are you at a library in Monterrey? Commented Nov 18, 2022 at 3:37
  • Yeah... I was there. How did you get the location? I know I gave them but I want to know how you translate or parse that raw gps info Commented Nov 18, 2022 at 3:49
  • I parsed the NMEA sentence ... 2543.585143,10018.826326 is the latitude and longitude ... 25 degrees 43.585143 minutes ... 100 degrees 18.826326 minutes .... that is 25.72641905, 100.3147721 degrees .... 25°43'35.1"N 100°18'53.2"W goo.gl/maps/2UV2g2qouJ2uWhJaA Commented Nov 18, 2022 at 3:54
  • Okey I understand that you are parsing coordinates in DDDMM.MMMM to a more readible format. But how are you doing that? Are you using a formula, a software, a library or what? I want to know that because I need to capture that info through code Commented Nov 18, 2022 at 4:23

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.