DFRobot_SIM808 GSM/GPRS/GPS ARduino shield, GPS not working

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!

Can you see gps data without Blynk?

Also your main loop seems pretty strange to me, but I never worked with GPS before

Yeah I was able to get GPS data without blynk. Could it be the issue of serial data communication?
As I used hardware serial to communicate between the GPS shield and arduino, does blynk uses serial to obtain data from the arduino as well?

Yes… although how directly or indirectly depends on the way you have connected the Arduino… what type of Arduino and possibly a few other factors.

There is another similar topic going on right now wherein the issue may be multiple simultaneous SoftwareSerial connections (they don’t work).

You have a lot of serial prints, which means you are using your Arduino’s primary serial port for that… so assuming you are are you connecting to the Blynk server through the GSM module, then it must be using Software Serial… And then of course you would need to be using some form of serial for your GPS.

So, basically, depending on the hardware you are using, you may not be able to run Blynk, GSM and GPS at the same time.

Thanks for your reply. In my code, both the blynk and the GSM+GPS module are setted up to use hardware serial to communicate with my Arduino Uno. I presume this wouldn’t work as the RX/TX pins could be be occupied by either communication between GSM+ blynk server/GPS+arduino, so they could not establish a simultaneous link with both of them at the same time. Would this be a correct assumption?
If it is, it is possible to be solved with the altsoftserial library, so that they use different pins for communication?

Correct.

Certainly worth looking at.

You might also want to consider an upgrade to your MCU. ESP’s are considerably better at iOT than Arduino’s.

If you correct code means show me the code., It’s to much time take to along 808 a + GPS + Arduino