Hi all,
I am new to the Blynk platform and don’t have much prior experience with GSM/GPRS/GPS shields. Recently, I have acquired a DFRobot_SIM808 arduino shield, since it supports GSM and GPS which is ideal for my remote wild fire detector project. I have got a sim card on there and I could send SMS messagess and even connect to the Blynk server to transfer sensor readings with the help of the TinyGSM library. However, I am having difficulties to implement the GPS to work with blynk. One of the libraries that I use for this shield is called DFRobot_SIM808 lilbrary, upon loading up the included GetGPS example, I was able to get the latitude and longitude coordinates onto the serial monitor. But the problem is that once I have tried to include the code onto the sketch with Blynk, no coordinates data is shown.
Here is my code:
#include <DFRobot_sim808.h>
#include <SoftwareSerial.h>
#include <TinyGsmClient.h>
#include <BlynkSimpleSIM800.h>
#define TINY_GSM_MODEM_SIM808
#define SerialAT Serial
DFRobot_SIM808 sim808(&Serial);
const char auth[] = "";
const char apn[] = "giffgaff.com";
const char user[] = "giffgaff";
const char pass[] = ""
TinyGsm modem(SerialAT);
DFRobot_SIM808 sim808(&Serial);
void setup()
{
// Set console baud rate
Serial.begin(9600);
delay(10);
// Set GSM module baud rate
SerialAT.begin(9600);
delay(3000);
// Restart takes quite some time
// To skip it, call init() instead of restart()
Serial.println("Initializing modem...");
modem.restart();
String modemInfo = modem.getModemInfo();
Serial.print("Modem: ");
Serial.println(modemInfo);
// Unlock your SIM card with a PIN
//modem.simUnlock("");
Blynk.begin(auth, modem, apn, user, pass);
//Init GPS
//******** 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(){
Blynk.run();
sim808.getGPS();
Serial.print("Latitude :");
Serial.println(sim808.GPSdata.lat);
Serial.print("longitude :");
Serial.println(sim808.GPSdata.lon);
sim808.detachGPS();
}
If anyone can tell me why the data cannot be obtained from the sim808 library, it would be greatly appreciated, thanks!