IoT Systems

The Internet of Things connects embedded devices to the cloud. Learn IoT architecture, wireless technologies (Wi-Fi, BLE, Zigbee, LoRaWAN, NB-IoT), MQTT, power budgets, security, OTA updates and edge computing.

An IoT device measures or controls something physical and shares data over a network: a smart meter reporting consumption, a soil sensor on a farm, a factory machine streaming vibration data, a thermostat controlled from a phone.

Designing one means balancing four constraints at once: connectivity (range, bandwidth), power (often years on a battery), cost and — critically — security, because every connected device is a potential entry point.

An analogy

An IoT system is like a postal network: sensors write postcards (data), gateways are local post offices, the cloud is the sorting centre, and security is the sealed, signed envelope that stops forgeries.

Architecture

Device (sensor/actuator + MCU + radio) → gateway or access point → network → cloud platform (ingest, storage, analytics, dashboards, rules) → users and applications. Edge computing processes data locally to reduce bandwidth and latency.

Choosing connectivity

Each radio technology targets a different range, data rate and power budget.

MQTT and data design

MQTT's lightweight publish/subscribe model suits constrained devices: devices publish to topics, applications subscribe. Choose QoS (0 at most once, 1 at least once, 2 exactly once), retain flags and last-will messages. Send compact payloads (CBOR, binary) and only when data changes meaningfully.

Security by design

Unique per-device credentials (no shared passwords), TLS/DTLS encryption, secure boot so only signed firmware runs, signed OTA updates with rollback, hardware secure elements for keys, minimal open ports, and a plan for patching over the device's lifetime. Regulations (EU Cyber Resilience Act, ETSI EN 303 645) now require much of this.

Fleet operations

Real deployments involve provisioning thousands of devices, monitoring health (battery, RSSI, reboots), staged OTA rollouts, and digital twins/device shadows that store the desired and reported state of each device in the cloud.

Formulas

Worked example: LoRaWAN duty-cycle limit

Given: Packet time on air = 50 ms; Duty-cycle limit = 1 %

Find: Shortest allowed interval between packets.

Answer: One packet every 5 s at most

Worked example: MQTT data volume

Given: 100-byte message every 60 s

Find: Daily data.

Answer: ≈ 144 kB/day

Publishing a sensor reading over MQTT (ESP-IDF style)

#include "mqtt_client.h"

static void publish_reading(esp_mqtt_client_handle_t client, float temp_c) {
    char payload[64];
    int n = snprintf(payload, sizeof payload,
                     "{\"temp\":%.2f,\"ts\":%lld}", temp_c, (long long)time(NULL));
    // topic hierarchy: site/device/metric ; QoS 1 = at-least-once delivery
    esp_mqtt_client_publish(client, "farm1/node17/temperature", payload, n, 1, 0);
}

void app_main(void) {
    esp_mqtt_client_config_t cfg = {
        .broker.address.uri = "mqtts://broker.example.com:8883",  // TLS
        .credentials.client_id = "node17",
    };
    esp_mqtt_client_handle_t client = esp_mqtt_client_init(&cfg);
    esp_mqtt_client_start(client);
    publish_reading(client, read_temperature());
    esp_deep_sleep(15ULL * 60 * 1000000);   // sleep 15 minutes, then reboot & repeat
}

MQTT decouples devices from applications via topics on a broker; mqtts:// adds TLS. Deep sleep between reports is what makes battery operation possible.

Common mistakes

Applications

Key takeaways

Going further