Arduino Nano 33 IoT will not connect to Arduino IoT Cloud

I am attempting to connect my Arduino Nano 33 IoT to Arduino IoT Cloud. I am using this tutorial as a guideline: An intro to the Arduino IoT Cloud | Arduino Documentation

The code I am using takes temperature and humidity data from a DHT11 sensor and attempts to upload this data into Arduino IoT Cloud. However, whenever I run this code, I receive the following error message:

"ArduinoIoTCloudTCP::handle_ConnectMqttBroker could not connect to mqtts-sa.iot.arduino.cc:8883
ArduinoIoTCloudTCP::handle_ConnectMqttBroker 1 connection attempt at tick time 24904"

My wifi firmware is updated to the latest version, and I have ensured that my wifi connection is working and stable. I have also deleted the project and tried to start over, but still encounter the same issue. Are there any modifications I should make to my code, or naming conventions that may fix my problem?

Code for the sketch is here:

#include "thingProperties.h"
#include <EduIntro.h>
DHT11 dht11(4);  // creating the object sensor on pin 'D7'


void setup() {
  // Initialize serial and wait for port to open:
  Serial.begin(9600);
  // This delay gives the chance to wait for a Serial Monitor without blocking if none is found
  delay(1500);
  // Defined in thingProperties.h
  initProperties();
  // Connect to Arduino IoT Cloud
  ArduinoCloud.begin(ArduinoIoTPreferredConnection);
  /*
    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
  */
  setDebugMessageLevel(2);
  ArduinoCloud.printDebugInfo();
}
void loop() {
  ArduinoCloud.update();
  // Your code here
  dht11.update();
  temperature = dht11.readCelsius();
  humidity = dht11.readHumidity();
  delay(2000);
  Serial.print(F("Humidity:"));
  Serial.print(humidity);
  Serial.print(F("Temperature:"));
  Serial.print(temperature);
}

I'm sorry, but I have some doubts about that. At least if wifi connection means "Internet connection". The error message tells you that it cannot connect to the MQTT server of Arduino IoT. So either you have a bad WiFi connection or your WiFi network isn't connected to the Internet (given you don't filter outgoing traffic).

Use one of the other network examples to check your Internet connectivity.

Check your secret key and device key.
Make sure there are no spaces.

Hi, Arduino IoT compatibility for Nano ESP32 is only available in August, it is mentioned in the store page. Also, in the documentation you are using the ESP32 board is not mentioned as a compatible board at the moment.
Store: Arduino® Nano ESP32 — Arduino Official Store

I though this topic was about the 33 Iot?

1 Like

Yes, you are right, that was my bad. On the connections side,

  • make sure that the WiFi details provided are correct as it is case-sensitive.
  • Try to change the Debug Level to 4.
  • Try connecting to 2.4Ghz WiFi.
1 Like

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