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.