Arduino IoT Cloud Network Problems

Hello, I'm working on a project where I can remotely toggle a relay from any given distance. I managed to get the code to work on my house's WIFI network however that limits its overall range. I was wondering if there was a way to get the board to connect to my mobile hotspot so I could use it wherever I have service.
The board I'm using is a HiLetgo ESP32-WROOM-32D
I don't think its needed for this problem but here's the 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

  CloudSwitch arm;
  CloudSwitch launch;
  CloudLight 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 "thingProperties.h"

void setup() {
  pinMode(2, OUTPUT);
  // 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
  // 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() {
  if (arm == 1) {
    if (launch == 1) {
      digitalWrite(2, HIGH);
      digitalWrite(2, LOW);
      Serial.println("Not Armed");

  void onArmChange() {
    // Do something

  void onLaunchChange() {
    // Do something

  void onLEDChange() {
    // Do something

Any help would be appreciated.

P.s. If there is another solution that is easier or better please don't hesitate to tell me.

I know nothing about the Arduino IOT cloud.

But, if both ends of the equation have Internet, preferably WiFi, then simply use MQTT through a public MQTT broker.

Did you try it? If so, what was the result?

I did try to run it on my mobile hotspot and It just failed to connect.

How would I go about setting that up?
For the Arduino IoT all I need is a network SSID and a password for that network and if it works then it will function as intended otherwise it will keep trying to connect but ultimately fail.

Actually scratch that, I didn’t understand the reply at first. The problem is the board doesn’t always have a connection to wifi. Thanks to the Arduino IoT cloud as long as the board is on the same network I put into the code, my phone can be on any network and still communicate with the board. That being said it makes it so I have to keep the board on the same network or else I will need to change the network in the code which I won’t always be able to do. That’s why I was trying to see if I could set it up through my mobile hotspot.

Did you update the values of SECRET_SSID and SECRET_PASS in the "Secret" tab of your sketch and then upload the updated sketch to the Thing device?

1 Like

Yeah, I changed the SSID to what I’m assuming is the name of the hotspot and I changed the password to the password I set. After changing those I uploaded it and in the serial monitor it said it failed to connect and that it was trying again in 500ms. I’m using iOS for the hotspot and I’m using the name for the hotspot that displays on other phones in the wifi tab as the SSID, which is the name of my phone. I’m not sure if that is actually the SSID of the hotspot or not.

I'll provide some instructions you can use to determine whether the hotspot is visible to your ESP32, and what its SSID is. Since you are using Arduino IoT Cloud, I'll provide the instructions for doing this using Arduino Web Editor, but if you prefer the desktop Arduino IDE, the equivalent procedure also applies.

  1. Open Arduino Web Editor:
  2. From the menu on the left sidebar of Arduino Web Editor, click on "Libraries".
  3. In the "SEARCH LIBRARIES" field, type: wifi for esp32
  4. You should now see "WIFI FOR ESP32" in the search results. Click on "Examples".
  5. From the dropdown menu that opens, click on "WiFiScan".
  6. Select your ESP32 board from the board and port menu.
  7. Click the "upload" button.
  8. Wait for the upload to finish.
  9. From the menu on the left sidebar of Arduino Web Editor, click on "Monitor".
  10. From the Monitor's baud rate menu, select "115200 baud".

The Monitor should now print out a list of the WiFi access points that are available to your ESP32, something like this:

17 networks found
1: IoTNetwork (-62)*
2: WiFiSSID (-62)*
3: B3A7992 (-63)*
4: WiFi (-63) 
5: IoTNetwork2 (-64)*

Taking the first network on that list for an example:

The "IoTNetwork" part is the SSID.

The "(-62)" part is the RSSI, which indicates the signal strength and might be useful for troubleshooting connection problems caused by too weak of a signal from the WiFi access point.

The "*" indicates that password is required to connect to the access point.

I managed to fix it and it seems that the problem was the SSID of my hotspot had special characters in it so I removed those characters and it worked after that. Thanks for the help though! I’ll be sure to look back to this is the problem comes up again.

I'm glad to hear it's working now. Thank you for taking the time to post an update. Enjoy!

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