Skip to main content
Arduino

Return to Question

added 1 character in body
Source Link

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

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

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?

added 117 characters in body
Source Link

enter image description here

 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
 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
Source Link

Getting "Open the GPS power failure" on module SIM808

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:

enter image description here

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 why might be causing this issue or is there a way to parse NMEA info coordinates without using a library?

lang-cpp

AltStyle によって変換されたページ (->オリジナル) /