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.
Try It Yourself · Paper exercises 15 min
Which is the right Property type for: (a) garden temperature in °C, (b) whether the pump is on, (c) the GPS location of a wandering robot?
Reveal
(a) Temperature (float-derived, with °C unit). (b) Boolean (read-write). (c) CloudLocation (lat/lon, drives a map widget).
You want a dashboard with two devices (chassis + plant monitor) talking to it. Can you do this on the free tier?
Reveal
Yes — 2 Things = 2 devices. The dashboard can show widgets from both Things. The free tier covers exactly this. Add a third Thing → need to upgrade.
Your sketch must run offline too — even when WiFi is down. Will Arduino IoT Cloud get in the way?
Reveal
The library handles offline gracefully: properties stay at their last value, callbacks don't fire, ArduinoCloud.update() returns quickly. Your sketch's other logic continues. When WiFi returns, the library re-syncs.
BUT: dashboards show stale data while offline. Plan for that in your UX.
If you stop paying for the Maker tier, what happens to your old data?
Reveal
Properties keep working (up to free-tier limits). Historical data older than the free-tier retention is purged. Dashboards beyond the free limit become inaccessible until you upgrade. Don't treat IoT Cloud as long-term archival storage — export critical data periodically.
Mini-Challenge · Sketch the Thing for a project 10 min
- Pick one project (smart lamp, plant monitor, doorbell, chassis).
- Name the Thing.
- List the Properties: name + type + read-only vs read-write.
- Sketch the dashboard: which widgets, what each one's bound to.
Example: smart plant
Thing: GardenPlant Properties: - moisturePct int READ - temperatureC Temperature READ - pumpEnabled bool READWRITE - waterNow bool READWRITE (momentary -> false on the sketch side) - lastWatered CloudTime READ Dashboard widgets: - Gauge bound to moisturePct - Chart bound to temperatureC (24h) - Switch bound to pumpEnabled - Button bound to waterNow - Last-watered text bound to lastWatered
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.
Homework 5 min
- Create an Arduino account (or sign in). Click around the IoT Cloud editor and dashboards.
- If you have a supported board, follow the on-screen wizard to add it as a Device — no sketch needed yet, just register it.
- Read ahead to ARD-L04-08 (Setting Up a Thing). Bring a supported board to next class.