Hi @jeometry. Unfortunately the "Cloud Blink ESP32" template is not compatible with the Nano ESP32 board.
However, you can directly create an Arduino Cloud IoT Thing and dashboard with the same functionality.
I'll provide instructions you can follow to do that:
A. Create Device
ⓘ You can skip to the "B. Create Thing" procedure below if you have already created an Arduino Cloud IoT Device for your Nano ESP32 board.
- Connect the Nano ESP32 board to your computer with a USB cable.
- If you are not already, log in to your Arduino account:
https://login.arduino.cc/login
- Click the following link to open the "Devices" page in your web browser:
https://app.arduino.cc/devices
- Click the "+ DEVICE" button at the top right corner of the page.
The "Setup Device" dialog will open.
- Click the "Arduino board" section of the dialog.
- If a "Latest Arduino Cloud Agent required" message appears, make sure you have Arduino Cloud Agent running.
- The dialog should now show an "Arduino Nano ESP32 found" message, click the "CONFIGURE" button.
- The dialog should now show a "Give your device a name" message, adjust the name if you like and then click the "NEXT" button.
- The dialog will now show the "secret key" that has been assigned to the Device. Save the key value to a safe place.
- Click the "I saved my Device ID and Secret Key" checkbox in the dialog.
- Click the "CONTINUE" button.
- The dialog will now show a "Congratulations! You are all set" message. Click the "DONE" button.
The dialog will close and a page showing technical information about the newly created Device will open.
B. Create Thing
- Click the following link to open the "Things" page in your web browser:
https://app.arduino.cc/things
- Click the "+ THING" button at the top right corner of the page.
A new Thing will be created and its setup page will open.
- Click the ▼ icon to the right of the default Thing name (e.g., "Untitled").
A menu will open.
- Select "Rename" from the menu.
The "Rename Thing" dialog will open.
- Type
CloudBlinkESP32 into the "Name" field of the dialog.
ⓘ You can use any name you like. I chose this name arbitrarily so that I can refer to it in a specific manner later in the instructions.
- Click the "RENAME" button in the dialog.
The dialog will close.
- Click the "ADD" button under the "Cloud Variables" section of the Thing setup page.
The "Add variable" dialog will open.
- Type
led in the "Name" field of the dialog.
- Click on the "Select variable type" menu.
The menu will expand.
- Select "Boolean" from the menu.
- Click the "ADD VARIABLE" button.
The "Add variable" dialog will close.
- Click the "Select Device" button under the "Associated Device" section of the page.
The "Associate device" dialog will open.
- Select the Nano ESP32 Device in the dialog.
The dialog will close.
- Click the "Configure" button under the "Network" section of the Thing page.
The "Configure network" dialog will open.
- Type the SSID of your Wi-Fi router's 2.4 GHz access point in the "Wi-Fi Name" field.
- Type the password of your Wi-Fi access point in the "Password" field.
- Type the "secret key" that was provided during the Device creation procedure in the "Secret Key" field.
- Click the "SAVE" button.
The "Configure network" dialog will close.
C. Write Thing Sketch
When you create a Thing, a skeleton sketch is automatically generated that contains the code for connecting to the Wi-Fi access point and through the Internet to the Arduino Cloud server. However, this is only a skeleton of a sketch that doesn't actually do anything, so you must add your own code to control how the Thing should behave.
- Select the "Sketch" tab at the top of the Thing page.
The skeleton Thing sketch will open in Arduino Cloud Editor.
- Hover the mouse pointer over this code block:
#include "thingProperties.h"
void setup() {
Serial.begin(9600);
// This delay gives time to open Serial Monitor to see debug output from the start of the program execution
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 the level number, the more granular information you'll get. Maximum is 4.
*/
setDebugMessageLevel(2);
ArduinoCloud.printDebugInfo();
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
ArduinoCloud.update();
}
/*
Since the "led" Variable's permissions were configured as "Read & Write", the onLedChange() function is called every
time its value is changed via the dashboard.
*/
void onLedChange() {
Serial.print("led status changed:");
Serial.println(led);
digitalWrite(LED_BUILTIN, led);
}
- An icon that looks like two pieces of paper will appear at the top right corner of the code block. Click that icon.
This will copy the code to the clipboard.
- Click on the editor panel in the Cloud Editor page.
- Press the Ctrl+A keyboard shortcut (or Command+A if you are using macOS).
All the skeleton sketch code in the editor panel will be selected.
- Press the Ctrl+V keyboard shortcut (or Command+V for macOS users).
This will replace the skeleton sketch code with the complete sketch code you copied in the previous step.
The Thing sketch code is now complete. It will be a good idea for you to study the code so that you understand the program. If you have any questions about it, just let us know and we'll provide an explanation.
D. Upload Thing Sketch
Now that you have the Thing sketch written, the next step is to upload the compiled program to the Nano ESP32 board:
- Click the ➜ button on the Cloud Editor toolbar.
A "Verifying" process will start, followed by an "Uploading" process.
- Wait for the upload to finish successfully.
E. Create Dashboard
- Click the following link to open the "Dashboards" page in your web browser:
https://app.arduino.cc/dashboards
- Click the "+ DASHBOARD" button.
A new dashboard page will open.
- The dashboard will have a generic default name (e.g., "Untitled"). It will be helpful to give it a better name. Click the dashboard name you see near the top left corner of the page.
A menu will open.
- Select "Rename" from the menu.
The "Rename Dashboard" dialog will open.
- Type a meaningful name in the "Name" field of the dialog.
- Click the "RENAME" button.
The "Rename Dashboard" dialog will close.
- Click the "ADD" button near the top left corner of the page.
A menu will expand.
- Select "Switch" from the menu.
A "Widget Settings" dialog will open.
- Click the "Link Variable" button.
The "Link Variable to Switch" dialog will open.
- Select "CloudBlinkESP32" from the list of Things under the left column of the dialog.
- Select "led" from the list of Variables under the middle column of the dialog
- Click the "LINK VARIABLE" button.
You will be returned to the "Widget Settings" dialog.
- Click the "DONE" button.
The "Widget Settings" dialog will close.
- Click the "ADD" button near the top left corner of the page.
- Select "LED" from the menu.
- Click the "Link Variable" button.
- Select "CloudBlinkESP32" from the list of Things under the left column of the dialog.
- Select "led" from the list of Variables under the middle column of the dialog
- Click the "LINK VARIABLE" button.
- Click the "DONE" button.
- Click the icon that looks like an eye near the top left corner of the page.
This will put the dashboard into display mode, where the layout and widgets are no longer editable. If you later want to make changes to the dashboard, you can click the icon that looks like a pencil next to the eye icon to enable editing again.
F. Control Thing
Click on the switch interface of the "Switch" widget in the newly created dashboard. You should see the following things happen:
- The "Switch" widget changes from the "OFF" state to the "ON" state.
- The "LED" widget switches to on state.
- The orange LED on the Nano ESP32 board turns on.
The opposite things will happen when you move the "Switch" widget state back to "OFF".
You now have a fully functional Arduino Cloud IoT project, congratulations! Even though it is a simple project, it gives a good overview of all aspects of the system. You can now proceed to make more complex projects based on this foundation.
In addition to being useful as an introduction, this simple "hello world" project can be used as a "known good" baseline for troubleshooting later if you encounter problems with a more complex project. If you upload the CloudBlinkESP32 Thing sketch to the board and find that it works as expected while the complex project does not work, this will tell you that the problem is caused by something specific to the complex project rather than being a universal problem (e.g., an outage of the Arduino Cloud service).
Please let me know if you have any questions or problems while following those instructions.