Pinging Arduino MKR1500 from the cloud or MQTT broker


I am trying to program my Arduino to be pinged by the server/MQTT broker when it has not sent any data for over a period of x minutes to check if it is alive/dead(by low battery/lost connectivity)? Is there a way I can implement this and also is there an example code for reference?

Generally, the MQTT server does that out of the box. The usual interval for the keep alive ping is 60 seconds and if the Arduino doesn't respond, the connection is dropped. If you run the server in verbose mode you can see the event in the console.

1 Like

Thanks @wildbill. Is there a way I can make that keep alive timer configurable?

Probably - it depends on the broker and library you're using. Check your docs (or the library code), it may be an optional parameter to pass when you connect.

1 Like

Thanks for the suggestion. I found it in the library files

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