MKR GSM 1400 - Arduino IoT Cloud LowPower freeze hangs

Dear all,
I'm working on a MKR 1400 coupled with Arduino_IoT_Cloud library.
Basically, the sketch created by the IoT Cloud interface from the web.

It works correctly, collecting data from sensor and updating the iot variables.
Now I wanted to put it in sleep for 1 minute.

Here my oversimplified code, but

#include <ArduinoLowPower.h>

const int RTC_INT = 5;
bool connected = false;

void setup() {
  pinMode(RTC_INT, INPUT_PULLUP);
  LowPower.attachInterruptWakeup(RTC_INT, alarmEvent0, RISING);
  ArduinoCloud.addCallback(ArduinoIoTCloudEvent::CONNECT, &onConnect);
  ...
}

void loop() {
  ArduinoCloud.update();
  Serial.print(".");
  air_temp = 10.0;
  if (connected) {
    LowPower.sleep(60000);
  }
}


void onConnect() {
  delay(200);
  connected = true;
}


void alarmEvent0() {
  Serial.println("Awaken!!!");
}

all my output is:

***** Arduino IoT Cloud - configuration info *****
Device ID: 6**************************************************4
Thing ID: c****************************************************e
MQTT Broker: mqtts-sa.iot.arduino.cc:8883
SIM card ok
GPRS.attachGPRS(): 4
.Sending PING to outer space...
GPRS.ping(): 303
Connected to GPRS Network
...Connected to Arduino IoT Cloud
.

It never wakes up, even if I put the pin 5 to VCC.
How to manage LowPower with this Arduino?

Thank you
S.

Hi to manage sleep or deep sleep i use arduinolopower library , you can add it into library management
basically you can call LowPower.deepSleep((uint32_t)(SLEEP_MILLIS)); for deep sleep or LowPower.sleep((uint32_t)(SLEEP_MILLIS)); for sleep
i used in my script to put in deep slepp mkrgsm1400 for 2 hours

Dear tradexsrl,
thank you for you answer, but I think it's exactly the same library I'm trying to use.

I used it successfully in my MKR1310, so now I think it's a problem related to one of these two:

#include <ArduinoIoTCloud.h>
#include <Arduino_ConnectionHandler.h>

Someone who succeeded using ArduinoIoTCloud with LowPower?
If not I must think to abandon the Arduino IoT solution in favor of AWS or Google.
Thanks
S

forgot to say: have you shutdown the gsm class - gsm sms class (if used) - gprs class before placing in deep sleep the mcu ?
in my project i do these before deep sleep and it works..so i suspect with internet connection on with arduino cloud keeps mcu alive

Yep the problem is that using those libraries you don’t have access to the GSM class.
I’ve now setup a new sketch using GSM class and Blynk for the IOT and deep sleep works.

So the only solution is not using ArduinoIOTCloud...
If for the administrators of the forum and the management of Arduino this is an acceptable solution, please close the issue as Resolved.
Thanks

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