Marcio Cunha

Industrial IoT Device Integration with CoAP in Mesh Networks

Learn how to connect industrial sensors using the lightweight CoAP protocol over low-power mesh networks, ensuring battery efficiency and reliable data delivery in factory environments.

Marcio Cunha•2 min
Also available in:EspañolPortuguês
Summary
  • Mesh networks allow devices to forward packets between themselves, creating alternative paths when physical interference occurs in a factory.
  • The CoAP protocol consumes low bandwidth and energy, functioning similarly to traditional HTTP but optimized for simple microcontrollers.
  • Transparent translation between CoAP and HTTP in industrial gateways simplifies direct connection with cloud servers and monitoring systems.
  • The proper use of observable messages avoids constant polling, reducing network traffic without missing critical sensor events.
  • Security strategies based on lightweight cryptography guarantee the integrity of commands sent to actuators in remote factory environments.

The Connectivity Challenge in Industrial Plants

Real industrial environments are typically harsh for radio signals. Thick metal structures, high-power electric motors, and reinforced concrete walls create barriers that prevent direct communication between distant sensors and the central control panel. In practice, this means a temperature sensor installed at the back of a warehouse often fails to reach the main antenna in isolation.

To bypass this physical obstacle without resorting to kilometers of expensive and hard-to-maintain network cables, modern engineering relies on decentralized radio topologies. Instead of every device trying to speak directly to the central router, each IoT device acts as a signal repeater. Data from one sensor hops from one equipment to another until it finds an exit to the main network.

Understanding the CoAP Protocol for Low-Power Environments

When dealing with industrial devices, most run on tiny batteries or small solar panels and feature very limited processors. Using traditional HTTP would be like trying a heavy-duty transport task using a bicycle. HTTP demands significant memory and processing power, which would drain a sensor's battery in a few days.

This is where CoAP (Constrained Application Protocol) comes in, a lightweight protocol specifically designed for resource-constrained networks. In practice, CoAP works like a lean cousin of HTTP. It uses simple and familiar commands, such as requesting data (GET) or sending updates (PUT), but compresses all that information into tiny packets traveling via UDP (User Datagram Protocol, a transmission format where the sender dispatches data without waiting for a prior connection confirmation, saving time and energy).

The Architecture of Low-Power Mesh Networks

Combining CoAP with mesh networks requires a well-planned radio infrastructure. Mesh technology ensures resilience: if a network node fails or is shut down for maintenance, neighbors automatically recalculate the route and reroute traffic in fractions of a second. This eliminates single points of failure and keeps the system operating even under adverse conditions.

However, low-power mesh networks operate with limited radio channels and reduced transmission rates. To prevent congestion, CoAP messages must be designed to carry only the essentials. Using compact binary formats, such as CBOR (Concise Binary Object Representation, a way to pack structured data into fewer bytes than traditional JSON format), ensures each packet occupies the minimum possible space on the air.

Implementing Efficient Communication with CoAP

To illustrate the simplicity of an IoT node sending data via CoAP, we can look at a C code example using lightweight libraries like libcoap. The snippet below demonstrates creating a basic temperature update message to be dispatched across the network.

#include <coap/coap.h>void send_temperature(coap_context_t *ctx, coap_address_t *dst) {  coap_pdu_t *pdu = coap_pdu_init(COAP_MESSAGE_CON, COAP_REQUEST_CODE_PUT, coap_new_message_id(ctx));  coap_add_option(pdu, COAP_OPTION_URI_PATH, (unsigned char *)