What an IoT system is
The four parts of every IoT system, one real temperature sensor traced from chip to phone, where decisions belong (edge or cloud) and where each hop fails.
You will learn
- Name the four parts of an IoT system and what each one does
- Trace one reading from the sensor to a phone screen
- Decide whether a given decision belongs on the device, at the edge or in the back end
- List one failure per hop and how you would notice it
This lesson is for anyone who has heard “IoT” (Internet of Things) many times and wants a working definition before buying hardware. It splits every IoT system into four parts, follows one real reading through all of them, and shows where each part breaks. There is no code here. Lesson 2 picks a board and lesson 3 flashes it.
Four parts of every IoT system
An IoT system is a set of physical devices that measure or change something in the world, plus the network and software that move that information to people or other machines. However large it gets, it has four parts.
- The device. A microcontroller with a sensor, an actuator or both. It wakes, measures, decides whether anything needs sending, and sends it. It usually runs on a small battery or a USB supply and has kilobytes, not gigabytes, of memory.
- The network. Everything between the device’s radio and the back end: a Wi-Fi access point, a Thread border router, a LoRaWAN gateway or a mobile network, plus the router, the address assignment and the name lookup that ride on top. When a box translates one radio or protocol into another, we call it a gateway.
- The back end. The software that receives the data, stores it, runs rules on it and forwards it. It can be a small Linux computer in a cupboard or a cloud service. Most back ends start with a message broker.
- The user. A person with a dashboard, a phone notification or a voice assistant, or another machine that acts on the data. The user is part of the system because the system exists for them, and because many failures only become visible at this end.
Keep this split in mind when you read product pages. A vendor that sells “an IoT platform” usually sells one or two of the four parts and expects you to supply the rest.
One system, traced end to end
The example is the battery environment sensor in our project /projects/c5-battery-environment-sensor/: an ESP32-C5 board with a Sensirion SHT45 temperature and humidity sensor on a shelf, reporting to a broker on a home server, with a dashboard on a phone. Here is one reading, hop by hop.
- Measure. The ESP32-C5 sends the SHT45 one command byte over I²C (Inter-Integrated Circuit, a two-wire bus). The sensor needs up to 8.3 ms for a high-repeatability measurement, then returns six bytes: temperature, a checksum, humidity, a checksum. Lesson 5 covers this exchange bit by bit.
- Process on the device. The firmware checks both checksums, converts the raw numbers to degrees Celsius and percent relative humidity, and decides whether the change since the last report is worth sending. Every message not sent saves radio energy, and the radio is the largest consumer on the board. The ESP32-C5 datasheet lists 87 mA peak for the chip alone while receiving on 2.4 GHz Wi-Fi, at 3.3 V and 25 °C.
- Join the network. The radio associates with the access point. The ESP32-C5 can use the 2.4 GHz or the 5 GHz band. The router then hands out an IP (Internet Protocol) address, and the device looks up the broker’s name.
- Publish. The device opens a TCP (Transmission Control Protocol) connection, adds TLS (Transport Layer Security) encryption, and sends an MQTT message to a topic such as
home/shelf/climate. MQTT is a small publish and subscribe protocol, standardised by OASIS as version 5.0 in March 2019. IANA (the Internet Assigned Numbers Authority) has registered TCP port 8883 for MQTT over TLS and 1883 for MQTT without it. - Store and act. The broker (here Mosquitto, an Eclipse Foundation project that implements MQTT 5.0, 3.1.1 and 3.1) passes the message to every subscriber. One subscriber writes it to a database. Another checks a rule such as “humidity above 70 % for an hour”.
- Show. The phone app subscribes to the same topic, or queries the database, and draws the value.
Six steps, four parts, at least three companies’ software, and the reading arrives in well under a second when everything works. The rest of this lesson is about when it does not.
Edge versus cloud
“Edge” means computing close to where the data starts: on the device itself, or on a gateway or home server in the same building. “Cloud” means a data centre you reach over the internet. Every decision in the system lives somewhere, and the right place depends on four questions.
| Question | Favours the device or edge | Favours the cloud |
|---|---|---|
| Must it work when the internet is down? | Yes: a frost alarm, a pump cut-out | No: a monthly energy report |
| How fast must it react? | Milliseconds to seconds | Minutes are fine |
| How much raw data is there? | A lot: audio, vibration, images | A few numbers per minute |
| Does it need data from many sites? | No | Yes: comparing buildings, fleet statistics |
Our shelf sensor makes one decision on the device (send or skip) and leaves the rest to the home server. A vibration monitor on a factory motor turns that round. It samples thousands of times a second, so it must reduce the data on the device and send only a summary. Moving a decision towards the edge keeps working through outages and costs less bandwidth. The price is firmware you have to update in the field. The topic hub /topics/gateways-edge-and-cloud/ goes further.
Where systems fail
Every hop in the trace above has its own failures, and each needs a way to be noticed. A silent failure is worse than a loud one, because the dashboard keeps showing the last good value.
- Device power. A battery sags in the cold and the board resets as the radio switches on. The symptom is a device that reboots every time it tries to send. Log the reset reason at start-up and report it.
- Sensor and wiring. A loose connector gives corrupted bytes. The SHT4x protects each 16-bit value with an 8-bit CRC (cyclic redundancy check), so firmware that checks it can report “sensor error” instead of a wrong temperature. Placement matters too. Sensirion’s design guide notes that at 90 % relative humidity, a 1 °C error in temperature shifts the humidity reading by about 5 %RH, so a sensor warmed by the board’s own regulator reads both values wrong.
- Radio and network. The access point reboots for an update, the lease on the IP address runs out, or the device sits at the edge of coverage. Firmware has to reconnect with a growing delay between attempts and must never wait forever. Lesson 6 builds that loop.
- Broker and connection. MQTT has three features aimed at exactly these failures. With a non-zero keep-alive interval, the broker closes the connection if it hears nothing for one and a half times that interval. A Will message, which the device registers when it connects, is published by the broker when the connection ends without a clean goodbye, so subscribers learn “shelf sensor offline” without polling. A retained message stores the last value on a topic and hands it to anyone who subscribes later, so a dashboard opened at night still shows something.
- Security and time. TLS certificates carry a validity period, and checking one requires the current time (RFC 5280, section 6.1.3), so a device without a correct clock cannot check them. A certificate that expires on a fleet of sensors stops every one of them on the same day.
- Back end. Disks fill, databases need upgrades, cloud plans change their prices or close. The data you collected should be exportable in a plain format.
- User. A notification that fires ten times an hour gets muted, and then the real alarm is missed. Alert on a sustained condition, not on single readings.
MQTT itself offers three delivery guarantees, called QoS (quality of service) levels. “At most once” may lose a message. “At least once” may deliver it twice. “Exactly once” costs the most round trips. A temperature published every minute can use the first level, because the next reading replaces a lost one. A command that unlocks a door cannot.
For makers
Start with the whole chain working on your desk before you put anything on a wall: one board, your home Wi-Fi, a Mosquitto broker on a spare computer, and a dashboard. Then break each hop on purpose. Unplug the access point, stop the broker, pull the sensor cable, and check that each failure shows up on the dashboard as a failure rather than as an old number.
For product teams
Write the four-part diagram for your product before choosing silicon, and attach an owner and a monitoring signal to every hop. Decide early which decisions must survive a lost internet connection, because that sets how much logic, storage and update machinery the device needs. Plan for certificate rotation, broker migration and the end of any cloud service you depend on. These are lifecycle costs that do not appear on the bill of materials.
Exercise
Pick an IoT device you own or would like to build, such as a smart plug, a weather station or a parcel-box sensor.
- Draw its four parts as boxes, as in the diagram above, and write the name of the real product or service in each box.
- For each box, write one way it can fail and how the user would find out. If the answer is “they would not”, write down what you would add so that they would.
- Mark each decision the system makes (for example “turn the heater on”) as device, edge or cloud, and give the reason in one line using the four questions in the table.
Summary
- Every IoT system has a device, a network, a back end and a user. Products usually cover only some of them.
- One reading crosses several protocols: I²C to the sensor, Wi-Fi to the access point, TCP and TLS to the broker, MQTT to every subscriber.
- Put a decision at the edge when it must work offline, react fast or reduce a lot of raw data.
- Each hop fails in its own way. Design so that a failure shows up as a failure, using checksums, reconnect logic, MQTT keep-alive, Will and retained messages.
Further reading
- OASIS, MQTT Version 5.0, OASIS Standard, 7 March 2019: sections 3.1.2 (keep alive and Will) and 4.3 (QoS levels).
- Espressif Systems, ESP32-C5 Series Datasheet, v1.5: section 5.6 for radio current figures.
- Sensirion, Datasheet SHT4x, version 7.3: section 4 for the command and checksum format.
- Sensirion, Design Guide for Humidity and Temperature Sensors, version 2: section 3 on thermal placement.