Hi,
I am using SparkFun LTE Cat M1/NB-IoT Shield and an Arduino UNO. I need to reset both the shield and Arduino when the cellular connection is lost. Based on my understanding from the Shield Hookup Guide, it seems Pin6 can be used to reset the shield. For this purpose, Pin6 should be HIGH first and then be LOW for more than ten seconds (I am not 100% sure, Please correct me if I am wrong). I am using the code below to reset the shield and Arduino (when the connection is lost) until the cellular connection would be available. To test this idea, I blocked the cellular signal by putting shield/Arduino inside a Faraday/Aluminum cage. But, after bringing them out form the Faraday cage, the connection will be lost forever. How can I solve this issue?
Thank you for your help in advance.
Best,
Abbas
#include <SparkFun_LTE_Shield_Arduino_Library.h>
#include <SD.h>
#include <SPI.h>
// Create a SoftwareSerial object to pass to the LTE_Shield library
SoftwareSerial lteSerial(8, 9);
// Create a LTE_Shield object to use throughout the sketch
LTE_Shield lte;
int resetPin1 = 6;//Pin 6 to reset the LTE shield
unsigned long currentMillis = 0;
void setup() {
Serial.begin(9600);
digitalWrite(resetPin1, HIGH);
delay(200);
if ( lte.begin(lteSerial, 9600) ) {
Serial.println(F("LTE Shield connected!"));
}
Serial.println(F("Type a message. Send a Newline (\\n) to send it..."));
}
void(* resetFunc) (void) = 0; //Arduino UNO reset function
void loop() {
int regStatus = lte.registration(); //Registration status for cellular connection
Serial.println(regStatus);
if (regStatus != 5){ //When the cellular connection is lost
while (currentMillis <= 15000) { //Reset the LTE Shield
digitalWrite(resetPin1, LOW);
currentMillis = millis();
Serial.println(currentMillis);
}
Serial.println("Reseting!"); //Reset the Arduino UNO
delay(1000);
resetFunc(); //call reset
}
}