could not connect to


I’m trying a simple code to control the builtin led through Arduino IoT Cloud. I can connect to my wifi, but not to the IoT cloud, I get the following message “ArduinoIoTCloudTCP::handle_ConnectMqttBroker could not connect to”

Here’s my code

  Sketch generated by the Arduino IoT Cloud Thing "Untitled" 

  Arduino IoT Cloud Variables description

  The following variables are automatically generated and updated when changes are made to the Thing

  bool lED;

  Variables which are marked as READ/WRITE in the Cloud Thing will also have functions
  which are called when their values are changed from the Dashboard.
  These functions are generated with the Thing and added at the end of this sketch.
#include <SPI.h>
#include <WiFiNINA.h>
#include "thingProperties.h"
int status = WL_IDLE_STATUS;
WiFiServer server(80);

void setup() {
  // Initialize serial and wait for port to open:
  // This delay gives the chance to wait for a Serial Monitor without blocking if none is found

  pinMode(LED_PIN, OUTPUT);
   // check for the WiFi module:
  if (WiFi.status() == WL_NO_MODULE) {
    Serial.println("Communication with WiFi module failed!");
    // don't continue
    while (true);

  String fv = WiFi.firmwareVersion();
    Serial.println("Please upgrade the firmware");

  // attempt to connect to Wifi network:
  while (status != WL_CONNECTED) {
    Serial.print("Attempting to connect to Network named: ");
    Serial.println(SSID);                   // print the network name (SSID);

    // Connect to WPA/WPA2 network. Change this line if using open or WEP network:
    status = WiFi.begin(SSID, PASS);
    // wait 10 seconds for connection:
  server.begin();                           // start the web server on port 80
  printWifiStatus();                        // you're connected now, so print out the status
  // Defined in thingProperties.h

  // Connect to Arduino IoT Cloud
     The following function allows you to obtain more information
     related to the state of network and IoT Cloud connection and errors
     the higher number the more granular information you’ll get.
     The default is 0 (only errors).
     Maximum is 4

void loop() {
  // Your code here 

void onLEDChange() {
  digitalWrite(LED_PIN, lED);
    Serial.print("The light is ");
    if (lED) {
    } else {

void printWifiStatus() {
  // print the SSID of the network you're attached to:
  Serial.print("SSID: ");

  // print your board's IP address:
  IPAddress ip = WiFi.localIP();
  Serial.print("IP Address: ");

  // print the received signal strength:
  long rssi = WiFi.RSSI();
  Serial.print("signal strength (RSSI):");
  Serial.println(" dBm");
  // print where to go in a browser:
  Serial.print("To see this page in action, open a browser to http://");


// Code generated by Arduino IoT Cloud, DO NOT EDIT.

#include <ArduinoIoTCloud.h>
#include <Arduino_ConnectionHandler.h>

const char THING_ID[] = "fdd6d8fc-9d61-42fa-a29b-b4440ca628dd";

const char SSID[]     = SECRET_SSID;    // Network SSID (name)
const char PASS[]     = SECRET_PASS;    // Network password (use for WPA, or use as key for WEP)

void onLEDChange();

bool lED;

void initProperties(){

  ArduinoCloud.addProperty(lED, READWRITE, ON_CHANGE, onLEDChange);


WiFiConnectionHandler ArduinoIoTPreferredConnection(SSID, PASS);

This is what I get on the serial monitor

***** Arduino IoT Cloud - configuration info *****
Device ID: y
Thing ID: fdd6d8fc-9d61-42fa-a29b-b4440ca628dd
MQTT Broker:
WiFi.status(): 3
Current WiFi Firmware: 1.4.1
Connected to "Livebox-BB08"
ArduinoIoTCloudTCP::handle_ConnectMqttBroker could not connect to
ArduinoIoTCloudTCP::handle_ConnectMqttBroker could not connect to
ArduinoIoTCloudTCP::handle_ConnectMqttBroker could not connect to

Thanks in advance for your help!

I was having the same problem. Ive manger to get my project working after using the firmwareUpdater. It was a little confusing but I managed to get thru it. Good luck!

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