MKR1000 stuck on "Connecting to mqtt broker..."

I just got a MKR1000 board. I went through the steps on the Arduino Cloud to add the board to the Arduino Cloud. I uploaded the sketch that it gave me for the LedStatus property. I also added my SSID and password in the sketch, but when I run the sketch on the board and look at the serial monitor, it just says "Connecting to mqtt broker..." and doesn;t do anything else.

Please help, thanks

Having the same issue. I've been having similar connection issues with my wifi101 board as well when it comes to connecting to webservers. I actually found that the esp8266 boards (you can find one for ~$8 on Amazon) worked a lot better, though they aren't as powerful.

I'm really upset and I think I'm done spending money on Arduino products.

Difficult to assume the issue without seeing the code. I havent used MKR1000 but I used a UNO + ESP8266 to establish MQTT.

The code is provided when you create your device at the Arduino Cloud. Please replace the parameters in capitals with yours. I’m having the same problem:

#include <WiFi101.h>
#include <ArduinoCloud.h>

/////// Wifi Settings ///////
char ssid[] = "YOUR_WIFI_SSID";
char pass[] = "YOUR_WIFI_PASS";


// Arduino Cloud settings and credentials
const char userName[]   = "YOUR_ARDUINO_CLOUD_USERNAME";
const char thingName[] = "YOUR_ARDUINO_CLOUD_THING_NAME"; // I'm using "MyMKR1000"
const char thingId[]   = "YOUR_ARDUINO_CLOUD_THING_ID";
const char thingPsw[]  = "YOUR_ARDUINO_CLOUD_THING_PASS";


WiFiSSLClient sslClient;


// build a new object "MyMKR1000"
ArduinoCloudThing MyMKR1000;


void setup() {
  Serial.begin (9600);
  while(!Serial);
  // attempt to connect to WiFi network:
  Serial.print("Attempting to connect to WPA SSID: ");
  Serial.println(ssid);

  while (WiFi.begin(ssid, pass) != WL_CONNECTED) {
    // unsuccessful, retry in 4 seconds
    Serial.print("failed ... ");
    delay(4000);
    Serial.print("retrying ... ");
  }
  Serial.println("Connected!");

  MyMKR1000.begin(thingName, userName, thingId, thingPsw, sslClient);
  MyMKR1000.enableDebug();
  // define the properties
  MyMKR1000.addProperty("cloudLedStatus", STATUS, R);
  Serial.println("Arduino Cloud init done!");
}

void loop() {
  MyMKR1000.poll();

  MyMKR1000.writeProperty("cloudLedStatus", "oh...");
  delay(1000);
  MyMKR1000.writeProperty("cloudLedStatus", "yeah!");
  delay(1000);
}

I do get a “Connected!” and a “Arduino Cloud init done!” so it seems to be stuck at the poll call (which attempts to do an MQTT connection if I’m not mistaken because “Connecting to mqtt broker…” is printed on the console).

Best.

Hi Everyone,

I've tested the sketch that Arduino Cloud generates on my MKR1000 everything looks fine.

Please let us know of the following:

  • What version of the Arduino IDE you are using?
  • What version of the SAMD core from the board manager you have installed?
  • What version of the WiFi101 library do you have installed?

Thanks.

Btw, this post would have more visibility in the Products - Create section.

Hi. Thanks for answering.
I still have the same problem and here’s the detailed info (I also copy the exact script).
The sketch connects and performs the cloud init correctly but never completes the call to poll() (it hangs there). BTW the cloud configuration matches the info I provide on the sketch.

WiFi101 firmware check.
WiFi101 shield: DETECTED
Firmware version installed: 19.4.4
Firmware version required : 19.4.4
Check result: PASSED

Arduino IDE 1.6.8

Board: Arduino/Genuino MKR1000
Port: /dev/cu.usbmodem1441 (Arduino/Genuino MKR1000)

Arduino SAMD Board library v1.6.7 INSTALLED

#include <WiFi101.h>
#include <ArduinoCloud.h>

/////// Wifi Settings ///////
char ssid[] = "MyWiFI";
char pass[] = "mywifipass";


// Arduino Cloud settings and credentials
const char userName[]   = "myusername";
const char thingName[] = "MyMKR1000";
const char thingId[]   = "7cd27bd0-a5f1-45e8-88aa-4b301xxxxxxx";
const char thingPsw[]  = "d18a1bef-1387-47e1-91f5-7586bxxxxxx";


WiFiSSLClient sslClient;


// build a new object "MyMKR1000"
ArduinoCloudThing MyMKR1000;


void setup() {
  Serial.begin (9600);
  while(!Serial);
  // attempt to connect to WiFi network:
  Serial.print("Attempting to connect to WPA SSID: ");
  Serial.println(ssid);
  pinMode(6, OUTPUT);

  while (WiFi.begin(ssid, pass) != WL_CONNECTED) {
    // unsuccessful, retry in 4 seconds
    Serial.print("failed ... ");
    delay(4000);
    Serial.print("retrying ... ");
  }
  Serial.println("Connected!");

  MyMKR1000.begin(thingName, userName, thingId, thingPsw, sslClient);
  MyMKR1000.enableDebug();
  // define the properties
  MyMKR1000.addProperty("cloudLedStatus", STATUS, R);
  Serial.println("Arduino Cloud init done!");
}

void loop() {
  MyMKR1000.poll();

  MyMKR1000.writeProperty("cloudLedStatus", "oh...");
  Serial.println("Led high - oh");
  digitalWrite(6, HIGH);
  delay(1000);
  MyMKR1000.writeProperty("cloudLedStatus", "yeah!");
  Serial.println("Led low - yeah!");
  digitalWrite(6, LOW);
  delay(1000);
}

Just updated SAMD support on boards manager to 1.6.8. Same problem...

Sandeep: I saw your answers here: https://github.com/arduino/cloud-examples/issues/3 Could this be related? Best

Hi @germanviscuso,

I believe it’s unrelated to Can't connect to personal broker, Azure IoT Hub or Arduino from MKR1000 · Issue #3 · arduino/cloud-examples · GitHub - as we are no longer using the “PubSubClient” library.

Thanks for the details, we’re going to need a few more items for you:

  1. How did you install the WiFi101 library? (from the Library Manager, or downloading from Github, etc.)

  2. What version does the Library Manager show as the version: Sketch → Include Library → Manage Libraries. Then search for WiFi101, I’ve attached a screenshot of mine, I’m using WiFi101 v0.10.0.

Hi.

I installed the library from the library manager and it shows the installed version as 0.10.0 I just updated it to 0.11 (the latest), tried again and I still have the same problem.

Best

Has anyone figured this out? I'm having the same problem with the sketch that Arduino Cloud generates for my MKR1000.

The board seems to work ok and can connect to wireless network (WiFi101 sample sketch WiFiPing works fine). I've tried uninstalling / reinstalling the IDE, deleting the "thing" from the cloud / recreating it / downloading new sketch with new THING_ID and THING_PASSWORD, but still no luck.

I'm using: MKR1000 Arduino IDE 1.8.1 WiFi101 library version 0.12.1 (installed using IDE library manager) Arduino SAMD Boards library version 1.6.11 Wifi firmware V19.4.4, verified by CheckWifi101FirmwareVersion sketch

Any suggestions of other things to try?

tm2017: Has anyone figured this out? I'm having the same problem with the sketch that Arduino Cloud generates for my MKR1000.

The board seems to work ok and can connect to wireless network (WiFi101 sample sketch WiFiPing works fine). I've tried uninstalling / reinstalling the IDE, deleting the "thing" from the cloud / recreating it / downloading new sketch with new THING_ID and THING_PASSWORD, but still no luck.

I'm using: MKR1000 Arduino IDE 1.8.1 WiFi101 library version 0.12.1 (installed using IDE library manager) Arduino SAMD Boards library version 1.6.11 Wifi firmware V19.4.4, verified by CheckWifi101FirmwareVersion sketch

Any suggestions of other things to try?

I'm not able to connect to mttq.arduino.com using the WiFi101 example sketch WiFiSSLClient either. After using the WiFi Firmware/Certificates Updater to upload the SSL root certificate for google, the sketch was able to run properly. When I changed: char server[] = "www.google.com"; to char server[] = "mqtt.arduino.cc"; the device never returned the "connected to server" message. Not sure if I was doing that entirely correctly though. Any comments are appreciated.

Hi, I’m facing the exact same issue on my MKR1000.

What has to be done to make it up & running please ?

Should I add a dedicated certificate ? If yes, can you please provide on as

mttq.arduino.com

links to a non existing page.