This article introduces the communication architecture of the IoT from a macro perspective so that everyone has a preliminary understanding of the working principle of the increasingly frequent IoT devices, which are mainly divided into three modes: direct integration pattern, gateway integration,pattern, and cloud integration pattern.
Generally, the IoT devices we use, such as the apple watch, and the mobile phone are direct connection mode, but they use Bluetooth and cannot provide a universal interface to access. The solution to this problem is to use Web technologies that have been mature for many years. So, the concept of the Web of Things was also proposed.
If the device supports HTTP and TCP / IP and can directly connect to the Internet, such as using Wi-Fi, then this direct connection mode can be used. Usually, devices need more powerful processing power and have continuous power, such as smart homes. To directly control the device through the Web, it needs to implement functions similar to the following figure, from hardware control, the design of the RESTFUL API to the implementation of the HTTP server.
If the device's resources are limited, or cannot directly access the Internet (for example, it only supports Bluetooth and ZigBee), they can access the Web by accessing a powerful gateway. The gateway converts other types of protocols into a unified External interface (such as converting the device's CoAP to HTTP and providing it to users). It can also provide functions such as security authentication, integration, temporary data storage, and semantic description of the device. The open-source gateway project is Open Hab. In addition, many large vendors also have their own gateways to support their own devices.
The cloud mode can be seen as an extension of the gateway mode, but the gateway is in the cloud and provides cloud services such as protocol conversion and data processing. The biggest feature is that it can access various devices through the external network. There have been various platforms providing cloud services for the Internet of Things, such as AWS, Ali, and Microsoft, as well as specialized platforms such as Xively and Wisdom Cloud, etc., but most of them have adopted a structure similar to the following figure and passed the MQTT protocol. To manage various devices, there are virtual devices in the cloud to save device status, store data generated by management devices, and use secret API KEY to send management instructions through REST API.
The mode through the cloud often makes the instruction transmission very slow, so an IoT device may allow the above several operation modes at the same time. Using the Web to control the device, you can also easily use a third-party automation platform such as IFTTT to design conditions to automatically perform some functions and interact with commonly used apps such as Twitter.