Arduino IoT Cloud

This example demonstrates code for communicating with the Arduino IoT Cloud. Its purpose is to connect to the Arduino IoT Cloud and interact with cloud variables. Here, we send the temperature values read from the DHT11 sensor to the Arduino IoT Cloud, allowing us to monitor it from the cloud.


Required Components

In this project, we need the following components.

It’s definitely convenient to buy a whole kit, here’s the link:




Elite Explorer Kit


Elite Explorer Kit

You can also buy them separately from the links below.



Arduino Uno R4 WiFi




Jumper Wires


Humiture Sensor Module






Install Arduino Create Agent

  1. Visit the address

  2. Click START.

  1. Choose the version that suits your computer, and it will download an installation package.

  1. Install the agent.

  1. After installation, go back to your browser, and you will see the following interface.

  1. Click NEXT, and then you can GO TO the web editor.


Using Arduino IoT Cloud

  1. First, you need to log in or register with Arduino.

  1. Once logged in, click on IoT Cloud in the upper right corner.

  2. Create a new thing.

  3. Associate your device.

  4. Set up a new device.

  5. Choose your Arduino board.

  6. Wait for a moment, and your UNO R4 WiFi will be detected. Continue by clicking configure.

  7. Give your device a name.

  1. Make your device IoT-ready, and remember to save the secret key.

  1. Wait for a few minutes.

  1. Configure WiFi.

  1. Here you will need to enter your WiFi password and secret key.

  1. Add a variable.

  1. Here, we want to display the temperature in IoT Cloud, so we configure a read-only float variable.

  1. After completion, go to the sketch.

  1. Open the full editor.

  1. Click on Libraries on the right side, then Library Manager.

  1. Search for the DHT sensor library and check it.

  1. Now, we need to edit the code. You can see that the editor has already prepared the IoT Cloud-related code for you. You just need to add the specific functionality you need. In this example, we added code to read the temperature using the DHT11 sensor.

// DHT sensor library - Version: Latest
#include <DHT.h>
#include <DHT_U.h>

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

float temperature;

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"

#define DHTPIN 11
#define DHTTYPE DHT11

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


    // 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

    float temp = dht.readTemperature();
    temperature = temp;

  1. Upload the code. You may be prompted to update; follow the prompts to complete.

  1. Return to IoT CLOUD.

  1. Click on the menu in the top left corner.

  1. Click on the dashboard.

  1. Create dashboard.

  1. There are many widgets available; here, we choose a value widget for displaying the temperature.

  1. After clicking, a widget settings interface will appear, where you can connect the widget to the cloud variable you created earlier.

  1. Now, you can view the sensor readings on Arduino IoT Cloud.


How it works?

After configuring the IoT Cloud (device setup, network setup, creating cloud variables), you will notice that the sketch on the cloud updates automatically. So, most of the code is already written for you.

Open the editor, and you will see that this sketch contains four files:

main.ino: Used to initialize the Arduino and perform the main loop tasks. Additionally, it includes logic for connecting and communicating with the Arduino IoT Cloud.

thingProperties.h: This file is used to define variables and functions in the Arduino IoT Cloud. It contains declarations of cloud variables and their associated callback functions. In the provided code, it is used to initialize cloud properties (e.g., the temperature variable) and connect to the Arduino IoT Cloud.

Secret: Used to store sensitive or private information, such as WiFi passwords or API keys. This sensitive information is typically not exposed directly in the code but is stored in the Secret file to enhance security.

ReadMe.adoc: Contains project documentation or other relevant information for easier understanding and use of the project. This file usually does not contain executable code but rather documents and descriptive information.

We need to add some code for the DHT11 sensor. This code is identical to what you would use on your local IDE. The only difference is that you need to assign the value read from the DHT11 to the cloud variable temperature.

(Note: You should never modify thingProperties.h and Secret. They will be modified when you make changes using the Thing editor.)