Learning Goals 5 min
L03 had you build "cloud-ish" things by hand: HTTP servers, JSON dashboards, IFTTT webhooks. Each is a hand-rolled piece. Arduino IoT Cloud is the official, integrated platform: declare a variable in your sketch, sync it to the cloud automatically, view and control it from a phone app or browser dashboard. By the end of this lesson you will:
- Define the four core concepts: Thing, Property, Device, Dashboard.
- Sketch the data flow: physical sensor → board → cloud-synced Property → dashboard widget → phone screen.
- Compare Arduino IoT Cloud vs the hand-rolled approach of L03-33 to see where each wins.
Warm-Up 10 min
If you didn't already: create a free Arduino account at create.arduino.cc. The web IDE is integrated with the IoT Cloud — same login.
Free tier in 2026
- 2 Things.
- 1 dashboard.
- 10 minutes of compilation time per day.
Enough for one or two demo projects. Paid tiers (Maker / Maker Plus) lift the caps.
Compatible boards (2026 list)
- MKR family (WiFi 1010, GSM 1400, NB 1500, WAN 1310).
- Nano 33 IoT.
- Nano RP2040 Connect.
- Nano ESP32.
- Portenta H7.
- Some ESP32 / ESP8266 boards via the third-party plugin.
The plain UNO is NOT supported (no WiFi). UNO R4 WiFi is supported.
New Concept · Thing, Property, Device, Dashboard 25 min
The four objects
| Object | What it is |
|---|---|
| Thing | A logical container for one device's variables. E.g. "Garden Plant". Holds Properties. |
| Property | A typed variable that auto-syncs between sketch and cloud. E.g. moisturePct (int, read-only) or pumpOn (bool, read-write). |
| Device | A physical board associated with a Thing. The Thing "runs on" this device. One device per Thing. |
| Dashboard | A web/phone-app view with widgets bound to Properties. Multiple dashboards can show the same Thing's properties. |
The data flow
- Your sketch reads a sensor → assigns the value to a Property variable (just like any other variable).
- The IoT Cloud library detects the change and pushes it to the cloud.
- The cloud stores the value + timestamp (for historical charts).
- Dashboards subscribed to the Property see the new value within ~1 s.
- If a dashboard widget writes a value (toggle a switch), the cloud sends it down to the device.
- The library calls a callback function (e.g.
onPumpOnChange()) so your sketch can react.
Bidirectional. No HTTP server, no JSON parsing, no IFTTT — all of L03-31..33 collapsed into "declare a Property, use it like a variable".
Property types
| Type | C++ equivalent | Common use |
|---|---|---|
| Integer | int | Counter, raw sensor reading |
| Floating point | float | Temperature, voltage, percentage |
| Boolean | bool | Toggle (LED on/off, pump enable) |
| Character string | String | Status text, sensor label |
| Time | CloudTime | Last-watered timestamp |
| Colour | CloudColor | RGB picker → driving an LED |
| Location | CloudLocation | GPS coordinates → map widget |
Plus many domain-specific types (Temperature, Velocity, Power, etc.) which are floats with predefined units.
Permissions: read-only vs read-write
- Read-only (from the cloud's perspective): sketch pushes, dashboard displays. Used for sensor readings.
- Read-write: dashboard can change, sketch reacts via callback. Used for actuator commands (LED on/off, target temperature).
Hand-rolled vs Arduino IoT Cloud
| Aspect | L03-33 hand-rolled | Arduino IoT Cloud |
|---|---|---|
| Code per data point | ~20 lines (handler, JSON, HTML) | ~2 lines (declare property + use) |
| Where dashboard lives | Your ESP's tiny web server | Arduino cloud, accessible anywhere |
| Historical data | You build it | Free, stored automatically |
| Phone app | Build your own | Free, "Arduino IoT Remote" |
| Cost | Free, runs forever | Free for 2 Things; paid for more |
| Lock-in | None | Depends on Arduino's service uptime |
Use IoT Cloud for projects you want to demo / share / use yourself. Hand-roll for products you want to ship independently, or for stuff that must keep working offline.
Worked Example · Walkthrough of a Cloud sketch 20 min
The Arduino Cloud editor auto-generates two files for you: the .ino (where you write your sketch) and a hidden thingProperties.h (the Property declarations).
Auto-generated thingProperties.h
// thingProperties.h - generated; do not edit
#include <ArduinoIoTCloud.h>
#include <Arduino_ConnectionHandler.h>
const char SSID[] = SECRET_SSID;
const char PASS[] = SECRET_OPTIONAL_PASS;
const char DEVICE_LOGIN_NAME[] = "DEVICE-ID";
const char DEVICE_KEY[] = "DEVICE-KEY";
bool ledOn;
float temperatureC;
int moisturePct;
void onLedOnChange(); // callback when dashboard writes ledOn
void initProperties() {
ArduinoCloud.setBoardId(DEVICE_LOGIN_NAME);
ArduinoCloud.setSecretDeviceKey(DEVICE_KEY);
ArduinoCloud.addProperty(ledOn, READWRITE, ON_CHANGE, onLedOnChange);
ArduinoCloud.addProperty(temperatureC, READ, ON_CHANGE, NULL);
ArduinoCloud.addProperty(moisturePct, READ, ON_CHANGE, NULL);
}
WiFiConnectionHandler ArduinoIoTPreferredConnection(SSID, PASS);Your .ino
#include "thingProperties.h"
void setup() {
Serial.begin(9600);
delay(1500);
initProperties();
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
setDebugMessageLevel(2);
ArduinoCloud.printDebugInfo();
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
ArduinoCloud.update(); // CRITICAL: every loop iteration
// Read a sensor and update the cloud property
temperatureC = analogRead(A0) * 0.1; // dummy formula
moisturePct = map(analogRead(A1), 0, 1023, 0, 100);
delay(1000);
}
// Callback: runs when the dashboard toggles ledOn
void onLedOnChange() {
digitalWrite(LED_BUILTIN, ledOn ? HIGH : LOW);
}What you don't see
- WiFi connection — handled by the ConnectionHandler.
- MQTT-over-TLS to the Arduino cloud broker — handled by ArduinoIoTCloud library.
- JSON encoding — handled.
- Subscriptions — handled.
- Reconnection on outage — handled.
You write: "temperatureC = 22.5;" and a dashboard chart updates. That's the entire IoT Cloud promise.
Basic 5 min
A garden Thing needs three Properties:
gardenTempC— the garden temperature, with decimals. The dashboard only shows it.pumpOn— a dashboard switch that turns the pump on and off.robotSpot— the GPS position of a garden robot, shown on a map widget.
Write them in the style of the Worked Example's thingProperties.h. You need three variable lines, the callback declaration and three addProperty lines.
It works if each Property has the right type and permission. Only a Property the dashboard writes gets a callback.
Challenge 1 5 min
A classmate's Thing has three problems. The temperature only ever shows whole numbers. The dashboard switch will not move the LED. Nothing reaches the cloud at all.
// thingProperties.h (part)
int temperatureC;
bool ledOn;
void initProperties() {
ArduinoCloud.addProperty(temperatureC, READ, ON_CHANGE, NULL);
ArduinoCloud.addProperty(ledOn, READ, ON_CHANGE, onLedOnChange);
}
// the .ino
#include "thingProperties.h"
void setup() {
Serial.begin(9600);
delay(1500);
initProperties();
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
temperatureC = analogRead(A0) * 0.1;
delay(1000);
}
void onLedOnChange() {
digitalWrite(LED_BUILTIN, ledOn ? HIGH : LOW);
}Match each symptom to the line that causes it, and give the fix.
It works if you name one cause per symptom, and each fix is a single change.
Challenge 2 5 min
Start from the Worked Example's .ino. Add a red LED with a 220 Ω resistor on D5.
The LED must light when moisturePct is below 30. It must keep working even when the WiFi is down and the dashboard is offline.
Write the changed sketch. If you have a supported board, upload it, then switch off your WiFi to test.
It works if the red LED still reacts to the soil sensor with the WiFi switched off.
Challenge 3 · Turn a hand-made sketch into a Thing 10 min
This plant sketch was written before IoT Cloud. The pump should become switchable from a dashboard.
const int SOIL_PIN = A0;
const int PUMP_PIN = 7;
int soilPct = 0;
bool pumpRunning = false;
float tankLitres = 4.5;
String statusText = "OK";
void setup() {
pinMode(PUMP_PIN, OUTPUT);
}
void loop() {
soilPct = map(analogRead(SOIL_PIN), 0, 1023, 0, 100);
if (soilPct < 30) {
statusText = "DRY";
} else {
statusText = "OK";
}
digitalWrite(PUMP_PIN, pumpRunning ? HIGH : LOW);
delay(1000);
}- Decide which names become Properties. Two of them must not.
- For each Property, write its type and permission.
- Write the
addPropertylines and the callback for the pump.
It works if you have four Properties, only the pump is READWRITE, and the pump switches inside its callback.
Recap 5 min
Arduino IoT Cloud reduces "build my own HTTP + JSON + dashboard" to "declare a Property, use it like a variable". Four objects: Thing, Property, Device, Dashboard. Bidirectional sync. Free tier good for 2 Things. The library handles WiFi + MQTT + JSON + reconnection. Tomorrow you set up your first Thing.
- Arduino IoT Cloud
- Arduino's official platform for cloud-connected devices. Web IDE + cloud properties + dashboards + phone app.
- Thing
- A logical container for one device's properties. Maps to one physical device.
- Property
- A typed variable that auto-syncs between sketch and cloud. Read-only or read-write.
- Device
- A physical board (with WiFi) attached to a Thing.
- Dashboard
- A web/phone view with widgets (gauges, switches, charts) bound to properties.
- Callback (on*Change)
- A function the library calls when a read-write property is updated from the cloud side.
- ArduinoCloud.update()
- Must be called every
loop()iteration. Drives MQTT, pushes pending changes, handles incoming messages. - SECRET_SSID / SECRET_KEY
- Sensitive values stored separately (in the Web IDE's secrets manager) so they don't end up in shared sketches.
Extra Mission 5 min
Part 1 — Design a Thing for your own gadget
Pick a gadget you would like to watch or control from a phone. Try a smart lamp, a plant monitor or a doorbell. Design its Thing on paper.
Your design must include:
- The Thing's name and its one job.
- Every Property: name, type, and READ or READWRITE.
- A sketch of the dashboard, showing which widget is bound to which Property.
- One job the gadget still does when the WiFi is down.
Part 2 — Make it
Create an Arduino account and build the Thing in IoT Cloud with your Properties. Open the generated sketch and add the sensor and output code. If you have a supported board, register it and upload.
Bring back next class: a screenshot of your Thing's Properties page and the sketch. For ARD-L04-08, bring a supported board.