Go Down

Topic: Arduino Cloud mqtt stuck ? (Read 4712 times) previous topic - next topic


Mar 09, 2017, 08:56 am Last Edit: Mar 10, 2017, 10:49 am by benjenq Reason: issue fixed.
I try to use Esp8266 to connect to Arduino Cloud.
Everything work yesterday, but it stuck today.

Please reference my code, it stuck at "Connecting to mqtt broker..." and doesn't finish poll() action.

Any idea?

Here is my code (has remove DHT11 library):

#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>
#include <ArduinoCloud.h>

char ssid[] = "...";
char pass[] = "...";
WiFiClientSecure  clientSSL;

unsigned long theTime;

//(A)rduino (C)loud (T)hing
const char acUserName[]   = "benjenq";
const char acthingName[]  = "myArduinoThing1";
const char acthingId[]    = "xxxx";
const char acthingPsw[]   = "xxxx";

// build a new object "Arduino cloud Thing Object"
ArduinoCloudThing acObject;

void setup() {
 // put your setup code here, to run once:

 theTime = millis();

 Serial.println("Start Arduino Cloud thing property...");
 //Arduino Cloud
 acObject.enableDebug(); // eneble the serial debug output
 acObject.begin(acthingName, acUserName, acthingId, acthingPsw, clientSSL);
 // define the properties
 acObject.addProperty("temperatureCelsius", INT , R);
 acObject.addProperty("humidity", INT , R);
 acObject.addProperty("rssi", INT , R);
 Serial.println("Finish Arduino Cloud thing property...");


void loop() {
 // put your main code here, to run repeatedly:

 if (millis() - theTime > 5000) {
   theTime = millis();
   Serial.println("Test Arduino Cloud Thing before poll()...");
   Serial.println("Test Arduino Cloud Thing after poll()...");


void startWifi() {
 if (WiFi.status() != WL_CONNECTED) {
   WiFi.begin(ssid, pass);
 else {

 int i = 0;
 while (WiFi.status() != WL_CONNECTED && i < 20) {

 if (WiFi.status() != WL_CONNECTED) {
   Serial.print("Can NOT connect to ssid: [");
    Serial.println("], ESP8266 will try again...");


Terminal output:

.........Start Arduino Cloud thing property...
Finish Arduino Cloud thing property...
Test Arduino Cloud Thing before poll()...
Connecting to mqtt broker...


Hi @benjenq,

There was an issue with the MQTT broker, could you please try again?


Hi @sandeepmistry,

Today it turn back to work again! Thank you!


I have been successful at connecting my arduino mkr1000 to the Arduino Cloud but today i got an issue. In the serial monitor it says "MQTT Stuck".

I realize this problem has happened before...How can it be fixed or do i just have to wait.


I've re-resolved the issue with the broker again.

Go Up