This sketch will mqtt publish to thingspeak using the SARA built-in mqtt AT commands. All AT commands are sent in a fashion that allows the main loop to do other things while the response is received. Each AT command is sent with a timeout. If more than 20 timeouts happen in a row, the modem is hard reset.
I am using the latest version firmware on the SARA R4, so I am not sure if this would work with the older versions...
I have found that the modem can lock up in low signal environments when trying to establish the mqtt connection...
//Code removed, transitioned to http post.