Hey so I have arduino uno and a sim808 with gps antenna and gsm antenna. So here's the sample code:
#include <DFRobot_sim808.h>
#include <SoftwareSerial.h>
#define PIN_TX 3
#define PIN_RX 4
SoftwareSerial mySerial(PIN_TX,PIN_RX);
//DFRobot_SIM808 sim808(&mySerial);//Connect RX,TX,PWR,
DFRobot_SIM808 sim808(&mySerial);
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();
}
}
So I'm always getting a result of "sim808 init error"
I don't know what the problem is but I do hope that the sim808 isn not broken because it has light in STA(status) and in NET(network) that is slowly blinking but there's no light in PPS(gps) I don't know what's the problem I'm really really confused.