ArduinoIoTCloud and ArduinoLowPower WDT solved

I have solution to a problem I've encountered using the MKR1010 with IoTCloud, and the Lowpower libraries. It took a long time to find, so thought Id share it here;

I'm using the MKR, solar powered to report on water tank levels. I use the LowPower library to sleep the unit, and wake and report once an hour using LowPower.deepSleep(period), and sending the data using ArduinoCloud.update();

It used to work, and then stopped working a while back since the ArduinoIoTCloud library was updated to v1.0.0, at which point they introduced a Watch Dog Timer to the library!
This WDT is on by default, and it cancels the sleeping just a few seconds after its gone to sleep.

Deets are here; GitHub - arduino-libraries/ArduinoIoTCloud

I was using the default ArduinoCloud.begin(ArduinoIoTPreferredConnection). If you want to sleep a IoT device then you need to disable the WDT with the false switch; ArduinoCloud.begin(ArduinoIoTPreferredConnection, false)


This 1.0.0 release of this library adds watchdog functionality to all ATSAMD21G18 based cloud connected boards. A watchdog is simply an electronic timer counting down from a preset start value which, upon reaching zero, triggers a reset of the microcontroller. It can be used to automatically recover from temporary hardware faults or unrecoverable software errors. In order to avoid the watchdog from reaching zero the countdown timer needs to be regularly re-set to its start value. This is happening within ArduinoIoTCloud.update() which is periodically called at the start of the loop() function. Although the watchdog is automatically enabled it can be disabled by setting the second parameter of ArduinoIoTCloud.begin(...) to false:

What is the WDT period?
Is there a way to set the WDT to a large period?

Hope that helps someone else...dove me nuts for a few weeks! Nothing found on forums...I had to read the manual...


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