Drops connection & won't reconnect until reboot.

Morning all,

Ive recently had a MKR 1400 replaced as we though it was faulty (turns out battery charging was faulty but connectivity wasn't). The board is setup with a couple of sensors and transfers data to Arduino IoT cloud. Problem is after about 2 and a half days it drops the connection and will only re connect when its rebooted either by power cycling or pressing the reset button...

Is there either any way i can code a reset, say every 24 hours, or catch when its not connected and reconnect...?

Thanks

Dave

Both.

Reset with somthing like

static unsigned long delayStarttime;
  unsigned long currentTime = millis();
 if (currentTime - delayStarttime >= 60000UL) //dev 1min = 60000 5 min =300000 15 min 90000 and so on
  {
    NVIC_SystemReset();
  }

I use GitHub - 256dpi/arduino-mqtt: MQTT library for Arduino lib with:

 if (client.connected() == 0) {
      client.connect("device_name", "channel", "password");
      client.setOptions(120, true, 2000);
      client.subscribe("/channelname");
    }

To reconnect to the mqtt broker. i guess every mqtt lib has something like that

Cheers

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