Learn / IoT and AI at the edge / Connected devices

Connected Embedded Devices

ReviewedBeginnerFreeAbout 5 min
23.4°CSSD1306
In short

Connected Embedded Devices: the short answer

A connected device combines local measurements or controls with a communication path and a secure destination. A useful end-to-end system includes acquisition, local processing, network transport, remote storage/display and recovery. Example: Each arrow is a place it can break, and the design says what happens when it does.

Level
Beginner
Time
About 5 min
Topic
IoT and AI at the edge
You will learn to

Sketch a connected device end to end and plan what happens when each link fails.

Before this: Arduino and ESP32 Basics

A connected device combines local measurements or controls with a communication path and a secure destination.

A useful end-to-end system includes acquisition, local processing, network transport, remote storage/display and recovery. Design separately for offline behavior, stored credentials, bandwidth and power.

Draw a block diagram for a local room monitor. Specify what happens if the sensor fails versus if Wi-Fi fails; one affects measurement trust and the other affects communication availability.

Five stages, five places to fail

A connected device does five jobs: it senses or controls something, processes the data locally, sends it across a network, stores or shows it somewhere, and recovers when something breaks. Drawing it as a chain of boxes shows where each failure can occur: the sensor, the controller, the Wi-Fi link, the server, the dashboard.

Good design decides in advance what each failure should do. A sensor fault should be reported as a fault, not sent as a zero. A Wi-Fi outage should not stop measuring.

Work offline first

Home Wi-Fi drops, routers reboot, and a server may be down for a day. A device that only works with a live connection stops being useful at the first outage. Keep recent readings in memory or on flash, show them on a local display, and send the backlog when the link returns, with the original timestamp on each reading.

Handle time on purpose. A device with no clock stamps readings with the moment they arrive, which is wrong after an outage. Use NTP to set the time when the network is up and keep counting with the internal timer while it is down.

Choosing how to send data

HTTP posts are simple and good for a reading every few minutes. MQTT keeps one small connection open and lets many devices publish and subscribe through a broker, which suits dashboards and several sensors. Bluetooth Low Energy suits a phone nearby with very little power. Pick the simplest one that meets your need, and keep the message small: a few numbers and a timestamp.

Decide how often to send. Sending every second drains a battery and fills a database for no benefit if the temperature changes slowly.

Security from the first day

Never put passwords or tokens into code you share or upload. Keep them in a separate file that is not committed. Use a unique credential per device so that one lost device can be disabled. Use encrypted connections (TLS, or MQTT over port 8883) where the board supports them, and change any default password before the device goes anywhere on the network.

Do not expose a device to the internet directly through your router. Let it call out to a service, rather than letting the internet call in.

Power and updates

Wi-Fi is the largest consumer of power on an ESP32. A device on batteries should wake, measure, connect, send and go back to deep sleep, which can make it last months. A device that is hard to reach needs a way to update its firmware, and a way to go back if an update fails.

Common mistakes
  • Sending sensor errors as real readings, so the dashboard shows a flat line at zero.
  • Hard-coding the Wi-Fi password in code that ends up on a public repository.
  • Assuming the network is always there and having no offline plan.
Worked example

Block diagram for a room monitor

  1. Sensor (BME280) → ESP32 over I²C.
  2. ESP32 → home Wi-Fi → MQTT broker.
  3. Broker → phone app dashboard.
  4. If the sensor fails: send an error state. If Wi-Fi fails: keep readings and show them on the OLED.

Result. Each arrow is a place it can break, and the design says what happens when it does.

Try it

Sketch sensor → microcontroller → network → dashboard.

Check yourself

3 quick questions

  1. What carries readings from an ESP32 to a phone in the MQTT build?

  2. Wi-Fi drops for ten minutes. A good device…

  3. A sensor failure and a network failure affect…

Common questions

What will I learn in "Connected Embedded Devices"?

Sketch a connected device end to end and plan what happens when each link fails.

How do I block diagram for a room monitor?

Sensor (BME280) → ESP32 over I²C. ESP32 → home Wi-Fi → MQTT broker. Broker → phone app dashboard. If the sensor fails: send an error state. If Wi-Fi fails: keep readings and show them on the OLED. Each arrow is a place it can break, and the design says what happens when it does.

What carries readings from an ESP32 to a phone in the MQTT build?

A broker. The device publishes to a broker; the phone subscribes.

Wi-Fi drops for ten minutes. A good device…

Keeps measuring and sends later. Keep working locally and catch up when the network returns.

A sensor failure and a network failure affect…

Trust in data versus delivery of data. One makes readings wrong, the other only delays them.