Skip to content
LSLab

Overview of Firmware and IoT Networking

  • Starter
  • Article
  • Ages 10+
  • 4 min read
A microcontroller board connects by USB to a laptop, with a wireless router behind it.

Firmware is the program that is built and then flashed onto an IoT device's board. In an Arduino sketch, setup() runs once and loop() repeats continuously; other firmware frameworks can use a different structure. To send data over a network, a device can use a lightweight protocol such as MQTT, and NIST has guidance for manufacturers.

Contents
The program on the board sends data over the network.
  • Board running firmware
  • Server on the network

What you will learn

Before you start

It helps to know what an ESP32 or Arduino board is.

How is firmware built and flashed?

ESP-IDF is the official development framework for the ESP32 series of chips. A simple example shows how to build and flash firmware onto an ESP32 board.

Code is built on a computer and then flashed onto the board.
  • Computer with ESP-IDF
  • Built firmware
  • ESP32 board

How do setup() and loop() run?

The setup() function runs once when the sketch runs. The loop() function repeats continuously.

The preparation runs once and the main part repeats forever.
  • setup() runs once
  • loop() runs
  • Back to loop()

How does MQTT put data on the network?

MQTT is a Client Server publish/subscribe messaging transport protocol. MQTT is light weight, open, simple and designed to be easy to implement. At QoS 2, message delivery is exactly once in the protocol exchange; this alone does not guarantee exactly-once application processing end to end.

On security, NIST publishes guidance for manufacturers and supporting parties creating IoT devices and products.

The device publishes, the server passes it on to subscribers, with security guidance alongside.
  • Publishing device
  • MQTT server
  • Subscriber
  • Security guidance

Real-world example

With an adult, think of a soil moisture sensor. In this hypothetical example, an Arduino sketch reads the sensor in loop(), then sends the reading over MQTT for an app to show.

Common misunderstandings

Every firmware uses setup() and loop(). Those functions describe the Arduino sketch structure; other frameworks, such as ESP-IDF, use different program structures.

MQTT is a heavy protocol, hard to use on small devices. MQTT is light weight, open, simple and designed to be easy to implement.

Frequently asked questions

What is ESP-IDF?

The official development framework for the ESP32 series of chips.

How do setup() and loop() differ?

setup() runs once, while loop() repeats continuously.

What is MQTT?

A publish/subscribe messaging transport protocol.

Who publishes security guidance for IoT devices?

NIST publishes guidance for manufacturers and supporting parties.

Summary

Terms in this article

English and Vietnamese terms, with the meanings used here. Hover, tap or Tab to a term with a dotted underline for an explanation as you read.

Firmware
A program that is built and then flashed onto a device's board.
ESP-IDF
Espressif's official development framework for ESP32 chips.
setup() and loop()setup() và loop()
The two functions of an Arduino sketch: one runs once, the other repeats continuously.
MQTT
A lightweight publish/subscribe messaging transport protocol.
Quality of serviceChất lượng dịch vụ
MQTT message delivery levels: QoS 0 at most once, QoS 1 at least once, and QoS 2 exactly once at protocol level.

This article is not marked as viewed

Spotted something wrong or unsafe?

Tell the administrator by email. The message already has the article title and address.

Report this article
  • A compact microcontroller board with a metal shield is wired to a temperature sensor.
    Basic

    How Does an ESP32 Board Run and Communicate?

    An ESP32 board pairs an ESP32 module with a USB port and pin headers. See its parts, how firmware is loaded over serial, and its Wi-Fi and Bluetooth.

    Internet of Things (IoT)4 min read
  • A full-size microcontroller development board and a small wireless module sit side by side.
    Starter

    Overview of ESP32, Arduino and Other Boards

    An overview of ESP32 and Arduino boards and how to choose by connectivity, voltage, power and microcontroller.

    Internet of Things (IoT)4 min read
  • An industrial controller and a DIN-rail digital meter are connected by cable on a test bench.
    Basic

    How Does Modbus RTU Exchange Data?

    Modbus RTU works by request and response between a master and slaves. See addresses, function codes, error checks and how frames are split by silent gaps.

    Internet of Things (IoT)4 min read
  • Three measurement modules connect along one shared red-and-black twisted-pair cable.
    Basic

    How Does RS-485 Transmit Differential Signals?

    RS-485 sends signals over two wires and compares the voltage between them, so it resists noise, reaches far and lets many devices share one line.

    Internet of Things (IoT)4 min read
See all articles of the topic

Sources

These sources are written for older readers. If they feel hard, read them with an adult.