Hello everyone,
I am venturing into the world of Arduino Cloud with my Nano 33 board but I have been running into an issue when connecting to the MQTT broker. I have used the Thing creation to generate the thingProperties.h and arduino_secrets.h files, and have uploaded my own version of the main sketch, where I am essentially just sending through a random number to a "thing" from the board.
I am able to obtain a wi-fi connection successfully, the value is generated and printed to the serial. But I am continually being met with "Could not connect to iot.arduino.cc on port 8883 (Error -2)." The Arduino Cloud device list also shows the device as offline (I think this is probably expected because the device is not connecting)
Along with the default files for properties and secrets generated from the thing creation, the code I have uploaded to both boards is.
#include "thingProperties.h"
void setup() {
Serial.begin(9600);
delay(1500);
initProperties();
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
setDebugMessageLevel(2);
ArduinoCloud.printDebugInfo();
}
void loop() {
ArduinoCloud.update();
randomTemperature = 1.0 * random(1, 100);
Serial.println("random temperature: " + String(randomTemperature));
delay(5*1000);
}
void onRandomTemperatureChange() {
Serial.println("--onRandomTemperatureChange");
}
The output I get is:
***** Arduino IoT Cloud - configuration info *****
Device ID: xxxxxx
MQTT Broker: iot.arduino.cc:8883
WiFi.status(): 0
Current WiFi Firmware: 1.5.0
random temperature: 66.00
Connected to "wifi-network"
ArduinoIoTCloudTCP::handle_ConnectMqttBroker could not connect to iot.arduino.cc:8883 Error: -2
I am at my limit of basic troubleshooting where I have done;
- Reinstalls of the relevant libraries and the board firmware multiple times
- I have uploaded the exact same code to an an Uno R4 Wi-Fi board which works without problem
- Verified that the ATECC608A crypto chip is functioning correctly
- Used the PubSubClient library to test connection, where I get an error: -4, indicating a timeout I believe?
- I have checked the Cloud Agent debug console which doesn't show any output.
- I have tried uploading/monitoring the code from both the IDE and Arduino Cloud both of which have the same error.
The only thing I have noticed is that in my device list on Arduino Cloud, the Nano shows the connectivity module firmware as "1.4.8", but when opening the device it says the firmware is "1.5.0", which matches the output from the IDE. I am unsure if this is relevant.
Thanks in advance for anybody who replies!