Design, Implementation and Testing of a CoAP Library on a Constrained System for Air Quality Measurements
|31. July 2019
|Design, Implementation and Testing of a CoAP Library on a Constrained System for Air Quality Measurements
|Constrained Application Protocol (CoAP) is an Internet of Things (IoT) protocol for use on constrained devices. We explore if it could be used as a viable alternative to Hypertext Transfer Protocol (HTTP) on an esp8266 based air quality sensor. Therefore, we use the luftdaten.info project that provides assembly instructions and a firmware for measuring particulate matter concentrations using an esp8266 and a SDS011. We extend this firmware with a self written library to support CoAP. Furthermore, we us a cross-protocol proxy to push sensor values to the HTTP based Application Programming Interface (API). In comparison to the HTTP base version, our implementation requires less flash memory. When using CoAP it takes longer to push values to the API because it takes some time to construct a CoAP message and a full HTTP exchange still takes place. CoAP uses less bandwidth than HTTP. Largely because of the smaller header size in User Datagram Protocol (UDP) but also because of how CoAP encodes information. We implement and test the CoAP observe extension. Notifications are triggered using a threshold based strategy. The observe extension saves a large number of exchanges espe- cially when monitoring temperature or humidity. CoAP can be used in combination with a cross-protocol proxy to work on a HTTP API especially when no custom options are required. When bandwidth is of importance, it is also suitable.