Arduino GSM1400 disconnecting

• Arduino MKR 1400 GSM
• Android 1.1.10(42)
• fra1.blynk.cloud
• Blynk Library 1.0.1

Hello,

I have some trouble with my device loosing connection.
it could stay connected for several days without problems, but after timing out/loosing connection i am having problems connecting again. it will stay connected from a couple of seconds to some minutes…

i need to restart/power cycle to get it going again, but now it it will not stay connected.

tried to change timer interval back and fouth, and changed from port 80 to 8080.
also tried two different simcards and ISP. cell coverage is also decent here.

Device powered with a 5V reg and a lipo.

//#define BLYNK_DEBUG
#define BLYNK_PRINT Serial
#define BLYNK_TEMPLATE_ID "TMPLnbY3UnYY"
#define BLYNK_DEVICE_NAME "Trykksensor"

#define BME_SCK 13
#define BME_MISO 12
#define BME_MOSI 11
#define BME_CS 10

#include <Wire.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
#include <MKRGSM.h>
#include <BlynkSimpleMKRGSM.h>

#define BME_SCK 13
#define BME_MISO 12
#define BME_MOSI 11
#define BME_CS 10

#define SEALEVELPRESSURE_HPA (1013.25)

Adafruit_BME280 bme; // I2C
//Adafruit_BME280 bme(BME_CS); // hardware SPI
//Adafruit_BME280 bme(BME_CS, BME_MOSI, BME_MISO, BME_SCK); // software SPI
float pressure;     //To store the barometric pressure (Pa)
float temperature;  //To store the temperature (oC)
float humidity;

GSMClient client;
GPRS gprs;
GSM gsmAccess;
BlynkTimer timer;

char auth[] = "Z5q0dNb3PRiNEmZoEIt0ONA2ZEBwvQrw";
char pin[] = "4013";
char apn[]  = "internet.public";
char user[] = "";
char pass[] = "";


void sendAnalog()
{
float sensorData =(float)analogRead(A1) * (6.00 / 1023.00);
Blynk.virtualWrite(V5,sensorData); //sending to Blynk
Serial.println(sensorData);
Serial.println();

int sensorValue = analogRead(ADC_BATTERY);
float voltage = sensorValue * (4.30 / 1023.00);
//float battery = (voltage-3.50)/0.70*100.00);
Blynk.virtualWrite(V7,voltage);
Serial.print(voltage);
Serial.println("V");
}


void ReadSensors()
{
  pressure = bme.readPressure();
  temperature = bme.readTemperature();
  humidity = bme.readHumidity ();

  Blynk.virtualWrite(V1, pressure/100);
  Blynk.virtualWrite(V2, temperature);
  Blynk.virtualWrite(V6, humidity);

  Serial.print("Temperature = ");
  Serial.print(temperature);
  Serial.println(" °C");

  Serial.print("Pressure = ");
  Serial.print(pressure/100);
  Serial.println(" kPa");

  Serial.print("Humidity = ");
  Serial.print(humidity);
  Serial.println(" %");

    Serial.println();
}    


void setup()
{
  //Debug console
  Serial.begin(9600);
  //"46.101.217.214", 8080); 
 
Blynk.begin(auth, gsmAccess, gprs, client, pin, apn, user, pass); 

timer.setInterval(2000L, ReadSensors);
timer.setInterval(2090L, sendAnalog);
 


  
Serial.println(F("BME280 test"));

    unsigned status;
    
    //default settings
    status = bme.begin();  
    //You can also pass in a Wire library object like &Wire2
    //status = bme.begin(0x76, &Wire2)
   if (!status) {
        Serial.println("Could not find a valid BME280 sensor, check wiring, address, sensor ID!");
        Serial.print("SensorID was: 0x"); Serial.println(bme.sensorID(),16);
        Serial.print("        ID of 0xFF probably means a bad address, a BMP 180 or BMP 085\n");
        Serial.print("   ID of 0x56-0x58 represents a BMP 280,\n");
        Serial.print("        ID of 0x60 represents a BME 280.\n");
        Serial.print("        ID of 0x61 represents a BME 680.\n");
        while (1) delay(10);
    }
    
    Serial.println("-- Default Test --");

    Serial.println();
}

void loop()
{
  //this start the blynk utilities and make run the iteration with the app
  Blynk.run();
  timer.run();
}




Here are some lines from the serial monitor

22:13:35.882 → [14327] Connecting to internet.public …
22:13:38.204 → [16656] Connected to GPRS
22:13:38.204 → [16656] Connecting to blynk.cloud:80
22:13:39.039 → [17501] <[1D|00|01|00] Z5q0dNb3PRiNEmZoEIt0ONA2ZEBwvQrw
22:13:39.316 → [17795] >[00|00|01|00|C8]
22:13:39.316 → [17796] Ready (ping: 268ms).
22:13:39.316 → [17797] Free RAM: 26815
22:13:39.409 → [17883] <[11|00|02|00|86]ver[00]1.0.0-beta.3[00]h-beat[00]60[00]buff-in[00]1024[00]dev[00]MKR GSM 1400[00]con[00]MKRGSM[00]fw-type[00]TMPLnbY3UnYY[00]build[00]Aug 20 2021 15:14:18[00]tmpl[00]TMPLnbY3UnYY[00]

22:13:39.502 → BME280 test
22:13:39.642 → – Default Test –
22:13:39.642 →
22:13:39.688 → [18138] >[00|00|02|00|C8]
22:13:41.596 → [20067] <[14|00|03|00|0D]vw[00]1[00]1011.679
22:13:41.736 → [20179] <[14|00|04|00|0B]vw[00]2[00]25.370
22:13:41.827 → [20291] <[14|00|05|00|0B]vw[00]6[00]40.983
22:13:41.874 → Temperature = 25.37 °C
22:13:41.874 → Pressure = 1011.68 kPa
22:13:41.874 → Humidity = 40.98 %
22:13:41.874 →
22:13:42.013 → [20471] <[14|00|06|00|0A]vw[00]5[00]0.147
22:13:42.013 → 0.15
22:13:42.013 →
22:13:42.105 → [20582] <[14|00|07|00|0A]vw[00]7[00]3.716
22:13:42.151 → 3.72V
22:13:43.639 → [22095] <[14|00|08|00|0D]vw[00]1[00]1011.666
22:13:43.733 → [22209] <[14|00|09|00|0B]vw[00]2[00]25.350
22:13:43.875 → [22322] <[14|00|0A|00|0B]vw[00]6[00]40.994
22:13:43.875 → Temperature = 25.35 °C
22:13:43.875 → Pressure = 1011.67 kPa
22:13:43.875 → Humidity = 40.99 %
22:13:43.875 →
22:13:44.016 → [22501] <[14|00|0B|00|0A]vw[00]5[00]0.141
22:13:44.060 → 0.14
22:13:44.060 →
22:13:44.153 → [22613] <[14|00|0C|00|0A]vw[00]7[00]3.762
22:13:44.153 → 3.76V
22:14:04.966 → Temperature = 25.34 °C
22:14:04.966 → Pressure = 1011.66 kPa
22:14:04.966 → Humidity = 41.02 %
22:14:05.014 →
22:14:05.014 → 0.14
22:14:05.014 →
22:14:05.014 → 3.86V
22:14:05.481 → Temperature = 25.34 °C
22:14:05.481 → Pressure = 1011.67 kPa
22:14:05.481 → Humidity = 41.03 %
22:14:05.481 →
22:14:05.899 → 0.14
22:14:05.899 →
22:14:05.899 → 3.86V
22:14:07.514 → Temperature = 25.33 °C
22:14:07.514 → Pressure = 1011.64 kPa
22:14:07.514 → Humidity = 41.04 %
22:14:07.514 →
22:14:07.930 → 0.14
22:14:07.930 →
22:14:07.930 → 3.86V
22:14:09.507 → Temperature = 25.34 °C
22:14:09.507 → Pressure = 1011.69 kPa
22:14:09.507 → Humidity = 41.05 %
22:14:09.507 →
22:14:09.966 → 0.13
22:14:09.966 →
22:14:09.966 → 3.86V
22:14:09.966 → [48457] Connecting to blynk.cloud:80

—power cycle or restart—

22:52:28.079 → [14331] Connecting to internet.public …
22:52:30.598 → [16860] Connected to GPRS
22:52:30.598 → [16860] Connecting to 46.101.217.214:8080
22:52:31.346 → [17622] Ready (ping: 290ms).
22:52:31.533 → BME280 test
22:52:31.673 → – Default Test –
22:52:31.673 →
22:52:33.911 → Temperature = 25.42 °C
22:52:33.911 → Pressure = 1012.01 kPa
22:52:33.911 → Humidity = 39.69 %
22:52:33.911 →
22:52:34.096 → 0.14
22:52:34.096 →
22:52:34.189 → 3.75V
22:52:35.913 → Temperature = 25.43 °C
22:52:35.913 → Pressure = 1012.05 kPa
22:52:35.913 → Humidity = 39.68 %
22:52:35.913 →
22:52:36.101 → 0.14
22:52:36.101 →
22:52:36.195 → 3.88V
22:52:37.872 → Temperature = 25.42 °C
22:52:37.872 → Pressure = 1011.99 kPa
22:52:37.872 → Humidity = 39.68 %
22:52:37.872 →
22:52:38.058 → 0.14
22:52:38.058 →
22:52:38.152 → 3.87V
22:52:39.923 → Temperature = 25.42 °C
22:52:39.923 → Pressure = 1012.03 kPa
22:52:39.923 → Humidity = 39.70 %
22:52:39.923 →
22:52:40.063 → 0.13
22:52:40.063 →
22:52:40.202 → 3.88V
22:52:41.878 → Temperature = 25.42 °C
22:52:41.878 → Pressure = 1012.04 kPa
22:52:41.878 → Humidity = 39.71 %
22:52:41.878 →
22:52:42.113 → 0.14
22:52:42.113 →
22:52:42.207 → 3.76V
22:52:43.886 → Temperature = 25.42 °C
22:52:43.886 → Pressure = 1012.02 kPa
22:52:43.886 → Humidity = 39.69 %
22:52:43.886 →
22:52:44.211 → 0.14
22:52:44.211 →
22:52:44.304 → 3.77V
22:52:45.940 → Temperature = 25.42 °C
22:52:45.940 → Pressure = 1012.00 kPa
22:52:45.940 → Humidity = 39.69 %
22:52:45.940 →
22:52:46.312 → 0.13
22:52:46.312 →
22:52:46.406 → 3.75V
22:52:47.856 → Temperature = 25.42 °C
22:52:47.856 → Pressure = 1012.00 kPa
22:52:47.856 → Humidity = 39.68 %
22:52:47.856 →
22:52:48.368 → 0.15
22:52:48.368 →
22:52:48.507 → 3.82V
22:52:49.910 → Temperature = 25.42 °C
22:52:49.910 → Pressure = 1011.99 kPa
22:52:49.910 → Humidity = 39.67 %
22:52:49.910 →
22:52:50.469 → 0.13
22:52:50.469 →
22:52:50.608 → 3.76V
22:52:51.867 → Temperature = 25.42 °C
22:52:51.867 → Pressure = 1012.03 kPa
22:52:51.867 → Humidity = 39.67 %
22:52:51.867 →
22:52:52.568 → 0.15
22:52:52.568 →
22:52:52.708 → 3.73V
22:52:53.878 → Temperature = 25.42 °C
22:52:53.878 → Pressure = 1012.02 kPa
22:52:53.878 → Humidity = 39.67 %
22:52:53.878 →
22:52:54.678 → 0.14
22:52:54.678 →
22:52:54.771 → 3.73V
22:52:55.846 → Temperature = 25.43 °C
22:52:55.846 → Pressure = 1012.00 kPa
22:52:55.846 → Humidity = 39.67 %
22:52:55.846 →
22:52:56.778 → 0.14
22:52:56.778 →
22:52:56.871 → 3.75V
22:52:57.900 → Temperature = 25.42 °C
22:52:57.900 → Pressure = 1011.99 kPa
22:52:57.900 → Humidity = 39.67 %
22:52:57.900 →
22:52:58.784 → 0.18
22:52:58.784 →
22:52:58.923 → 3.76V
22:52:59.853 → Temperature = 25.43 °C
22:52:59.853 → Pressure = 1012.00 kPa
22:52:59.853 → Humidity = 39.67 %
22:52:59.853 →
22:53:19.916 → Temperature = 25.43 °C
22:53:19.916 → Pressure = 1012.04 kPa
22:53:19.916 → Humidity = 39.68 %
22:53:19.916 →
22:53:19.916 → 0.15
22:53:19.916 →
22:53:19.916 → 3.88V
22:53:21.456 → Temperature = 25.43 °C
22:53:21.456 → Pressure = 1012.03 kPa
22:53:21.456 → Humidity = 39.68 %
22:53:21.456 →
22:53:21.640 → 0.14
22:53:21.640 →
22:53:21.640 → 3.88V
22:53:23.458 → Temperature = 25.43 °C
22:53:23.458 → Pressure = 1012.04 kPa
22:53:23.458 → Humidity = 39.68 %
22:53:23.458 →
22:53:23.739 → 0.15
22:53:23.739 →
22:53:23.739 → 3.88V
22:53:24.907 → [71247] Connecting to 46.101.217.214:8080

I did try the same sketch on a MKR NB1500, with almost the same result.

any ideas?

22:00:55.061 → [2663704] Heartbeat timeout
22:01:05.068 → Temperature = 24.16 °C
22:01:05.068 → Pressure = 1002.69 kPa
22:01:05.068 → Humidity = 47.34 %
22:01:05.068 →
22:01:05.068 → 2.31
22:01:05.068 →
22:01:05.068 → 4.12V
22:01:05.068 → [2673732] Connecting to 46.101.217.214:8080