This article was originally posted on IoT for All.
CoAP is cool.
Don’t get me wrong. I am not saying CoAP is better than MQTT or any protocol, but CoAP is the right tool for IoT solutions using LPWAN for connectivity.
Constrained Application Protocol (CoAP) or RFC 7252, as the IETF calls it, is the perfect choice for solutions needing to get data from devices to the cloud where economic or technical constraints are present. Not sure if CoAP is right for you? Ask yourself the following questions:
- Do you have device computational or memory limitations? Or want to use the least costly device to limit capital expenditures?
- Is device-side battery-life or energy consumption important to your TCO/ROI? Do you want to maximize device-lifespan exceeding ten years?
- Are you working with lossy LPWANs like NB-IoT or Wi-Sun or want to report data in the most efficient way possible?
An open secret in IoT is MQTT built on TCP, while great at reporting data is too heavy for NB-IoT and other LPWANs. The IETF and contributors designed CoAP to address these constraints.
However, once you’ve delivered data over the network using CoAP, you have a different but easier challenge to manage. While CoAP is excellent at transferring data over lossy LPWANs, much of the cloud is built on TCP and MQTT messaging, creating a different set of issues.
The answer is pretty straight forward and much easier to deal with than the energy-device-networking constraints CoAP addresses. An optimized CoAP bridge, hosted in the cloud, can securely manage connections and data collection, republishing the data as cloud-native MQTT.
Need more proof CoAP is cool? Here are four external sources:
- You’ll find the telecom perspective in Deutsch Telekom’s Narrowband IoT Solution Guide. They likewise recommend CoAP for these same types of solutions. If you look at page four, DT specifically says MQTT is a “no-no” for NB-IoT.
- Jonathan Beri’s September 2020 post A Field Guide to CoAP, Part 1–Everything related to the Constrained Application Protocol I wish I knew when I started in IoT is a comprehensive explanation from the developer’s perspective.
- Quantitative details of how transport protocol choice impacts performance, take some time to review the 2019 research paper Impact of CoAP and MQTT on NB-IoT System Performance.
- In their June 2020 Hype Cycle for IoT Protocols and Standards report, Gartner declared, “CoAP for low-power networks increases reliability while allowing easy integration with existing internet technologies.”
Enough with the tech talk. The chief benefit of using CoAP over NB-IoT and other LPWANs is efficiency, and in massive IoT, efficiency comes back to money.
Take smart metering for water and gas as a use-case. Many smart metering solutions rely on batteries for electricity. Better energy efficiency extends device lifespans, improving total cost of ownership and return on investment.
Another factor is device cost. The smaller the device flash memory footprint, the less powerful the CPU, the lower the initial device costs. However, this also increases device resource constraints CoAP’s helps overcome.
Massive IoT solutions, like smart metering, are dominated by simple logic. Even the smallest return multiplied by many devices can be huge, and hence no stone is left unturned regarding total solution performance.
Secondary benefits include reducing network utilization and corresponding costs and more efficient use of cloud resources resulting in cloud vendor savings.
You can find free CoAP clients for Linux, Zephyr RTOS, and Amazon Free RTOS on IoTerop’s Github page.
Once your CoAP client is up and working, you’ll need to sign up and use IoTerop’s Nebraska to ensure you can transmit data back and forth from the cloud or find another CoAP cloud MQTT broker.
IoT changes the cost of collecting and acting upon data. Massive IoT extends that logic to the point where we are measuring picoamps and shaving bits off of each message to improve total solution performance.
Yes, IoT is about data, but beyond data, the winners from IoT will be the organizations who figure out the least expensive way to collect and act upon data.
Want to learn more? Read Part II of this article: OSCORE for IoT Security: Building Sustainable LPWAN Solutions.