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:

When I turn on the gps there is an led that starts blinking every second, I don't know if that is a good or bad signal, maybe it should be blinking every 3 seconds like the other led indicating the SIM connectivity?

Any idea or suggestion is welcome!

Okey now I am not very sure if my gps antena is working.

I tried to use the gps commands without having connected the antena and I was getting the same response


I should be getting a lot of 0 in the location info, right?

Or is there a way to actually test if the gps antena is working? Because the module is responding the gps commands without it

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.