Arduino IoT Cloud, also known as simply Arduino Cloud is a popular Internet-of-Things (IoT) platform for creating, deploying, and managing IoT projects. The platform was launched in 2019 as a Beta version similar to other platforms, such as Blynk.
Since then, Arduino Cloud has undergone several upgrades, adding unique features. It’s best known for its user-friendly interface and streamlined development process. Although not as scalable as Amazon Web Services, Azure, or Google Cloud, the platform can easily integrate many Arduino and non-Arduino microcontrollers into an IoT application.
Arduino Cloud offers a commercial Cloud service with a generous free tier. This tier includes remote control features, data visualization, and over-the-air updates, providing ample opportunities for IoT projects and intermediate-level applications. For those seeking more advanced features or enhanced control, the platform also offers paid plans.
In this project, we’ll discuss Arduino Cloud and build our first IoT project using the platform. Â
What is Arduino IoT Cloud
Arduino Cloud is an online platform where users can create, deploy, and monitor IoT projects.
It provides:
- An integrated development environment that can program several different boards
- A Cloud backend service to synchronize data from Arduino and non-Arduino boards (including Python and JavaScript clients)
- Dashboards for controlling and monitoring IoT devices and REST APIs
- Several command-line tools for large-scale automation
Overall, developing an IoT project on Arduino Cloud is easy due to its streamlined development process.
To begin, simply select a device on the platform (i.e., a microcontroller) and write a sketch for it. The device is uniquely identified by a secret key and integrated into a network using network credentials like WIFI SSID and password. After uploading code, it’s ready to synchronize data with the network.
Then, it’s possible to create dashboards to remotely control the device or monitor data, such as sensor data relayed by the device over the network.
Devices
The devices include Arduino and any non-Arduino microcontrollers supported by the Arduino Cloud platform. The supported devices include Wi-Fi boards, LoRa radios, Ethernet boards, and cellular (GSM/NB-IoT) boards.
- The compatible Wi-Fi boards include MKR WIFI 1010, Nano 33 IoT, Nano RP2040 Connect, GIGA R1 WIFI, Opta, Portenta H7, Portenta H7 Lite Connected, Portenta Machine Control, ESP32, and ESP8266.
- The compatible LoRa boards are MKR WAN 1300 and MKR WAN 1310.
- The compatible Ethernet boards are Portenta Vision Shield – Ethernet and Portenta Machine Control.
- The compatible cellular boards are MKR GSM 1400 and MKR NB 1500. Â
Arduino Cloud Agent
To program devices with Arduino Cloud, Arduino Cloud Agent software must first be installed on your computer. It enables serial communication between the compatible microcontrollers and Arduino Cloud. The software allows users to upload sketches to the boards and read/write serial data between the boards and the Cloud.
Arduino Create Agent is available for Windows, Linux, and Mac. It can be downloaded from this link. Install Arduino Cloud Agent (also called Arduino Create Agent) on your computer before working with any compatible boards.
Things
The devices are represented in Arduino Cloud as “Things,” virtual twins, representing the devices in the Cloud’s IoT ecosystem. Each device in an IoT project is regarded in Arduin Cloud as a “Thing,” a digital representation of the device, including the variables associated with the device. This includes the device information, network credentials, code, and other data related to the device required for communication between the hardware and Arduino Cloud.Â
Network
Essentially, the devices in an IoT project are connected devices that form a network. This network’s devices can use Wi-Fi, Bluetooth, LoRa, Ethernet or cellular network. Most IoT projects are built using Wi-Fi.
All network devices are connected to the same Wi-Fi SSID through a common password. However, each device has a unique secret key that allows it to be identified. The key is generated when a Thing is created on Arduino Cloud.
Cloud variables
The variables are defined in the device’s code and shared between the connected devices and Arduino Cloud. This means other connected devices can use the Cloud variables on the IoT network and the dashboards. Â
The Cloud variables can be read-only or read-write. The read-only ones cannot be altered, whereas the read-write ones can be changed by Arduino Cloud (through a dashboard). Arduino Cloud supports basic variables like Boolean, integer, float, string, and complex types representing objects.
Dashboards
Dashboards are digital command centers that can be built on Arduino Cloud by a developer. They consist of one or more widgets that represent a Cloud variable. The Dashboards allow end-users to view and change Cloud variables via the widgets to interact with the device(s) and provide data visualization, such as sensor data from the devices. A Dashboard can be accessed from a web browser or mobile app.
Triggers
Triggers are a way in Arduino Cloud to automate notifications or actions when specific conditions in a device or network within the IoT project are met. The triggers are fired when a Cloud variable condition is met. Arduino Cloud supports only Boolean and String variables as triggers. A device can be programmed to initiate an action or push notifications, such as an SMS alert or email notification, whenever the trigger is fired.
Sketches
Sketches are the C++ codes written and uploaded to devices. The sketches for devices connected to Arduino Cloud (i.e., the devices configured as Things) are written in the Thing Editor on the Arduino Cloud or Web Editor. If the sketch is dependent on importing other libraries, it must be written in the Arduino Web Editor.Â
Arduino IoT Cloud Editor
Arduino Cloud Editor, also called Arduino Create Editor or Arduino Web Editor, is the online integrated development environment of the Arduino Cloud. It allows users to create Things and networks and write and upload sketches to devices. Â
IoT Cloud Remote App
This is the mobile companion app for Arduino Cloud, available for Android and iOS. The IoT Cloud Remote App is useful for hosting dashboards, remotely controlling IoT devices, as well as monitoring the Cloud variables and data visualization.
It can also connect to a smartphone as an additional data source, using its built-in sensors (GPS, accelerometer, gyroscopes) as data points. This data can be saved in Arduino Cloud variables, where it can be viewed alongside information from other devices or incorporated into a project’s logic.
Getting started with Arduino Cloud
In this project, we’ll configure an ESP32 as a Thing on Arduino Cloud to control an LED from the Cloud’s dashboard.
First, go to the Arduino Cloud website and sign up using email, GitHub, Facebook, or your Apple ID.
Enter a username to create your account on Arduino Cloud.
After signing up, you’ll be taken to the Arduino Cloud Editor.
Adding ESP32 to Arduino Cloud
Ensure Arduino Create Agent is installed on your computer. To add ESP32 to the Arduino Cloud, click “Devices” on the left sidebar and then on “Add Device.”
A device set-up window will appear. Select the “Third party Device,” which is for ESP32.
Select your device type and click “Continue.”
Provide a name for your device and click, “Next.”
In the next window, Arduino Cloud will provide a device ID and secret key. Write them down or click on the “Download PDF.” Select “I saved my Device ID and Secret Key,” and then click “Continue.”
This completes the device set-up. You should land on a webpage that shows the device status.
Creating a Thing
After adding a device, it’s time to create a “Thing” on Arduino Cloud. Click on the IDE icon on the left top corner of your screen, and then select “Things” from the left sidebar.
Click on “Create Thing” button.
A Things Editor webpage will open. Notice that the Thing is currently untitled, so expand the untitled tab and select “Rename.”
Provide a suitable name.
Next, under the Associated Device tab, click on “Select Device.”
Choose
the device you added and click on “Associate.”
Now, under the Network tab, click on “Configure.”
Add your Wi-Fi network credentials and device’s secret key, and hit “Save.”
Creating a Cloud variable
Now, it’s time to config
ure the onboard LED on ESP32 (which is internally connected to the GPIO2 of the board) from Arduino Cloud Dashboard. To do so, let’s create a Cloud variable that represents the LED on ESP32. Click on “Add” under the Cloud variables.
Name the variable LED and select the light type. The variable permission will be set to “Read & Write.” Set the update policy to “on change.” Click on “Add variable” to create the Cloud variable.
Modifying the sketch
After adding a device, creating a Thing, and adding the required Cloud variable, it’s time to program our device. Click on “Sketch” in the Things editor to open the Cloud Web Editor. You’ll notice that some of the code has already been added to the sketch after creating the Cloud variable.
The sketch consists of a main .ino file, a readme doc, a thingproperties.h header file, and a secret tab. The ino file is where you’ll write and modify the code. The readme doc contains the information about the Thing. The header file consists of the associated properties and the secret tab holds the secret key and network credentials of the device.
There is already an onLEDChange() function added in the sketch because we added the Cloud variable. Modify the sketch as follows to control the LED by using the Cloud variable.
Connect ESP32 with your computer using a USB cable.Click on “Upload” to add the sketch to the device.
Creating the Dashboard
To remotely control ESP32’s onboard LED using Arduino Cloud, we must create a Dashboard for it. Select “Dashboards” from the left sidebar.
Click on the “Create Dashboard” button.
Then, click “Add” to add a widget.
Select the “Switch” widget.
Rename the widget to “LED Switch,” and click on “Linked Variable.”
In the pop-up window, select the LED Cloud variable and click on the “Link Variable” button.
Click “Done” to finish creating the Dashboard.
Results
After creating the Dashboard, you can control the onboard LED, which is now on ESP32 from Arduino Cloud as shown in the following video.
Filed Under: Electronic Projects, Video
Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.
Tell Us What You Think!!
You must be logged in to post a comment.