Disconnecting after sometime

Hello all,
I am working on a tracking device with sim808 module and arduino mini pro. Arduino pro mini reads the gps location and sends it to blynk widget map on my android mobile.
The device is showing online on map but after sometime it will go offline and only getting online after reset. The location showing in map is wrong too… my blynk lib version is v1.0.0 beta 3.
here’s the code i am using…
“”
#define BLYNK_PRINT Serial
#define TINY_GSM_MODEM_SIM800
#include <TinyGsmClient.h>
#include <BlynkSimpleTinyGSM.h>
char auth[] = “myauth”;
char apn[] = “YourAPN”;
char user[] = “”;
char pass[] = “”;
WidgetMap myMap(V1);
WidgetTerminal terminal(V2);
BLYNK_WRITE(V2)
#include <SoftwareSerial.h>
SoftwareSerial SerialAT(7, 8); // RX, TX
TinyGsm modem(SerialAT);
String data[5];
#define DEBUG true
String state,timegps,latitude,longitude;
void setup() {
Serial.begin(9600);
delay(10);

// Set GSM module baud rate
SerialAT.begin(9600);
delay(3000);
Serial.println(“Initializing modem…”);
// modem.restart();
sendData(“AT+CGPSPWR=1”,1000,DEBUG);
delay(50);
sendData(“AT+CGPSRST=0”,1000,DEBUG);
delay(2000);
sendData(“AT+CGNSPWR=1”,1000,DEBUG);
delay(50);
sendData(“AT+CGNSSEQ=RMC”,1000,DEBUG);
delay(30000);

Blynk.begin(auth, modem, apn, user, pass);

}

void loop()
{
sendTabData(“AT+CGNSINF”,1000,DEBUG);
if (state !=0) {
//Serial.println(“State :”+state);
//Serial.println(“Time :”+timegps);
Serial.println(“Latitude :”+latitude);
Serial.println(“Longitude :”+longitude);

 int index = 0;

// double lat = 9.9832279;
// double lon = 76.29089276;

myMap.location(index, lat, lon, “value”);

Blynk.run();

}
}
void sendTabData(String command , const int timeout , boolean debug){

SerialAT.println(command);
long int time = millis();
int i = 0;

while((time+timeout) > millis()){
while(SerialAT.available()){
char c = SerialAT.read();
if (c != ‘,’) {
data[i] +=c;
delay(100);
} else {
i++;
}
if (i == 5) {
delay(100);
goto exitL;
}
}
}exitL:
if (debug) {
state = data[1];
timegps = data[2];
latitude = data[3];
longitude =data[4];
}
}
String sendData (String command , const int timeout ,boolean debug){
String response = “”;
SerialAT.println(command);
long int time = millis();
int i = 0;

while ( (time+timeout ) > millis()){
while (SerialAT.available()){
char c = SerialAT.read();
response +=c;
}
}
if (debug) {
Serial.print(response);
}
return response;
}
“”

So, when you created this topic, it was pre-populated with this text…

Before creating the topic

  1. Search forum for similar topics
  2. Check http://docs.blynk.cc and http://help.blynk.cc/
  3. Add details :
    • Hardware model + communication type. For example: Arduino UNO with Ethernet Shield
    • Smartphone OS (iOS or Android) + version
    • Blynk server or local server
    • Blynk Library version
    • Add your sketch code. :point_up:Code should be formatted as example below.

Simply paste your code between ``` If you don’t format your code, your topic can be deleted by moderators.

```

void loop()

```

How about providing the information that was requested?

Pete.