takeaway
In recent years, the Internet of Things market competition is fierce, from the Internet of Things platform manufacturers, equipment manufacturers, service providers, are pouring into the Red Sea. By 2020, the number of connected devices in the world is expected to reach 26 billion, with a compound annual growth rate of 20%. Globally connected devices will generate 44ZB of data, a 22-fold increase from 2012 and a compound annual growth rate of 48%.
The need for network in the Internet of Things era
Iot system hierarchy
The Internet of Things system is architecturally divided into three layers: perception layer, network layer and application layer.
-
Perception layer: it solves the problem of data acquisition in the human world and the physical world. It is composed of various sensors and sensor gateways. This layer is considered to be the core of the Internet of Things, where objects are identified and information is collected intelligently, It is composed of two major parts: basic sensing devices (such as RFID tags and readers, all kinds of sensors, cameras, GPS, TWO-DIMENSIONAL code tags and readers and other basic identification and sensor components) and sensor networks (such as RFID network, sensor network, etc.). The core technologies of this layer include low-speed and medium-high speed short-distance transmission technology, self-organizing networking technology, cooperative information processing technology, sensor network middleware technology, etc. The core products involved include sensors, electronic tags, sensor nodes, wireless routers, wireless gateways, etc.
-
Transmission layer: also known as the network layer, it solves the access and transmission function of data obtained by the perception layer, and is the data path for information exchange and transmission. The transmission layer of the Internet of Things is divided into wired communication transmission layer and wireless communication transmission layer. Wired communication technology includes medium and long distance wide area network and short distance fieldbus. The wireless communication layer is divided into long distance wireless LAN, medium short distance wireless LAN and ultra short distance wireless LAN. As the network layer of the Internet of Things bears a huge amount of data and faces higher quality of service requirements, the Internet of Things needs to integrate and expand the existing network and use new technologies to achieve more extensive and efficient interconnection functions.
-
Application layer: also known as the processing layer, to solve the problem of information processing and human-machine interface. The data transmitted from the network layer is processed by various information systems in this layer and interacts with people through various devices. The processing layer is composed of business support platform (middleware platform), network management platform (such as M2M management platform), information processing platform, information security platform, service support platform, etc., to complete the coordination, management, computing, storage, analysis, mining, and provide services for the industry and public users. Typical technologies including SOA technology, mass storage, distributed data processing, data mining, information management and other advanced technologies can be widely adopted.
Between each layer, the information is not one-way transmission, there can be interaction, control, etc., the information transmitted is diverse, including in the scope of a specific application system can uniquely identify the identification code of the item and the static and dynamic information of the item.
Although the Internet of things in the environmental monitoring, intelligent power, intelligent transportation, industrial monitoring, the application of the economic and social fields such as intelligent household characteristics differ in thousands ways, but the basic framework of each application including perception, transmission and application of three levels, professional application in the field of various industries and various subnets are based on the three basic architectural building.
The difference between iot access protocol and transport protocol
We divide Internet of Things communication protocols into two categories, one is access protocol and the other is transmission protocol:
Access protocols are generally responsible for networking and communication between devices on subnets. Most access protocols do not belong to the TCP/IP protocol family and can only be used for communication on device subnets (lans composed of devices and gateways). Transport protocol is a device communication protocol running on the traditional Internet TCP/IP protocol. It is responsible for data exchange and communication between devices over the Internet.
Internet of Things devices that use access protocols need to be converted into communication protocols through gateways to access the Internet. Internet of Things devices that use communication protocols can connect directly to the Internet.
Common access protocols include Wi-Fi, RFID, NFC, ZigBee, Bluetooth, LoRa, NB-iot, GSM, GPRS, 3/4/5g network, Ethernet, RS232, RS485, USB, etc. Commonly used communication protocols include HTTP, CoAP, MQTT, XMPP, AMQP, JMS and so on. The access protocol is located in the physical/digital chain layer of the network hierarchy, and the communication protocol is located in the application layer.
The differences between Internet of Things access protocol and communication protocol are as follows:
So what’s the point of access protocols now that you have a communication protocol that can connect directly to the Internet? Advantages of access protocols Compared with communication protocols, access protocols have lower requirements on hardware resources, lower power consumption, and smaller amounts of data transmitted over networks. Therefore, access protocols have advantages in some scenarios such as control.
In these scenarios, iot devices tend to have no external power supply and therefore require as little power consumption as possible, such as a button battery lasting about a year. Such requirements are difficult for the hardware environment required by HTTP and other protocols.
Several commonly used Iot access protocols
At present, ZigBee, Bluetooth and Wi-Fi protocols are common in the market:
- ZigBee is currently widely used in the field of industrial control, and has certain applications in the field of smart home. It has the following major advantages:
(1) Low cost: ZigBee protocol data transmission rate is low, the protocol is simple, so the development cost is relatively low. The ZigBee agreement also exempts patent fees.
② Low power consumption: Due to the low transmission rate of ZigBee protocol, the transmission power required by the node is only 1mW, and the mode of sleep + wake up is adopted, with very low power consumption.
③ AD hoc networking: With the built-in Mesh function of ZigBee protocol, a sub-network can support up to 65,000 nodes, which can quickly realize a large-scale sensor network.
(4) Security: CRC is used to verify the integrity of data packets, supporting authentication and authentication, and AES-128 is used to encrypt transmitted data.
The best application scenario of ZigBee protocol is wireless sensor network, such as the industrial scenario where water quality monitoring, environmental control and other nodes need AD hoc networking to transmit data between each other. The advantages of ZigBee protocol are very obvious in these scenarios. At present, many manufacturers at home and abroad will also use ZigBee in smart home solutions.
- Everyone is very familiar with the Bluetooth protocol, especially with the rapid development of Bluetooth 4.0 protocol, has become a standard communication component of smart phones. Bluetooth 4.0 has developed rapidly in recent years for the following two reasons:
Low power consumption: I think this is the killer of Bluetooth 4.0. Bluetooth 4.0 devices with button batteries can run for more than a year, which is very attractive for wearable devices that don’t want frequent charging. The current wearable devices in the world are basically bluetooth 4.0.
(2) Mobile phone access: In recent years, bluetooth protocol support has basically become the standard of smart phones, users do not need to buy additional access modules.
-
Bluetooth’s biggest advantages are its independence from external networks, portability, and low power consumption. As long as you have a mobile phone or smart device, you can maintain a stable connection to wherever you go. So Bluetooth is a priority for most sports and outdoor devices. Its main shortcomings are: it cannot directly connect to the cloud, the transmission speed is slow, and the networking ability is weak.
-
The Wi-Fi protocol, like the Bluetooth protocol, has also been greatly developed. Due to the rapid adoption of home Wi-Fi routers and smartphones in the past few years, Wi-Fi protocols have also been widely used in the smart home sector:
Wi-fi can be directly connected to the Internet: compared with ZigBee, the smart home program using Wi-Fi protocol eliminates the additional gateway, compared with bluetooth protocol, eliminates the dependence on mobile phones and other mobile terminals.
(2) the biggest advantage of Wi-Fi is fast, durable and stable connection. It is the preferred solution for IoT device connection. The only thing to consider is that smart devices rely on Wi-Fi coverage, so the range of activities of smart devices is relatively small, which is not suitable for carrying and outdoor scenes at any time.
Similar to Bluetooth and ZigBee, the power consumption of Wi-Fi protocol is a major bottleneck for its application in the field of Internet of Things. However, with the introduction of low-power and low-cost Wi-Fi soCs (such as ESP8266) by major chip manufacturers, this problem is gradually being solved.
What is “Distribution Network”
“Networking” and “Automatic Networking” of WIFI
- Networking: Generally refers to the process by which a Wi-Fi device connects to a hotspot AP or router using an SSID and password in order to join the network established by the router.
- Automatic connection: When a Wi-Fi device starts up, goes offline, or detects a specific SSID, it automatically connects to a hotspot AP or router using the previously saved SSID and password without manually re-entering. Among them, the “automatic connection” of WIFI device after disconnection is often called “automatic reconnection”.
- Automatic networking: Generally, you need to save the SSID and password after successfully configuring the network, so that you can read the saved ADDRESS and use it when automatic networking is required.
Wi-fi “network Configuration”
“Network configuration” means that the external provides the WI-FI module with the SSID and password so that the Wi-Fi module can connect to the specified hotspot or router and join the related Wi-Fi network established by the latter.
Unlike computers, mobile phones, tablets and other devices, Wi-Fi modules have rich human-computer interaction interfaces, which facilitate network configuration. Therefore, the “network configuration” mode of Wi-Fi modules will become a basic topic of features of Wi-Fi modules.
It can provide convenient, flexible and diverse network distribution modes with few constraints, which is often one of the selling points of Wi-Fi modules. It is also an important aspect for wi-fi module users to carefully consider and evaluate in selection.
Wi-fi common network configuration mode and principle implementation
The common distribution network can be classified into the following categories: direct distribution network, WPS distribution network, WEB distribution network, SoftAP distribution network, intelligent distribution network, acoustic distribution network. Users can choose the most suitable network distribution mode according to specific use occasions.
Direct distribution network
The so-called direct distribution network is to transfer SSID and password directly to WIFI module through UART serial port, SPI port, SDIO port, I2C and other host interfaces according to certain communication protocols. After receiving the SSID and password, the Wi-Fi module connects to the hotspot or router and returns the connection result from the host interface. At present the zebra car machine used in this way to connect the staring shot.
For example, the common distribution network through UART serial port AT instruction, SPI API function distribution network, SDIO API function distribution network, I2C API function distribution network.
The software scheme of direct network distribution is simple to implement, but other communication lines need to be laid, which is more suitable for onboard WIFI modules or devices connected by transmission lines of other protocols. Therefore, the environment requirements are relatively high, and other communication links need to exist between the systems.
The WPS distribution network
WPS in router is a new Wi-Fi Protected Setup standard launched by the Wi-Fi Alliance. The main reason for this standard is to solve the problem that the steps of wireless network encryption authentication are too complicated and difficult for a long time. WPS is used to simplify wi-fi wireless security Settings and network management. It supports two modes: PIN mode and button mode.
This approach requires the module to support WPS functionality. Users often do not do any encryption security Settings because the steps are so cumbersome, causing many security problems. It has been gradually abandoned in recent years for security reasons, and more and more routers have started to abandon or automatically turn off support for this method.
WEB distribution network
A simple WEB server is embedded in the Wi-Fi module that supports AP mode and provides an interactive interface for network configuration in the WEB page. Connect other network devices (such as mobile phones, tablets, and PCS) to the AP hotspot of the Wi-Fi module, open the WEB page in the browser, and configure the Wi-Fi module on the WEB page to connect to other aps or routers.
In recent years, more and more Wi-Fi chip solutions have begun to support STA+AP mixed mode (that is, WIFI module can not only be used as a workstation STA to connect to other routers or hotspots, but also can be used as a hotspot AP for other WIFI device nodes to connect). Also attributed to the increasing integration of many Wi-Fi chip solutions in recent years can be TCP
The IP protocol stack is directly integrated into the Wi-Fi module. Therefore, a WEB server can be directly implemented on the Wi-Fi module, and the server can be accessed directly through the AP mode of the Wi-Fi module (no need to rely on other networks. Mobile phones and other devices can directly access the Wi-Fi network and WEB pages established by the WIFI module. Configure).
The basic idea of this network distribution mode is that the Wi-Fi module works in STA+AP mixed mode and starts the embedded WEB server, computer, mobile phone or tablet and other Wi-Fi devices to connect to the AP hotspot established by the WIFI module and obtain an IP address (namely: Join the Wi-Fi LAN established by the hotspot AP mode of the Wi-Fi module), then wi-fi devices such as computers, mobile phones or tablets access the WEB server on the Wi-Fi module through the standard browser on the wi-fi module, and complete various configurations in the opened WEB page. It includes setting the SSID and password of the Wi-Fi module to connect to a third-party hotspot or router in STA mode, and making the WIFI module connect to other hotspot AP or router as STA.
SoftAP distribution network
SoftAP network distribution is widely used in Xiaomi smart home products. The principle is to enable TCP services on a Wi-Fi network, configure SSID and password through TCP, and connect intelligent hardware to a specified router.
After the machine is reset, the intelligent hardware will first work in Wi-Fi AP mode, and the TCP server is enabled to enter the listening state.
In this case, the mobile phone is used to access the AP hotspot. After the connection is successful, the client is opened and the mobile phone will connect to the TCP server. After the three-way handshake connection is successful, the protocol data is transmitted, including the SSID and password of the Wi-Fi that the smart hardware will connect to.
The hardware successfully receives the data packet from the phone and parses the Wi-Fi name and password. Reply cell phone trying to connect now. Disable the AP mode and enable the station mode to connect to the router. The router is successfully connected to the specified router. The phone then switches back to the designated router and starts UDP communication, and the smart hardware broadcasts the network success data using UDP.
Intelligent distribution network (SmartConfig/SmartConnection…).
The so-called intelligent distribution network is to use the WIFI signal of Wi-Fi device itself to fill the SSID and password in the unencrypted packet header of MAC packet according to a certain protocol format at the MAC layer. The SSID and password are transmitted to the WIFI module several times from mobile phones and other devices through broadcast and packet capture.
Currently on the market a variety of common SmartConfig/SmartConnection technology, although the wi-fi chip solutions will take different English names, but the basic principle is basically the same, just slightly different filling data protocol format.
Generally, an APP needs to be installed on the device (such as mobile phone) that sends SSID and password. This APP realizes protocol interaction (sending SSID and password) with Wi-Fi module.
This function was first proposed by TI and applied to CC3200; In principle, as long as the chip driver supports enabled Wi-Fi Promiscuous mode, one-click networking is possible, but manufacturers call it this differently and implement coding differently.
SNAP: format data packets
DA: indicates the destination MAC address
SA: indicates the source MAC address
LENGTH: indicates the LENGTH of the following data
LLC: indicates the LLC header
SNAP: vendor code of 3 bytes and protocol type of 2 bytes
DATA: load DATA
FCS: Frame check sequence
Since wireless data transmission must be broadcast, it must be monitored. If the AP is not encrypted,UDP can send the relevant information directly. However, router aps are generally encrypted, and the encryption method is not fixed.
The Wi-Fi module cannot parse data packets directly. It can be seen from the MAC layer frame format of 802.11 that the link layer load data (i.e. the network layer head and the number of network layers) is clearly discernible in the data frame. As long as the 802.11 frame is received, the load data can be immediately extracted and the length of the load data can be calculated, needless to say, and the load data here is usually ciphertext.
At the sending end, there are two different encoding sending modes:
- UDP broadcast: from the 802.11 frame format analysis, from the point of view of wireless signal listener, regardless of whether the wireless channel is encrypted or not,DA, SA, LENGTH, LLC, SNAP, FCS fields are always exposed, so the signal listener can obtain effective information from these six fields. From the perspective of the sender, due to the limitation of the operating system, only the LENGTH sender can control the broadcast by changing the LENGTH of the packet it needs to send. So as long as a set of communication protocol using Length coding is specified, the Length field of packet can be used for data transmission.
- UDP multicast: The multicast addresses are reserved for class D addresses ranging from 224.0.0.0 to 239.255.255.255. The mapping between IP addresses and MAC addresses is as follows: The first 25 bits of the MAC address are set to 01.00.5e, while the last 23 bits of the MAC address correspond to the IP address bit. Therefore, the sender can encode the data in the last 23bit of the multicast IP address, send the data through the multicast packet, and the receiver can decode the data.
After the one-click configuration function is enabled on the receiving end, the Wi-Fi intelligent hardware listens for data on the route from channel 1. If there are packets that meet the rules in the current listening channel, the Wi-Fi intelligent hardware stops channel switching and stays in the current channel to receive all data. Otherwise, switch to channel 2.3.4…. Until channel 14 and then from channel 1 continue to monitor the cycle;
Of course, wi-fi intelligent hardware can scan existing aps in the current environment to obtain all channels of the current AP before enabling the confounder mode, and then monitor only the currently scanned channels in turn. For example, there are only two routes in the current environment, respectively in channel 1.6, and only need to scan Channel1 and Channel6 in turn Improve configuration efficiency.
Sound distribution network
Sound wave distribution network, that is, the mobile phone sends sound waves, SSID, password and other information to the device a distribution network mode. The wi-fi initialization information is transmitted to the smart device by playing sound waves on the mobile phone, so that the device can identify and complete the Wi-Fi initialization process to establish a network connection.
To a certain extent, acoustic transmission can be understood as a near field communication technology similar to NFC. It is suitable for intelligent devices without touch screen or small touch screen, which is not easy to input information, but have microphone, such as dialogue robot, intelligent sound, etc. Its advantage is that the distribution network speed is fast, but the disadvantage is that the environment is more interference.
To realize the acoustic distribution network, first of all, a special algorithm library is needed, which is divided into two parts: mobile phone side and device side. The algorithm library on the mobile phone converts SSID information from string to sound signal (PCM), and then plays the sound signal through the audio module.
At the same time, the device records this sound, and then uses the same set of algorithm library to parse the sound information and restore it to the original SSID information (string). Finally, the parsed SSID information is used to connect WIFI.
The range of codec can be divided into low frequency, medium frequency and high frequency. The frequency range of low frequency is 2K~5K, the range of medium frequency is 8K~12K, and the range of high frequency is 16K~20K. The higher the frequency, the sharper the sound, the stronger the anti-noise performance.
Obviously the technical difficulty of acoustic distribution network technology is acoustic transmission technology. And the application of acoustic transmission is actually very wide: alipay’s acoustic payment, QQ music in the song of acoustic sharing, eggplant fast transmission, crickets and so on.
In fact, the principle is very simple, can be approximately understood as symmetric encryption, encryption and decryption process is roughly as follows:
Only ASCII printable characters are transmitted.
Transfers utF-8 strings.
To put it simply, at the sending end, you map the character to be recognized into frequency, and then map a frequency into a syllable signal (single frequency sine wave) coding into audio playback; After receiving the audio signal, the receiver analyzes the frequency, and then finds the corresponding characters according to the common code table on both sides, so as to decode the data.
Specifically, we can correspond 700HZ sine waves to the character ‘A’, 800HZ sine waves to the number ‘B’, 900HZ sine waves to the number ‘C’, and so on. The number string “ABC” corresponds to the frequency string {700,800,900}, and then converts this frequency string into a three-syllable sinusoidal audio. If you specify that each syllable lasts 100ms, {700,800,900} corresponds to a 300ms audio segment. The receiver records the sound, analyzes the received sound, identifies the three sinusoidal frequencies of 700HZ, 800HZ and 900HZ, and then looks up the code table. The decoded string is ABC.
The main flow of acoustic distribution network is as follows:
- Firstly, input SSID information (or obtain current SSID information saved by the system) in mobile phone (or tablet or other generation devices), encode the information into PCM data by buffer.
- The PCM data encoded by the algorithm library is played out through the loudspeaker. At the same time, the device opens the recording and captures the PCM data.
- The device decodes the PCM data back to the original buffer data through the algorithm library;
- The ssiD and password are parsed from the data and used to connect to the router.
Wi-fi network selection in IOT scenarios
As the most suitable technology for iot connectivity, Wi-Fi can act as the glue of iot. With the infinite proliferation of connected nodes, the coverage and total number of connected devices will also grow rapidly. Its internal integration of RF transceiver, MAC, baseband processing, Wi-Fi protocol and configuration information and network protocol stack, users can easily use it to achieve wireless network functions of serial devices. In actual use, users can choose according to the advantages and disadvantages of each network configuration mode in the table.
Autonavi released tmall genie Autonavi edition this year. The car box realizes AR navigation with the camera that stares at the mini3 dashcam. In this case, fully consider the product function, demonstrate its security, using SoftAP network distribution.