AVSystem Blog on Information and Communication Technology

NB-IoT: Why CoAP and LwM2M Outshine MQTT – Smart Water Metering Example

Written by AVSystem | 05/09/2024

Selecting the right communication protocol for Narrowband IoT (NB-IoT) deployments is a strategic decision with long-term implications. The wrong choice can lead to increased costs, reduced device lifespan, and compromised performance. While MQTT is widely used across various IoT applications, its suitability for NB-IoT, particularly in critical use cases like smart water metering, is questionable. This article will examine the limitations of MQTT in NB-IoT environments and highlight why CoAP and LwM2M are more appropriate alternatives, focusing on their strategic advantages for such a case.

Strategic Pitfalls of MQTT in NB-IoT Deployments

1.Overhead and Efficiency Challenges

In NB-IoT, minimizing data transmission is crucial due to the limited bandwidth and the need for extended battery life. MQTT, though lightweight in many contexts, introduces considerable overhead in NB-IoT environments. Its control packets (CONNECT, PUBLISH, SUBSCRIBE, etc.) carry more data than necessary, consuming valuable bandwidth and increasing power consumption. Over time, this inefficiency leads to higher operational costs — shortened battery life, increased data usage, and the need for more frequent device maintenance.


For instance, in a large-scale smart water metering deployment, where devices are expected to transmit data over many years, (very often the digital meter has an expected battery life of 10–15 years) the overhead from MQTT could result in significantly higher battery replacement costs. This not only increases operational expenses but also disrupts the continuous monitoring that is vital for accurate water usage tracking.


2.Connection Reliability and Latency Concerns

 

 

MQTT relies on a persistent TCP connection, which poses challenges in NB-IoT’s typical environments — often characterized by poor connectivity and devices operating in hard-to-reach areas. TCP’s connection-oriented nature adds latency and increases power consumption, as devices must maintain these connections even when network conditions are suboptimal.

In NB-IoT deployments like underground smart water meters, where connectivity is intermittent, MQTT's reliance on TCP can lead to frequent reconnections, each consuming additional power and potentially delaying critical data transmission. This latency can cause gaps in data collection, which compromises the accuracy of water usage reporting and billing.

For instance, the study 'Performance of TCP and UDP over Narrowband Internet of Things (NB-IoT)' demonstrated that using TCP for a typical NB-IoT application resulted in a packet loss of about 90%, whereas UDP only experienced a packet loss of around 3%.

3. Resource Constraints

Devices using NB-IoT connectivity are generally resource-constrained, with limited processing power and memory. MQTT’s requirement for maintaining the state and handling the complexities of TCP connections places a strain on these devices. For instance, a water meter with limited computational capacity might struggle to maintain an MQTT over TCP connection, leading to failures in data transmission or increased power usage that reduces battery life.

In large-scale deployments, such as a city-wide smart water metering system, the cumulative effect of these resource constraints can lead to significant challenges in managing and maintaining the network. This can drive up costs and complexity, impacting the overall ROI of the project.


4.Security Implications


MQTT does not include built-in security features, relying instead on transport layer security like TLS. However, implementing TLS on NB-IoT devices is resource-intensive and can lead to increased power consumption. Given that NB-IoT devices like smart water meters are expected to operate securely for many years without direct maintenance, the lack of a streamlined security solution in MQTT presents a significant risk. If a water meter’s security is compromised due to the complexities of implementing TLS, the resulting data breaches could undermine trust in the system, lead to regulatory penalties, and increase costs related to repairs and device replacement.

 

 


Why CoAP and LwM2M are Strategic Fits for NB-IoT?

CoAP and LwM2M are designed to address the specific challenges of low-power, low-bandwidth environments like NB-IoT. Their strategic benefits lie in their efficiency, reliability, and integrated security, making them ideal for long-term NB-IoT deployments.

1.CoAP - A Lean and Efficient Protocol


CoAP (Constrained Application Protocol) is built to operate primarily over UDP, making it inherently more efficient for NB-IoT’s characteristics. Unlike MQTT, CoAP does not require a persistent connection, which reduces overhead and conserves power. CoAP can also operate over TCP when necessary, providing flexibility depending on the network conditions and reliability requirements.

Message Efficiency 

 

CoAP messages are smaller and simpler than MQTT’s, reducing the data payloads that need to be transmitted. For example, in a smart water meter deployment, this efficiency allows each meter to send data with minimal power usage, extending battery life and reducing the need for replacements.

Asynchronous Communication

CoAP supports asynchronous communication, allowing devices to transmit data only when necessary, rather than maintaining an always-on connection. This is particularly advantageous in NB-IoT environments, where meters might only need to send usage data periodically, further conserving energy.

Lower Latency 

Operating over UDP, CoAP avoids the latency issues associated with TCP. This is crucial in environments with intermittent connectivity, where quick reconnections and minimal overhead ensure that data is transmitted reliably without unnecessary delays. In a scenario where thousands of water meters need to report data daily, CoAP’s ability to transmit data with minimal latency and overhead ensures that the network remains efficient and that devices can operate for extended periods without intervention.

2. LwM2M - Optimized for IoT Device Management

The Lightweight M2M (LwM2M) protocol is primarily built on top of CoAP but is also compatible with other transport protocols such as SMS, MQTT, and HTTP, making it versatile, specifically for managing IoT devices in constrained environments like NB-IoT. It offers a comprehensive, standardized framework for IoT device management, which includes device configuration, firmware updates, and status monitoring. These standardized IoT management objects and operations ensure consistency and interoperability across different devices and vendors, making LwM2M particularly valuable for large-scale deployments such as smart water metering.

Efficient IoT Device Management 

LwM2M provides standardized tools for managing IoT devices remotely. It supports remote firmware updates, remote configuration  changes, and real-time troubleshooting, eliminating the need for physical access to devices. This reduces maintenance costs and ensures that devices remain secure and up-to-date, vital for the long-term success of large-scale deployments.

Scalability 

LwM2M ensures scalability by using a hierarchical resource model for efficient batch operations and resource observation to reduce network traffic. It also employs CBOR (Concise Binary Object Representation) encoding and block-wise transfers, minimizing data size and transmission overhead, allowing large IoT networks to grow without increased complexity or resource strain.

Integrated Security  

In a typical NB-IoT deployment, LwM2M leverages DTLS, to secure UDP/CoAP communications. Unlike TLS in MQTT, which requires complex session management due to its connection-oriented design, DTLS operates over connectionless UDP, simplifying session handling and reducing resource strain. This makes security management easier, as DTLS can handle intermittent connections typical in NB-IoT without needing to re-establish sessions frequently. For large-scale deployments like smart water metering, this means less overhead in maintaining secure communications, fewer disruptions, and lower power consumption, all while ensuring robust encryption, authentication, and data integrity.

Conclusions

Selecting the right protocol for your deployment utilizing NB-IoT connectivity is a decision that directly affects operational efficiency, device longevity, and overall project success. While MQTT has its strengths, the specific demands of NB-IoT — such as efficient power use, seamless scalability, and simplified security management — often make CoAP and LwM2M more suitable. Ultimately, the choice depends on carefully balancing these requirements with the unique constraints and goals of your IoT application.