Research and Implementation of CoAP Protocol in Wireless Internet of Things

Since many devices in the Internet of Things are resource-constrained, that is, only a small amount of memory space and limited computing power, the traditional HTTP protocol application is too large and not applicable on the Internet of Things. The IETF's CoRE working group proposed a CoAP protocol based on the REST architecture. CoAP is an application layer protocol in the 6LowPAN protocol stack. After describing the content, features and interaction model of the CoAP protocol in detail, this paper uses the ConTIki embedded operating system on the uIPv6 START KIT wireless network development kit, which not only implements the CoAP protocol on the browser side but also uses its own client. The program implements the CoAP protocol, which increases the interaction function with the database, thereby realizing the function of not only viewing real-time data but also viewing historical data on the web interface.

0 Preface

The Internet of Things is a network that extends and expands on the basis of the Internet. Its client extends and extends to any item, exchanges information and communicates with each other. The purpose is to realize the connection between all items and the network, so as to facilitate identification and management. And control.

The characteristics of the wireless Internet of Things include: comprehensive sensing, accurate delivery of item information in real time, and intelligent data analysis and processing of massive data to achieve intelligent control.

Since many devices in the wireless Internet of Things are resource-constrained, these devices have a small amount of memory space and limited computing power. To this end, the CoRe (Constrained RESTful Environment) working group of the IETF (Intemet Engineering Task Force) develops an application layer protocol in the form of REST (RepresentaTIonal State Transfer) for the restricted node. This is the CoAP (Constrained ApplicaTIon Protocol) protocol being developed by the CoRE Working Group.

1 6LoWPAN protocol stack

Since the TCP/IP protocol stack is not suitable for resource-constrained devices, a 6LoWPAN (IPv6 over Low power Wireless Personal Area Networks) protocol stack is proposed. CoAP is an application layer protocol in the 6LoWPAN protocol stack. 6LoWPAN makes IPv6 available for low-power, lossy networks based on the IEEE 802.15.4 standard. The 6LoWPAN protocol stack is shown in Figure 1.

The lower two layers of the protocol stack use 802.15.4 PHY/MAC with an IPv6-6LoWPAN adaptation layer in between, the transport layer uses UDP protocol, and the application layer uses CoAP protocol. It includes the smallest subset of REST and stateless mapping to HTTP. The communication host uses the CoAP protocol to support a stable communication architecture to enable wireless connection of sensor nodes to the Internet.

2 CoAP Agreement

In March 2010, the CoRE working group began to develop the CoAP agreement, which has not yet been finalized. The CoAP protocol is an application layer protocol for resource-constrained devices in the Internet of Things. It is a network-oriented protocol that uses features similar to HTTP. The core content is resource abstraction, RESTful interaction, and extensible header options. The application obtains the resources on the server through the URI identifier, that is, the GET, PUT, POST, and DELETE operations can be performed on the resource like the HTTP protocol. The CoAP protocol has the following characteristics: (1) Header compression: CoAP includes a compact binary header and an extended header. It has only a short 4 B basic header, and the basic header is followed by an extended option. A typical request header is 10 to 20 B. Figure 2 is the information format of the CoAP protocol.

The meanings of the fields in the header part are as follows: V (Version) indicates the version number of the CoAP protocol; T (Type) indicates the information type of the message; OC (OpTIon Count) indicates the number of optional options after the header; Code indicates the type of the message: A request message, a response message, or an empty message; a Message ID indicating a message number for repeating message detection, matching message types, and the like.

(2) Methods and URIs: In order to implement resources on the client access server, CoAP supports methods such as GET, PUT, POST, and DELETE. CoAP also supports URIs, which are the main features of the Web architecture.

(3) The transport layer uses the UDP protocol: The CoAP protocol is built on top of the UDP protocol to reduce overhead and support multicast functions. It also supports a simple stop and wait reliability transfer mechanism.

(4) Support for asynchronous communication: HTTP does not apply to M2M (Machine-to-Machine) communication, because transactions are always initiated by the client. The CoAP protocol supports asynchronous communication, which is a common sleep/wake mechanism for M2M communication applications.

(5) Support resource discovery: In order to autonomously discover and use resources, it supports built-in resource discovery format for discovering resource lists on devices, or for devices to announce their own resources to service directories. It supports the format in RFC5785, which uses the path of /.well-known/core in CoRE to represent the resource description.

(6) Support for caching: The CoAP protocol supports caching of resource descriptions to optimize its performance.

(7) Subscription mechanism: CoAP uses asynchronous communication mode, and uses the subscription mechanism to implement message push from the server to the client. Implement CoAP publishing, subscription mechanism, which is a resource post-processing program that is automatically registered after the request is successful. It is configured by the default EVENT_ and PERIODIC_RESOURCEs. Their event and polling handlers are published using the EST.notify_subscri bers() function.

2.1 CoAP Protocol Stack Figure 3 is the CoAP protocol stack. The transport layer of the CoAP protocol uses the UDP protocol. Due to the unreliability of UDP transmission, the CoAP protocol adopts a two-layer structure, defines a transaction mechanism with retransmission, and provides functions such as resource discovery and resource description. CoAP uses as small a load as possible, which limits fragmentation.

The transaction layer is used to handle the exchange of information between nodes, while providing functions such as multicast and congestion control. The Request/Response layer is used to transmit request and response information for operations on resources. The REST architecture of the CoAP protocol is based on the communication of this layer. CoAP's two-layer processing method makes CoAP not use the TCP protocol, and can also provide a reliable transmission mechanism. The retransmission of the CON (Confirmable) message is implemented using the default timer and the exponentially increasing retransmission interval until the receiver sends an acknowledgment message. In addition, CoAP's two-tier approach supports asynchronous communication, which is one of the key requirements for IoT and M2M applications.

2.2 CoAP subscription mechanism The HTTP request/response mechanism assumes that transactions are initiated by the client and are usually called pull models. This results in the client not being able to efficiently know that the devices are wireless low-power devices that are mostly dormant and therefore cannot respond to polling requests. CoRE believes that supporting the local push model is an important requirement, that is, the server initiates the transaction to the client. The push model requires a subscription interface to request responses to changes about specific resources. Since the transmission of UDP is asynchronous, no special notification message is needed. The subscription mechanism is shown in Figure 4.

2.3 CoAP Interaction Model CoAP uses a request/response model similar to HTTP: the CoAP endpoint sends the client one or more requests as a client, and the server replies to the client's CoAP request. Unlike HTTP, CoAP requests and responses do not need to establish a connection before sending, but instead use CoAP information for asynchronous information exchange. The CoAP protocol uses UDP for transmission. This is achieved by the reliability of the information layer options. CoAP defines four types of information: provable CON (Confirmable) information, unverifiable NON (Non-Confirmable) information, ACK (Acknowledgement) information and reset information RST (Reset). Method code and response code are included in this information to implement request and response functions. These four types of information are transparent to the request/response interaction.

The CoAP's request/response semantics are contained in the CoAP information, which contains the method code and the response code, respectively. The CoAP option includes optional (or default) request and response information, such as URI and payload content type. The token option is used to independently match the underlying request-to-response information.

Request/Response Model: The request is contained in verifiable or unverifiable information. If the server is immediately available, its response to the request is contained in a verifiable confirmation message to answer. 5 is a basic GET request and response mode, in which FIG. 5(a) shows a successful transmission request and an ACK confirmation message received, and FIG. 5(b) shows that the request information is retransmitted, and then the ACK confirmation information is received.

Although the CoAP protocol is currently under development, the Contiki and TinyOS embedded operating systems already support the CoAP protocol. Contiki is a multi-tasking operating system with uIPv6 protocol stack for embedded systems and wireless sensor networks. It occupies small system resources and is suitable for resource-constrained networks and devices. Currently, the Firefox browser has integrated the Copper plugin to implement the CoAP protocol. However, this method can only read real-time data on sensor nodes, but not all kinds of historical data. To this end, based on the Contiki system, based on the uIPv6START KIT wireless network development kit, the client program written by itself implements the interaction with the database, and stores the historical data in the database, so that not only the sensor can be accessed on the web browser side. Real-time data on the nodes, as well as historical data to analyze problems.

Rectifier Diode(Standard Diode) utilizes the unidirectional conductivity of the diode, which can convert the alternating current of alternating direction to a pulsating direct current of a single direction. Rectifier diode – diode designed for rectifying alternating current (mostly with low power frequency – 50 Hz at high power emitted during load). The main task of the rectifier diode is to convert AC voltage into DC voltage through application in rectifier bridges. The variant of rectifier diodewith the Schottky barrier is particularly valued in digital electronics.


Rectifier Diode(standard diode)

Rectifier Diode(Standard Diode)

Rectifier Diode,Standard Diode,High Power Rectifier Diode,High Voltage Rectifier Diode

YANGZHOU POSITIONING TECH CO., LTD. , https://www.yzpst.com