What is the Internet of things? The most complete explanation of common IOT protocols

Time:2021-6-2

Recommendation:This is a book explaining the development of Internet of things system from four dimensions of technical principle, engineering practice, design mode and best practice. It is a summary of the author’s practical experience of more than 10 years.

Fu Qiang, co-founder and CTO of a smart community enterprise, is a senior IOT technology expert. He has more than 10 years of working experience, focusing on the design and development of IOT platforms and products, and is very familiar with various IOT protocols and the architecture and development of IOT systems.

1、 What is the Internet of things?

The concept of Internet of things should be familiar to readers. The concept of Internet of things was first put forward in 1999. It was once called the third wave of the development of the world information industry after the computer and Internet. It has developed for more than 20 years now. Nowadays, in our daily life, we have been able to contact a lot of IOT products, such as a variety of smart home appliances, smart door locks, etc., which are relatively mature applications of IOT technology.
The earliest definition of the Internet of things is to connect all items with the Internet through radio frequency identification and other information sensing devices to achieve intelligent identification and management. Of course, with the development of the Internet of things today, its definition and scope have expanded and changed. Here are the characteristics of the modern Internet of things.

1.1 the Internet of things is also the Internet
The Internet of things, the Internet of things, is a part of the Internet. The Internet of things takes the infrastructure of the Internet as the carrier of information transmission, that is, modern Internet of things products must be “things” access to the Internet in some way, while “things” upload / download data and interact with people through the Internet.
For example, when a user starts a car remotely through a mobile app, the command is sent from the mobile phone connected to the Internet to the cloud platform. The cloud platform finds the car computer connected to the Internet, and then issues the command. The car computer executes the start command and feeds back the execution result to the cloud platform; At the same time, the user’s operation is recorded in the cloud, and the user can query the remote unlocking record history from the app at any time**
This is a typical Internet of things scenario, which is a kind of Internet application“ With the Internet access, data and information interact through the Internet. At the same time, data and other Internet applications converge to the cloud.

1.2 the subject of Internet of things is “things”
 
Previously, the modern Internet of things application is an Internet application, but there is a big difference between the Internet of things application and the traditional Internet application, that is, the main body of traditional Internet production and consumption data is people, while the main body of modern Internet of things production and consumption data is things.

In the application scenario of modern Internet of things, the producer of data is “things”, such as intelligent devices or sensors, and the consumer of data is often “things”.
 
In the application of smart agriculture, the temperature sensor in the incubator periodically uploads the temperature in the incubator to the control center. When the temperature is lower than a certain threshold, the center remotely turns on the heating equipment according to the preset rules. In this scenario, the producer of data is the temperature sensor, and the consumer of data is the heating equipment. Both of them are “things”, and people are not directly involved in them.

The biggest difference between the Internet of things and the traditional Internet is that the producers and consumers of data are mainly things, and the content of data is closely related to things.
 
1.3 Internet of things and artificial intelligence
Artificial intelligence is one of the most popular words in IT field in recent years. Throughout the development route of artificial intelligence, we can see that the development of artificial intelligence is able to advance by leaps and bounds, mainly for the following two reasons.

  • The development of hardware makes the learning time of deep learning neural network shorten rapidly.
  • In the era of big data, the cost of obtaining a large amount of data becomes lower.

In fact, the second reason is particularly important. Because of its characteristics, neural networks need massive data for learning. The amount of effective data available for learning often determines the effect of the neural network trained at last, and even the importance of the algorithm can rank behind the amount of data.
The Internet of things devices, such as smart home appliances, wearable devices, are generating a large amount of data every day. After processing and cleaning, these data can be used as good training data to feed back the neural network. At the same time, the trained neural network can be re applied to the Internet of things devices, thus forming a virtuous circle.

Figure 1-1 shows the data acquisition iteration cycle of the Internet of things using artificial intelligence method. After the training is completed in the data center, the model is applied to the Internet of things devices, and the effect is evaluated for the next iteration.

The Internet of things is a very good application scenario for AI landing. With the rapid development of artificial intelligence, the theory and technology of Internet of things, which was also put forward many years ago, will also usher in a new spring.
At present,Internet data portals are gradually converging towards several giants (such as Alibaba and Tencent), and the cost for smaller companies to obtain data is getting higher and higher,__ The Internet of things, which has not been fully developed, is particularly important in the field of data__
 
This is also the reason why this book focuses on the development of the Internet of things platform and ignores the development of front-end devices, because the front-end devices will eventually tend to be the same, resulting in homogeneous competition. How to collect and use the massive data generated by the devices is the decisive factor for your competitive advantage.
 
1.4 current situation and Prospect of Internet of things

With the advent of 5g era, the development of Internet of things will be very rapid. At the same time, new financing in the direction of Internet of things has been on the rise. Now let’s talk about the development prospect of the Internet of things industry from the perspective of application scenarios.
The Internet of things has a wide range of application scenarios, including:

  • smart city
  • Smart building
  • Internet of vehicles
  • Smart community
  • Smart home
  • Smart medicine
  • Industrial Internet of things

In different scenarios, the application of Internet of things is very different, and the heterogeneity of terminal and network architecture is strong, which means that there are enough market segments in the Internet of things industry, so it is difficult to have a dominant company in the market share. At the same time, due to the large market, enough companies can survive. This situation is not common in the Internet industry. The head effect of the Internet industry is very obvious, and the vast majority of the market share is often occupied by two or three top companies.
Compared with the Internet mode, the Internet of things mode is more “heavy”. The application of the Internet of things is always accompanied by front-end devices, which means that the switching cost of users is relatively high. After all, it is much more complex to dismantle the device and re install the device than to re download an application with a finger.This also means that the driving force of capital in the Internet of things industry is relatively weaker. If you get the first mover advantage, then the latecomer wants to catch up or squeeze you out of the market by the power of capital alone, then he will pay a much higher price than in the Internet industry.
SoThe Internet of things industry is still a blue ocean, and small-scale companies are fully capable of competing with large-scale companies in this industry. After the popularity of AI and blockchain cools down, the Internet of things is likely to become the next outlet. As a programmer, it is necessary to reserve some knowledge in advance.
 
 
2、 Common Internet of things protocols
 
2.1 mqtt protocol
Mqtt (message queue telemetry transport) protocol was developed by Andy Stanford Clark of IBM and Arlen nipper of arcom in 1999 for a project of connecting oil pipeline through satellite network. In order to meet the needs of low power consumption and low network bandwidth, mqtt protocol includes the following characteristics at the beginning of design

  • Simple implementation
  • Provide QoS for data transmission
  • Light weight and low bandwidth
  • Any type of data can be transmitted
  • Maintainable session

With the development of many years, the focus of mqtt protocol is no longer just embedded systems, but a wider world of Internet of things.

In short, mqtt protocol has the following characteristics:

  • Application layer protocol based on TCP protocol
  • Adopt C / S structure
  • The sender and receiver of message are decoupled by using subscription / publication mode
  • Three kinds of QoS (quality of service) are provided: at least once, at least once and only once
  • Sending and receiving messages are asynchronous, and the sender does not need to wait for the receiver to respond

The architecture of mqtt protocol consists of broker and multiple clients connected to broker, as shown in Figure 2-1.

Mqtt protocol can provide communication support for a large number of low-power and unreliable Internet of things devices. And it also has great achievements in the field of mobile Internet. Many Android App push functions are based on mqtt protocol, and some im implementation is also based on mqtt protocol.

 
2.2 mqtt-sn protocol
Mqtt-sn (mqtt for sensor network) protocol is the sensor version of mqtt protocol. Although mqtt protocol is a lightweight application layer protocol, mqtt protocol runs on TCP stack. TCP protocol is not suitable for some devices with limited computing power and power, such as sensors.

Mqtt-sn runs on UDP protocol and retains most signaling and features of mqtt protocol, such as subscription and publication. Mqtt-sn protocol introduces the role of mqtt-sn gateway, which is responsible for transforming mqtt-sn protocol into mqtt protocol and communicating with remote mqtt broker. Mqtt-sn protocol supports automatic gateway discovery. The communication model of mqtt-sn protocol is shown in Figure 2-2.

2.3 COAP protocol
COAP (constrained Application Protocol) is a kind of protocol that runs on devices with limited resources. COAP protocol usually runs on UDP protocol.

COAP protocol is designed to be very small, and the smallest packet is only 4 bytes. COAP protocol adopts C / S architecture and uses a request response interaction mode similar to HTTP protocol. The device can be controlled by a coap://192.168.1.150 : 5683 / 2ndfloor / temperature URL to identify an entity, and use HTTP like put, get, post, delete request instructions to obtain or modify the status of the entity.

Meanwhile, COAP provides an observation mode, and the observer can indicate the entity object to be observed to the COAP server through the observe instruction. When the state of the entity object changes, the observer can receive the latest state of the entity object, which is similar to the subscription function in mqtt protocol. The communication model of COAP protocol is shown in Figure 2-3.


2.4 lwm2m protocol
Lwm2m (lightweight machine to machine) protocol is a set of lightweight protocol defined by Open Mobile Alliance (OMA) for Internet of things. It uses restful interface to provide access, management and communication functions for devices, and it is also suitable for devices with limited resources. The architecture of lwm2m protocol is shown in Figure 2-4.

The underlying layer of lwm2m protocol uses COAP protocol to transmit data and signaling. In the architecture of lwm2m protocol, COAP protocol can run on UDP or SMS (short message), and realize the secure transmission of data through dtls (datagram transport layer security).

Lwm2m protocol architecture mainly includes three entities: lwm2m bootstrap server, lwm2m server and lwm2m client.

Lwm2m bootstrap server is responsible for guiding lwm2m client to register and access to lwm2m server. Then lwm2m server and lwm2m client can interact through the interface specified by the protocol.
 
2.5 HTTP protocol
As we said before, the Internet of things is also the Internet. HTTP, a protocol widely used in the Internet, can also be applied to the Internet of things in a suitable environment. On some devices with abundant computing and hardware resources, such as devices running Android operating system, HTTP protocol can be used to upload and download data, just like developing mobile applications. The device can also use websocket running on HTTP protocol to actively receive data from the server.
 
2.6 lorawan protocol
Lorawan protocol is a low-power WAN protocol proposed and promoted by Lora alliance. It is different from several protocols we introduced before. Mqtt protocol, COAP protocol are running in the application layer, the underlying use of TCP protocol or UDP protocol for data transmission, the entire stack runs on the IP network. Lorawan protocol is the physical layer / data link layer protocol, which solves the problem of how to access the Internet, and does not run on the IP network.
Lora (long range) is a wireless communication technology, which has the characteristics of long distance and low power consumption. In the above scenario, users can use lorawan technology for networking and install Lora supporting modules on engineering equipment. Through the relay equipment of Lora, the data is sent to the Lora gateway which is located outside the tunnel and has Internet access. The Lora gateway encapsulates the data into a data protocol packet (such as mqtt protocol) which can be transmitted through TCP or UDP protocol in the IP network, and then sends it to the data center in the cloud.
 
2.7 NB IOT protocol
NB IOT (narrow band Internet of things) protocol, like lorawan protocol, is a protocol that connects devices to the physical layer / data link layer of the Internet.

Different from Lora, Nb IOT protocol is built and runs on the cellular network, which consumes less bandwidth and can be directly deployed to the existing GSM network or LTE network. The device is installed with Nb IOT chip and corresponding IOT network card, and then connected to NB IOT base station to access the Internet. Moreover, Nb IOT protocol does not need gateway protocol conversion as lorawan protocol does. The access devices can directly use IP network for data transmission.

Compared with the traditional base station, the gain of Nb IOT protocol is increased by about 20dB, which can cover the underground garage, pipeline, basement and other places where the signal is difficult to cover before.
 
This article is authorized by the publishing house. For more information about the method of building IOT platform from 0 to 1, it is recommended to read “IOT system development: building IOT platform from 0 to 1”.

Recommendation:This is a book explaining the development of Internet of things system from four dimensions of technical principle, engineering practice, design mode and best practice. It is a summary of the author’s practical experience of more than 10 years.
Firstly, it introduces the principle and practice of Internet of things protocol step by step through code examples; Then, taking the building process of a comprehensive IOT platform with complete functions as an example, it explains how to build an IOT platform from 0 to 1; Finally, the common design patterns and best practices in the development of IOT platform are summarized.

Original link
This article is the original content of Alibaba cloud and cannot be reproduced without permission.

Recommended Today

Hot! Front and rear learning routes of GitHub target 144K

Hello, Sifu’s little friend. I’m silent Wang Er. Last week, while appreciating teacher Ruan Yifeng’s science and technology weekly, I found a powerful learning route, which has been marked with 144K on GitHub. It’s very popular. It covers not only the front-end and back-end learning routes, but also the operation and maintenance learning routes. As […]