Arduino cloud does not reconnect on connection lost

Using board MKR NB 1500 & MKR GPS Shield (as shield not i2c).
So if you lose signal thats it? What are you supposed to do?
Whole day at home working fine. I go put the device in the car and drive around, does its updates to arduino cloud proper.

Obviously i hit an area with poor cell signal and i get the following error messages:

18:33:48.323 -> ArduinoIoTCloudTCP::handle_Disconnect MQTT client connection lost
18:33:48.323 -> Disconnected from Arduino IoT Cloud
18:33:48.459 -> GPRS.isAccessAlive(): 0
18:33:48.459 -> Disconnected from cellular network
18:35:01.085 -> SIM not present or wrong PIN

Sure, makes sense. But now i arrive back to good areas, including back home. The board does not reconnect at all... I wait an hour still nothing.

My sketch looks like this:

#include <MKRNB.h>
#include <SparkFun_u-blox_GNSS_Arduino_Library.h>
SFE_UBLOX_GNSS myGNSS;

#include "GPS.h"

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
  digitalWrite(LED_BUILTIN, HIGH);

  // initialize serial communications and wait for port to open:
  Serial.begin(9600);

  //Assume that the U-Blox GNSS is running at 9600 baud (the default) or at 38400 baud.
  //Loop until we're in sync and then ensure it's at 38400 baud.
  do {
    Serial.println("GNSS: trying 38400 baud");
    Serial1.begin(38400);
    if (myGNSS.begin(Serial1) == true) break;

    delay(100);
    Serial.println("GNSS: trying 9600 baud");
    Serial1.begin(9600);
    if (myGNSS.begin(Serial1) == true) {
        Serial.println("GNSS: connected at 9600 baud, switching to 38400");
        myGNSS.setSerialRate(38400);
        delay(100);
    } else {
        //myGNSS.factoryReset();
        delay(2000); //Wait a bit before trying again to limit the Serial output
    }
  } while(1);
  Serial.println("GNSS serial connected");

  myGNSS.setUART1Output(COM_TYPE_UBX); //Set the UART port to output UBX only
  myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
  myGNSS.saveConfiguration(); //Save the current settings to flash and BBR

  initProperties();
  ArduinoCloud.begin(ArduinoIoTPreferredConnection, false); //disable watchdog
  setDebugMessageLevel(DBG_VERBOSE);
  ArduinoCloud.printDebugInfo();

  digitalWrite(LED_BUILTIN, LOW);
}

void UpdateCloudGPS() {
  digitalWrite(LED_BUILTIN, HIGH);

  float latitude = float(myGNSS.getLatitude()) / 10000000.f;
  float longitude = float(myGNSS.getLongitude()) / 10000000.f;
  long speed = myGNSS.getGroundSpeed();

  if(ArduinoCloud.connected()) {
    location = Location(latitude, longitude);
  }

  digitalWrite(LED_BUILTIN, LOW);
}

void loop() {
  int DelayTime = 300000; //5min

  if(millis() >= NextUpdateTime) {
    UpdateCloudGPS();
    NextUpdateTime = millis() + DelayTime;
  }

  ArduinoCloud.update();
}

I reset the board manually by hitting the reset button and same issue.
Unplug / replug board in and it works again.

I re-enabled watchdog, will try again tomorrow and see what happens. Im too scared to pull the antenna off while the thing is running to test signal loss.

I see outages from time to time but I always get reconnected. My setup code was written by the cloud. I only added one statement to invoke my function to initialize my sensors. I left the connectivity to the cloud as I suspect that works. I helped another fellow earlier and he had a similar setup as you. He removed all the code he wrote other than a single call to sensor inits and now he is running fine.

Its only arduino cloud. I get NTP errors and then it never reconnects.

TimeServiceClass::getRemoteTime cannot get time from NTP, fallback on connection handler
TimeServiceClass::getRemoteTime cannot get time from connection handler
ArduinoIoTCloudTCP::handle_SyncTime could not get valid time. Retrying now.

However running a modified TestGPRS example (so it loops on its own), handles disconnects just fine.

I think i have to ditch Arduino Cloud. Its been such a headache, from being forced to ditch LowPower functionality to sensitivity to invalid gps cords due to i2c connection... and now super sensitive to disconnects...

Went with thingsboard solution not a single hiccup... cheaper too. Arduino cloud is so difficult to work with. So many issues. What a waste of $50. I really tried to make it work.
Too bad its nonrefundable.

Maybe ill write up a guide sometime in the future... wont be posted here, for obvious reasons.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.