CN113572853A - Method and system for forming Internet of things cloud platform based on MQTT - Google Patents

Method and system for forming Internet of things cloud platform based on MQTT Download PDF

Info

Publication number
CN113572853A
CN113572853A CN202110884492.5A CN202110884492A CN113572853A CN 113572853 A CN113572853 A CN 113572853A CN 202110884492 A CN202110884492 A CN 202110884492A CN 113572853 A CN113572853 A CN 113572853A
Authority
CN
China
Prior art keywords
mqtt
internet
data
proxy server
things
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Withdrawn
Application number
CN202110884492.5A
Other languages
Chinese (zh)
Inventor
方磊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Zibang Electric Technology Co ltd
Original Assignee
Shanghai Zibang Electric Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Zibang Electric Technology Co ltd filed Critical Shanghai Zibang Electric Technology Co ltd
Priority to CN202110884492.5A priority Critical patent/CN113572853A/en
Publication of CN113572853A publication Critical patent/CN113572853A/en
Withdrawn legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/12Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W28/00Network traffic management; Network resource management
    • H04W28/02Traffic management, e.g. flow control or congestion control
    • H04W28/06Optimizing the usage of the radio link, e.g. header compression, information sizing, discarding information
    • H04W28/065Optimizing the usage of the radio link, e.g. header compression, information sizing, discarding information using assembly or disassembly of packets
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/50Reducing energy consumption in communication networks in wire-line communication networks, e.g. low power modes or reduced link rate
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Health & Medical Sciences (AREA)
  • Computing Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Telephonic Communication Services (AREA)

Abstract

The invention provides a method and a system for forming an Internet of things cloud platform based on MQTT, wherein the Internet of things cloud platform is formed by using the MQTT technology, so that the state information of Internet of things equipment can be comprehensively acquired in real time, and the automatic identification and management of the Internet of things equipment are realized; meanwhile, the information content generated by the Internet of things equipment is synchronized to the Internet of things cloud platform by the MQTT proxy server according to the MQTT protocol, so that the data processing pressure of the MQTT proxy server can be solved, and meanwhile, when a network fault occurs, the MQTT proxy server can retrieve the information content generated by the corresponding Internet of things equipment from the Internet of things cloud platform, so that the linkage of the Internet of things equipment is realized. The invention has the advantages of wide coverage range and low energy consumption, can effectively and accurately manage equipment assets, and simultaneously ensures the convenience, high efficiency and safety of users in the process of using the equipment of the Internet of things.

Description

Method and system for forming Internet of things cloud platform based on MQTT
Technical Field
The invention relates to the technical field of Internet of things, in particular to a method and a system for forming an Internet of things cloud platform based on MQTT.
Background
With the development of network technology, especially the emergence of IPV6 technology, sufficient IP addresses can be provided for use, and important support is provided for everything interconnection. In recent years, the internet of things has come into the lives of people and is widely used in industry, agriculture and commerce, and the appearance and development of the internet of things technology bring good experience to users.
In the aspect of communication protocols of the internet of things, a Message Queue Telemetry Transport (MQTT) technology appears, and the MQTT protocol is an instant communication protocol based on TCP/IP, is designed for communication of a remote sensor and a control device which have limited computing capability and work in a low-bandwidth and unreliable network, and is very suitable for being adopted in the internet of things. At present, part of people construct an internet of things communication system in smart home application based on an MQTT protocol, however, the traditional internet of things platform technology links a plurality of internet of things devices through streaming processing on the side of an MQTT proxy server based on data streams, so that massive data streams are gathered and processed by the MQTT proxy server, and great data processing pressure of the MQTT proxy server is caused.
Disclosure of Invention
In view of the above drawbacks of the prior art, the present invention is to provide a method and a system for forming an internet of things cloud platform based on MQTT, which are used to solve the problems in the prior art.
In order to achieve the above and other related objects, the present invention provides a system for forming an internet of things cloud platform based on MQTT, including: the system comprises an MQTT proxy server, an Internet of things cloud platform, a gateway and a sensing and metering device;
the sensing metering device is used for acquiring information content generated by the Internet of things equipment and packaging the acquired information content to form first packaging data; the Internet of things equipment comprises intelligent Internet of things equipment and/or Internet of things equipment without a wireless communication function; the first packaging data is a data packet or binary stream formed by packaging the sensing metering device according to the application protocol data of the Internet of things equipment;
the gateway is connected with the sensing and metering device and used for acquiring first encapsulated data in the sensing and metering device and encapsulating the acquired first encapsulated data again according to an MQTT protocol to form second encapsulated data;
the gateway is also connected with the MQTT proxy server and used for transmitting the second encapsulated data to the MQTT proxy server, decapsulating the second encapsulated data by the MQTT proxy server and analyzing the decapsulated data according to a data analysis contract prestored in the MQTT proxy server to obtain information content generated by the Internet of things equipment;
the MQTT proxy server is further connected with the Internet of things cloud platform, the MQTT proxy server is in communication connection with the Internet of things cloud platform through an MQTT protocol, and the MQTT proxy server synchronizes information content generated by the Internet of things equipment to the Internet of things cloud platform according to the MQTT protocol.
Optionally, the system for forming an internet of things cloud platform based on MQTT according to claim 1, wherein when a plurality of sensing and metering devices transmit data simultaneously, the gateway encapsulates the data from the plurality of sensing and metering devices into a multi-component data group, then transmits the multi-component data group to the MQTT proxy server, decapsulates the data in the multi-component data group by the MQTT proxy server, and parses the decapsulated data according to a data parsing contract prestored on the MQTT proxy server, so as to obtain information content generated by the internet of things device.
Optionally, the gateway at least includes a WIFI center node, and the process of the WIFI center node implementing data transmission with the MQTT proxy server through the MQTT protocol includes:
the MQTT proxy server sends a control command to the WIFI central node, the WIFI central node sends back feedback information after receiving and executing the control command, if the feedback is overtime, the MQTT proxy server sends the feedback information again, and when the feedback is overtime for 3 times, the MQTT proxy server determines that the sending is failed and discards the control command;
the MQTT proxy server sends a state query command to the WIFI central node, and the WIFI central node sends back state data after receiving the state query command;
and the WIFI central node actively reports data to the MQTT proxy server at regular time, and after receiving the data, the MQTT proxy server sends back feedback information.
Optionally, when the WIFI central node transmits data with the MQTT proxy server, the method further includes sending a status query instruction;
the MQTT proxy server sends a state query instruction to the WIFI central node and synchronously starts a 30s timer;
after receiving the state query instruction, the WIFI central node judges whether the receiving of the WIFI central node is overtime; if not, the WIFI central node executes a corresponding state query instruction; if the feedback is overtime for 3 times, the transmission is determined to fail, and the state query instruction is discarded;
judging whether the WIFI central node executes a corresponding state query instruction or not; if the execution is finished, the WIFI central node reports the query result; and if not, feeding back result information to the MQTT proxy server.
Optionally, the system further comprises: setting two themes for each gateway, wherein one theme is used as a gateway end, and the other theme is used as a platform end;
when the gateway end is used for sending data, the platform end is used for receiving the data;
and when the platform end is used for sending data, the gateway end is used for receiving the data.
Optionally, when the platform side is configured to send data and the gateway side is configured to receive data, the method further includes determining whether there is a breakpoint continuous transmission between the gateway and the MQTT proxy server, including:
judging whether the platform end sends a heartbeat signal every minute or not;
if the gateway end receives the heartbeat sent by the platform end, the current platform end, the gateway end and the network are good in operation, the online state of the gateway is set to be 1, and the last communication time is set to be equal to the current time;
and if the difference between the current time and the last communication time is greater than the specified effective on-off time, setting the online state of the gateway to be 0, and determining that the breakpoint transmission between the gateway and the MQTT proxy server exists.
Optionally, the MQTT proxy server provides three qualities of service, which are respectively set as: QoS0, QoS1, and QoS 2; wherein, QoS0 is sent only once, QoS1 is sent at least once, and QoS2 is sent just once.
The invention also provides a method for forming the Internet of things cloud platform based on the MQTT, which comprises the following steps:
acquiring information content generated by the Internet of things equipment by using a sensing metering device, and packaging the acquired information content to form first packaging data; the Internet of things equipment comprises intelligent Internet of things equipment and/or Internet of things equipment without a wireless communication function; the first packaging data is a data packet or binary stream formed by packaging the sensing metering device according to the application protocol data of the Internet of things equipment;
establishing communication connection between a gateway and the sensing and metering device, acquiring first encapsulated data in the sensing and metering device, and encapsulating the acquired first encapsulated data again according to an MQTT protocol to form second encapsulated data;
establishing a communication connection between the gateway and the MQTT proxy server, transmitting the second encapsulated data to the MQTT proxy server, decapsulating the second encapsulated data by the MQTT proxy server, and analyzing the decapsulated data according to a data analysis contract prestored in the MQTT proxy server to obtain information content generated by the Internet of things equipment;
and establishing communication connection between the MQTT proxy server and the Internet of things cloud platform according to an MQTT protocol, and controlling the MQTT proxy server to synchronize information content generated by the Internet of things equipment to the Internet of things cloud platform according to the MQTT protocol.
Optionally, when the multiple sensing and metering devices transmit data simultaneously, the gateway encapsulates the data from the multiple sensing and metering devices into a multivariate data group, then transmits the multivariate data group to the MQTT proxy server, decapsulates the data in the multivariate data group by the MQTT proxy server, and parses the decapsulated data according to a data parsing contract prestored in the MQTT proxy server, so as to obtain information content generated by the internet of things device.
Optionally, the gateway at least includes a WIFI center node, and the process of the WIFI center node implementing data transmission with the MQTT proxy server through the MQTT protocol includes:
the MQTT proxy server sends a control command to the WIFI central node, the WIFI central node sends back feedback information after receiving and executing the control command, if the feedback is overtime, the MQTT proxy server sends the feedback information again, and when the feedback is overtime for 3 times, the MQTT proxy server determines that the sending is failed and discards the control command;
the MQTT proxy server sends a state query command to the WIFI central node, and the WIFI central node sends back state data after receiving the state query command;
and the WIFI central node actively reports data to the MQTT proxy server at regular time, and after receiving the data, the MQTT proxy server sends back feedback information.
As described above, the invention provides a method and a system for forming an internet of things cloud platform based on MQTT, which have the following beneficial effects:
according to the invention, the Internet of things cloud platform is established through the MQTT technology, so that the state information of the Internet of things equipment can be comprehensively acquired in real time, and the automatic identification and management of the Internet of things equipment are realized; meanwhile, the information content generated by the Internet of things equipment is synchronized to the Internet of things cloud platform by the MQTT proxy server according to the MQTT protocol, so that the data processing pressure of the MQTT proxy server can be solved, and meanwhile, when a network fault occurs, the MQTT proxy server can retrieve the information content generated by the corresponding Internet of things equipment from the Internet of things cloud platform, so that the linkage of the Internet of things equipment is realized. The invention has the advantages of wide coverage range and low energy consumption, can effectively and accurately manage equipment assets, and simultaneously ensures the convenience, high efficiency and safety of users in the process of using the equipment of the Internet of things.
Drawings
Fig. 1 is a schematic hardware structure diagram of an MQTT-based internet of things cloud platform according to an embodiment;
fig. 2 is a schematic diagram of data transmission between a WIFI central node and an MQTT proxy server in a gateway according to an embodiment;
fig. 3 is a schematic view of a breakpoint resuming process according to an embodiment.
Detailed Description
The embodiments of the present invention are described below with reference to specific embodiments, and other advantages and effects of the present invention will be easily understood by those skilled in the art from the disclosure of the present specification. The invention is capable of other and different embodiments and of being practiced or of being carried out in various ways, and its several details are capable of modification in various respects, all without departing from the spirit and scope of the present invention. It is to be noted that the features in the following embodiments and examples may be combined with each other without conflict.
It should be noted that the drawings provided in the following embodiments are only for illustrating the basic idea of the present invention, and the components related to the present invention are only shown in the drawings rather than drawn according to the number, shape and size of the components in actual implementation, and the type, quantity and proportion of the components in actual implementation may be changed freely, and the layout of the components may be more complicated.
Referring to fig. 1 to 3, the present invention provides a system for forming an internet of things cloud platform based on MQTT, including: the system comprises an MQTT proxy server, an Internet of things cloud platform, a gateway and a sensing and metering device;
the sensing metering device is used for acquiring information content generated by the Internet of things equipment and packaging the acquired information content to form first packaging data; the Internet of things equipment comprises intelligent Internet of things equipment and/or Internet of things equipment without a wireless communication function; the first packaging data is a data packet or binary stream formed by packaging the sensing metering device according to the application protocol data of the Internet of things equipment;
the gateway is connected with the sensing and metering device and used for acquiring first encapsulated data in the sensing and metering device and encapsulating the acquired first encapsulated data again according to an MQTT protocol to form second encapsulated data;
the gateway is also connected with the MQTT proxy server and used for transmitting the second encapsulated data to the MQTT proxy server, decapsulating the second encapsulated data by the MQTT proxy server and analyzing the decapsulated data according to a data analysis contract prestored in the MQTT proxy server to obtain information content generated by the Internet of things equipment;
the MQTT proxy server is further connected with the Internet of things cloud platform, the MQTT proxy server is in communication connection with the Internet of things cloud platform through an MQTT protocol, and the MQTT proxy server synchronizes information content generated by the Internet of things equipment to the Internet of things cloud platform according to the MQTT protocol.
In the embodiment, the Internet of things cloud platform is established through the MQTT technology, so that the state information of the Internet of things equipment can be comprehensively acquired in real time, and the automatic identification and management of the Internet of things equipment are realized; meanwhile, the information content generated by the Internet of things equipment is synchronized to the Internet of things cloud platform by the MQTT proxy server according to the MQTT protocol, so that the data processing pressure of the MQTT proxy server can be solved, and meanwhile, when a network fault occurs, the MQTT proxy server can retrieve the information content generated by the corresponding Internet of things equipment from the Internet of things cloud platform, so that the linkage of the Internet of things equipment is realized. The invention has the advantages of wide coverage range and low energy consumption, can effectively and accurately manage equipment assets, and simultaneously ensures the convenience, high efficiency and safety of users in the process of using the equipment of the Internet of things.
In an example embodiment, when a plurality of sensing and metering devices transmit data simultaneously, the gateway encapsulates the data from the plurality of sensing and metering devices into a multi-element data group, then transmits the multi-element data group to the MQTT proxy server, decapsulates the data in the multi-element data group by the MQTT proxy server, and analyzes the decapsulated data according to a data analysis contract prestored on the MQTT proxy server, so as to obtain information content generated by the internet of things device. In the universal internet of things communication method based on the MQTT generalization protocol, a polling mechanism is designed to carry out uniform transmission processing on a plurality of devices, so that the overhead of the system can be greatly reduced, and the communication efficiency is improved; in the embodiment, polling time is set according to a communication object, and before the MQTT server is sent to the intelligent control terminal, screening is carried out, so that the cost of invalid communication is reduced; the communication mechanism of the internet of things of the general equipment is designed in the embodiment, the equipment without the preset function of the internet of things can be accessed, the application range of the system is expanded, and the communication mechanism of the internet of things has important significance for the development of the interconnection of everything.
In an example embodiment, as shown in fig. 2, the gateway at least includes a WIFI central node, and the process of the WIFI central node implementing data transmission with an MQTT proxy server through an MQTT protocol includes: the MQTT proxy server sends a control command to the WIFI central node, the WIFI central node sends back feedback information after receiving and executing the control command, if the feedback is overtime, the MQTT proxy server sends the feedback information again, and when the feedback is overtime for 3 times, the MQTT proxy server determines that the sending is failed and discards the control command; the MQTT proxy server sends a state query command to the WIFI central node, and the WIFI central node sends back state data after receiving the state query command; and the WIFI central node actively reports data to the MQTT proxy server at regular time, and after receiving the data, the MQTT proxy server sends back feedback information. As an example, the MQTT proxy server sends a parameter control instruction: 8, 2, 855, 5, 30, 350, 50, 950, 250, 0, 30, 60, 30, (device type 8, instruction type 2, device ID number 855, recording interval 5min, reporting interval 30min, upper temperature alarm limit 35 ℃, lower temperature alarm limit 5 ℃, upper humidity alarm limit 95%, lower humidity alarm limit 25%, release strategy 0, remote mode relay action duration 30s, local mode detection interval 60s, local mode relay action duration 30 s). Wherein, the setting parameter of the upper and lower temperature limits is original value multiplied by 10 (the range is-500-1000, corresponding to the temperature is-500-1000 ℃), the setting parameter of the upper and lower humidity limits is original value multiplied by 10 (the range is 0-1000, corresponding to the humidity is 0-100%), 4 modes of the air release strategy are provided: "0" means remote command control only; "1" indicates that only one sensor is overrun; "2" indicates that both sensors are simultaneously over-limit, i.e., active; "3" means taking the average of two sensors). When the WIFI center node receives the parameter setting instruction sent by the MQTT proxy server and successfully executes the parameter setting instruction, reporting an execution result to the MQTT proxy server, and uploading feedback information content: 5, 2, OK, (device type 8, instruction type 2, status OK). The data communication process is realized through software programming, a 30s timer is synchronously started by utilizing a multithreading technology, and when the WIFI central node receives a control instruction in 30s, the relay is started or closed so as to control the remote electric equipment.
When the WIFI central node transmits data to the MQTT proxy server, a state query instruction is sent; the MQTT proxy server sends a state query instruction to the WIFI central node and synchronously starts a 30s timer; after receiving the state query instruction, the WIFI central node judges whether the receiving of the WIFI central node is overtime; if not, the WIFI central node executes a corresponding state query instruction; if the feedback is overtime for 3 times, the transmission is determined to fail, and the state query instruction is discarded; judging whether the WIFI central node executes a corresponding state query instruction or not; if the execution is finished, the WIFI central node reports the query result; and if not, feeding back result information to the MQTT proxy server.
In an example embodiment, the system further comprises: setting two themes for each gateway, wherein one theme is used as a gateway end, and the other theme is used as a platform end; when the gateway end is used for sending data, the platform end is used for receiving the data; and when the platform end is used for sending data, the gateway end is used for receiving the data. If there are n gateways in an internet of things system, the number of topics needs to be set to 2 n. For each gateway, a topic needs to be subscribed and a topic needs to be published; the platform end needs to subscribe the topics published by the n gateway ends and publish n topics aiming at different gateways.
When the platform side is used for sending data and the gateway side is used for receiving data, the method further comprises the step of judging whether breakpoint continuous transmission exists between the gateway and the MQTT proxy server, and the method comprises the following steps: judging whether the platform end sends a heartbeat signal every minute or not; if the gateway end receives the heartbeat sent by the platform end, the current platform end, the gateway end and the network are good in operation, the online state of the gateway is set to be 1, and the last communication time is set to be equal to the current time; and if the difference between the current time and the last communication time is greater than the specified effective on-off time, setting the online state of the gateway to be 0, and determining that the breakpoint transmission between the gateway and the MQTT proxy server exists. In this embodiment, since the platform side of the internet of things system only sends some control messages, the online state of the gateway can be obtained and fed back by using a willingness mode of MQTT before sending the messages. Data sending is mainly concentrated on a gateway end, so breakpoint continuous transmission is designed for the gateway end, and a platform end acquires breakpoint continuous transmission data and then analyzes the breakpoint continuous transmission data. The breakpoint resume processing flow is shown in fig. 3.
In this embodiment, the MQTT proxy server provides three service qualities, which are respectively set as: QoS0, QoS1, and QoS 2; wherein, QoS0 is sent only once, QoS1 is sent at least once, and QoS2 is sent just once.
In conclusion, the system constructs the Internet of things cloud platform through the MQTT technology, can comprehensively acquire the state information of the Internet of things equipment in real time, and realizes automatic identification and management of the Internet of things equipment; meanwhile, the information content generated by the Internet of things equipment is synchronized to the Internet of things cloud platform by the MQTT proxy server according to the MQTT protocol, so that the data processing pressure of the MQTT proxy server can be solved, and meanwhile, when a network fault occurs, the MQTT proxy server can retrieve the information content generated by the corresponding Internet of things equipment from the Internet of things cloud platform, so that the linkage of the Internet of things equipment is realized. The system has the advantages of wide coverage range and low energy consumption, can effectively and accurately manage the equipment assets, and simultaneously ensures the convenience, high efficiency and safety of the user in the process of using the Internet of things equipment.
The invention also provides a method for forming the Internet of things cloud platform based on the MQTT, which comprises the following steps:
acquiring information content generated by the Internet of things equipment by using a sensing metering device, and packaging the acquired information content to form first packaging data; the Internet of things equipment comprises intelligent Internet of things equipment and/or Internet of things equipment without a wireless communication function; the first packaging data is a data packet or binary stream formed by packaging the sensing metering device according to the application protocol data of the Internet of things equipment;
establishing communication connection between a gateway and the sensing and metering device, acquiring first encapsulated data in the sensing and metering device, and encapsulating the acquired first encapsulated data again according to an MQTT protocol to form second encapsulated data;
establishing a communication connection between the gateway and the MQTT proxy server, transmitting the second encapsulated data to the MQTT proxy server, decapsulating the second encapsulated data by the MQTT proxy server, and analyzing the decapsulated data according to a data analysis contract prestored in the MQTT proxy server to obtain information content generated by the Internet of things equipment;
and establishing communication connection between the MQTT proxy server and the Internet of things cloud platform according to an MQTT protocol, and controlling the MQTT proxy server to synchronize information content generated by the Internet of things equipment to the Internet of things cloud platform according to the MQTT protocol.
In the embodiment, the Internet of things cloud platform is established through the MQTT technology, so that the state information of the Internet of things equipment can be comprehensively acquired in real time, and the automatic identification and management of the Internet of things equipment are realized; meanwhile, the information content generated by the Internet of things equipment is synchronized to the Internet of things cloud platform by the MQTT proxy server according to the MQTT protocol, so that the data processing pressure of the MQTT proxy server can be solved, and meanwhile, when a network fault occurs, the MQTT proxy server can retrieve the information content generated by the corresponding Internet of things equipment from the Internet of things cloud platform, so that the linkage of the Internet of things equipment is realized. The invention has the advantages of wide coverage range and low energy consumption, can effectively and accurately manage equipment assets, and simultaneously ensures the convenience, high efficiency and safety of users in the process of using the equipment of the Internet of things.
In an example embodiment, when a plurality of sensing and metering devices transmit data simultaneously, the gateway encapsulates the data from the plurality of sensing and metering devices into a multi-element data group, then transmits the multi-element data group to the MQTT proxy server, decapsulates the data in the multi-element data group by the MQTT proxy server, and analyzes the decapsulated data according to a data analysis contract prestored on the MQTT proxy server, so as to obtain information content generated by the internet of things device. In the universal internet of things communication method based on the MQTT generalization protocol, a polling mechanism is designed to carry out uniform transmission processing on a plurality of devices, so that the overhead of the method can be greatly reduced, and the communication efficiency is improved; in the embodiment, polling time is set according to a communication object, and before the MQTT server is sent to the intelligent control terminal, screening is carried out, so that the cost of invalid communication is reduced; the communication mechanism of the internet of things of the general equipment is designed in the embodiment, the equipment without the preset function of the internet of things can be accessed, the application range of the method is expanded, and the method has important significance for the development of the interconnection of everything.
In an example embodiment, as shown in fig. 2, the gateway at least includes a WIFI central node, and the process of the WIFI central node implementing data transmission with an MQTT proxy server through an MQTT protocol includes: the MQTT proxy server sends a control command to the WIFI central node, the WIFI central node sends back feedback information after receiving and executing the control command, if the feedback is overtime, the MQTT proxy server sends the feedback information again, and when the feedback is overtime for 3 times, the MQTT proxy server determines that the sending is failed and discards the control command; the MQTT proxy server sends a state query command to the WIFI central node, and the WIFI central node sends back state data after receiving the state query command; and the WIFI central node actively reports data to the MQTT proxy server at regular time, and after receiving the data, the MQTT proxy server sends back feedback information. As an example, the MQTT proxy server sends a parameter control instruction: 8, 2, 855, 5, 30, 350, 50, 950, 250, 0, 30, 60, 30, (device type 8, instruction type 2, device ID number 855, recording interval 5min, reporting interval 30min, upper temperature alarm limit 35 ℃, lower temperature alarm limit 5 ℃, upper humidity alarm limit 95%, lower humidity alarm limit 25%, release strategy 0, remote mode relay action duration 30s, local mode detection interval 60s, local mode relay action duration 30 s). Wherein, the setting parameter of the upper and lower temperature limits is original value multiplied by 10 (the range is-500-1000, corresponding to the temperature is-500-1000 ℃), the setting parameter of the upper and lower humidity limits is original value multiplied by 10 (the range is 0-1000, corresponding to the humidity is 0-100%), 4 modes of the air release strategy are provided: "0" means remote command control only; "1" indicates that only one sensor is overrun; "2" indicates that both sensors are simultaneously over-limit, i.e., active; "3" means taking the average of two sensors). When the WIFI center node receives the parameter setting instruction sent by the MQTT proxy server and successfully executes the parameter setting instruction, reporting an execution result to the MQTT proxy server, and uploading feedback information content: 5, 2, OK, (device type 8, instruction type 2, status OK). The data communication process is realized through software programming, a 30s timer is synchronously started by utilizing a multithreading technology, and when the WIFI central node receives a control instruction in 30s, the relay is started or closed so as to control the remote electric equipment.
When the WIFI central node transmits data to the MQTT proxy server, a state query instruction is sent; the MQTT proxy server sends a state query instruction to the WIFI central node and synchronously starts a 30s timer; after receiving the state query instruction, the WIFI central node judges whether the receiving of the WIFI central node is overtime; if not, the WIFI central node executes a corresponding state query instruction; if the feedback is overtime for 3 times, the transmission is determined to fail, and the state query instruction is discarded; judging whether the WIFI central node executes a corresponding state query instruction or not; if the execution is finished, the WIFI central node reports the query result; and if not, feeding back result information to the MQTT proxy server.
In an example embodiment, the method further comprises: setting two themes for each gateway, wherein one theme is used as a gateway end, and the other theme is used as a platform end; when the gateway end is used for sending data, the platform end is used for receiving the data; and when the platform end is used for sending data, the gateway end is used for receiving the data. If there are n gateways in an internet of things system, the number of topics needs to be set to 2 n. For each gateway, a topic needs to be subscribed and a topic needs to be published; the platform end needs to subscribe the topics published by the n gateway ends and publish n topics aiming at different gateways.
When the platform side is used for sending data and the gateway side is used for receiving data, the method further comprises the step of judging whether breakpoint continuous transmission exists between the gateway and the MQTT proxy server, and the method comprises the following steps: judging whether the platform end sends a heartbeat signal every minute or not; if the gateway end receives the heartbeat sent by the platform end, the current platform end, the gateway end and the network are good in operation, the online state of the gateway is set to be 1, and the last communication time is set to be equal to the current time; and if the difference between the current time and the last communication time is greater than the specified effective on-off time, setting the online state of the gateway to be 0, and determining that the breakpoint transmission between the gateway and the MQTT proxy server exists. In this embodiment, since the platform side of the internet of things system only sends some control messages, the online state of the gateway can be obtained and fed back by using a willingness mode of MQTT before sending the messages. Data sending is mainly concentrated on a gateway end, so breakpoint continuous transmission is designed for the gateway end, and a platform end acquires breakpoint continuous transmission data and then analyzes the breakpoint continuous transmission data. The breakpoint resume processing flow is shown in fig. 3.
In this embodiment, the MQTT proxy server provides three service qualities, which are respectively set as: QoS0, QoS1, and QoS 2; wherein, QoS0 is sent only once, QoS1 is sent at least once, and QoS2 is sent just once.
In conclusion, the method constructs the Internet of things cloud platform through the MQTT technology, can comprehensively acquire the state information of the Internet of things equipment in real time, and realizes automatic identification and management of the Internet of things equipment; meanwhile, the information content generated by the Internet of things equipment is synchronized to the Internet of things cloud platform by the MQTT proxy server according to the MQTT protocol, so that the data processing pressure of the MQTT proxy server can be solved, and meanwhile, when a network fault occurs, the MQTT proxy server can retrieve the information content generated by the corresponding Internet of things equipment from the Internet of things cloud platform, so that the linkage of the Internet of things equipment is realized. The method has the advantages of wide coverage range and low energy consumption, can effectively and accurately manage the equipment assets, and simultaneously ensures the convenience, high efficiency and safety of users in the process of using the equipment of the Internet of things.
The foregoing embodiments are merely illustrative of the principles and utilities of the present invention and are not intended to limit the invention. Any person skilled in the art can modify or change the above-mentioned embodiments without departing from the spirit and scope of the present invention. Accordingly, it is intended that all equivalent modifications or changes which can be made by those skilled in the art without departing from the spirit and technical spirit of the present invention be covered by the claims of the present invention.

Claims (10)

1. The system for forming the Internet of things cloud platform based on the MQTT is characterized by comprising the following components: the system comprises an MQTT proxy server, an Internet of things cloud platform, a gateway and a sensing and metering device;
the sensing metering device is used for acquiring information content generated by the Internet of things equipment and packaging the acquired information content to form first packaging data; the Internet of things equipment comprises intelligent Internet of things equipment and/or Internet of things equipment without a wireless communication function; the first packaging data is a data packet or binary stream formed by packaging the sensing metering device according to the application protocol data of the Internet of things equipment;
the gateway is connected with the sensing and metering device and used for acquiring first encapsulated data in the sensing and metering device and encapsulating the acquired first encapsulated data again according to an MQTT protocol to form second encapsulated data;
the gateway is also connected with the MQTT proxy server and used for transmitting the second encapsulated data to the MQTT proxy server, decapsulating the second encapsulated data by the MQTT proxy server and analyzing the decapsulated data according to a data analysis contract prestored in the MQTT proxy server to obtain information content generated by the Internet of things equipment;
the MQTT proxy server is further connected with the Internet of things cloud platform, the MQTT proxy server is in communication connection with the Internet of things cloud platform through an MQTT protocol, and the MQTT proxy server synchronizes information content generated by the Internet of things equipment to the Internet of things cloud platform according to the MQTT protocol.
2. The system for forming the cloud platform of the internet of things based on the MQTT, according to claim 1, wherein when a plurality of sensing and metering devices transmit data simultaneously, the gateway encapsulates the data from the sensing and metering devices into a multi-component data group, transmits the multi-component data group to the MQTT proxy server, decapsulates the data in the multi-component data group by the MQTT proxy server, and parses the decapsulated data according to a data parsing contract prestored on the MQTT proxy server, so as to obtain information content generated by the internet of things device.
3. The system for forming the internet of things cloud platform based on MQTT according to claim 1, wherein the gateway at least includes a WIFI central node, and the process of the WIFI central node for implementing data transmission with the MQTT proxy server through MQTT protocol includes:
the MQTT proxy server sends a control command to the WIFI central node, the WIFI central node sends back feedback information after receiving and executing the control command, if the feedback is overtime, the MQTT proxy server sends the feedback information again, and when the feedback is overtime for 3 times, the MQTT proxy server determines that the sending is failed and discards the control command;
the MQTT proxy server sends a state query command to the WIFI central node, and the WIFI central node sends back state data after receiving the state query command;
and the WIFI central node actively reports data to the MQTT proxy server at regular time, and after receiving the data, the MQTT proxy server sends back feedback information.
4. The system for forming the cloud platform of the internet of things based on the MQTT, according to claim 3, wherein when the WIFI central node transmits data to the MQTT proxy server, the system further comprises sending a status query instruction;
the MQTT proxy server sends a state query instruction to the WIFI central node and synchronously starts a 30s timer;
after receiving the state query instruction, the WIFI central node judges whether the receiving of the WIFI central node is overtime; if not, the WIFI central node executes a corresponding state query instruction; if the feedback is overtime for 3 times, the transmission is determined to fail, and the state query instruction is discarded;
judging whether the WIFI central node executes a corresponding state query instruction or not; if the execution is finished, the WIFI central node reports the query result; and if not, feeding back result information to the MQTT proxy server.
5. The system for forming an internet of things cloud platform based on MQTT according to claim 1, further comprising: setting two themes for each gateway, wherein one theme is used as a gateway end, and the other theme is used as a platform end;
when the gateway end is used for sending data, the platform end is used for receiving the data;
and when the platform end is used for sending data, the gateway end is used for receiving the data.
6. The system for forming the cloud platform of the internet of things based on the MQTT, according to claim 4, wherein when the platform side is configured to send data and the gateway side is configured to receive data, the method further includes determining whether there is a breakpoint resume between the gateway and the MQTT proxy server, including:
judging whether the platform end sends a heartbeat signal every minute or not;
if the gateway end receives the heartbeat sent by the platform end, the current platform end, the gateway end and the network are good in operation, the online state of the gateway is set to be 1, and the last communication time is set to be equal to the current time;
and if the difference between the current time and the last communication time is greater than the specified effective on-off time, setting the online state of the gateway to be 0, and determining that the breakpoint transmission between the gateway and the MQTT proxy server exists.
7. The system for forming the internet of things cloud platform based on the MQTT, according to claim 1, wherein the MQTT proxy server provides three qualities of service, which are respectively set as: QoS0, QoS1, and QoS 2; wherein, QoS0 is sent only once, QoS1 is sent at least once, and QoS2 is sent just once.
8. A method for forming an Internet of things cloud platform based on MQTT is characterized by comprising the following steps:
acquiring information content generated by the Internet of things equipment by using a sensing metering device, and packaging the acquired information content to form first packaging data; the Internet of things equipment comprises intelligent Internet of things equipment and/or Internet of things equipment without a wireless communication function; the first packaging data is a data packet or binary stream formed by packaging the sensing metering device according to the application protocol data of the Internet of things equipment;
establishing communication connection between a gateway and the sensing and metering device, acquiring first encapsulated data in the sensing and metering device, and encapsulating the acquired first encapsulated data again according to an MQTT protocol to form second encapsulated data;
establishing a communication connection between the gateway and the MQTT proxy server, transmitting the second encapsulated data to the MQTT proxy server, decapsulating the second encapsulated data by the MQTT proxy server, and analyzing the decapsulated data according to a data analysis contract prestored in the MQTT proxy server to obtain information content generated by the Internet of things equipment;
and establishing communication connection between the MQTT proxy server and the Internet of things cloud platform according to an MQTT protocol, and controlling the MQTT proxy server to synchronize information content generated by the Internet of things equipment to the Internet of things cloud platform according to the MQTT protocol.
9. The method for forming the cloud platform of the internet of things based on the MQTT, according to claim 1, wherein when a plurality of sensing and metering devices transmit data simultaneously, the gateway encapsulates the data from the sensing and metering devices into a multi-component data group, then transmits the multi-component data group to the MQTT proxy server, decapsulates the data in the multi-component data group by the MQTT proxy server, and parses the decapsulated data according to a data parsing contract prestored on the MQTT proxy server, so as to obtain information content generated by the internet of things device.
10. The method for forming the internet of things cloud platform based on the MQTT according to claim 1, wherein the gateway at least comprises a WIFI central node, and the process of the WIFI central node for realizing data transmission with the MQTT proxy server through the MQTT protocol comprises:
the MQTT proxy server sends a control command to the WIFI central node, the WIFI central node sends back feedback information after receiving and executing the control command, if the feedback is overtime, the MQTT proxy server sends the feedback information again, and when the feedback is overtime for 3 times, the MQTT proxy server determines that the sending is failed and discards the control command;
the MQTT proxy server sends a state query command to the WIFI central node, and the WIFI central node sends back state data after receiving the state query command;
and the WIFI central node actively reports data to the MQTT proxy server at regular time, and after receiving the data, the MQTT proxy server sends back feedback information.
CN202110884492.5A 2021-08-03 2021-08-03 Method and system for forming Internet of things cloud platform based on MQTT Withdrawn CN113572853A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110884492.5A CN113572853A (en) 2021-08-03 2021-08-03 Method and system for forming Internet of things cloud platform based on MQTT

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110884492.5A CN113572853A (en) 2021-08-03 2021-08-03 Method and system for forming Internet of things cloud platform based on MQTT

Publications (1)

Publication Number Publication Date
CN113572853A true CN113572853A (en) 2021-10-29

Family

ID=78170068

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110884492.5A Withdrawn CN113572853A (en) 2021-08-03 2021-08-03 Method and system for forming Internet of things cloud platform based on MQTT

Country Status (1)

Country Link
CN (1) CN113572853A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114500554A (en) * 2022-02-09 2022-05-13 南京戎光软件科技有限公司 Internet of things system management method
CN114666367A (en) * 2022-03-21 2022-06-24 浙江大学 General Internet of things system based on product equipment mode
CN114915642A (en) * 2022-05-09 2022-08-16 安徽农业大学 Multi-user multi-terminal Internet of things sensing and control system based on cloud platform
CN115002170A (en) * 2022-08-05 2022-09-02 江苏橙智云信息技术有限公司 Multi-condition linkage instruction execution method based on Internet of things
CN115002148A (en) * 2022-04-21 2022-09-02 浪潮云信息技术股份公司 Internet of things cloud side communication method and system
CN116546117A (en) * 2023-07-05 2023-08-04 北京智芯微电子科技有限公司 Method and system for analyzing MQTT protocol of intelligent fusion terminal

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114500554A (en) * 2022-02-09 2022-05-13 南京戎光软件科技有限公司 Internet of things system management method
CN114500554B (en) * 2022-02-09 2024-04-26 南京戎光软件科技有限公司 Internet of things system management method
CN114666367A (en) * 2022-03-21 2022-06-24 浙江大学 General Internet of things system based on product equipment mode
CN115002148A (en) * 2022-04-21 2022-09-02 浪潮云信息技术股份公司 Internet of things cloud side communication method and system
CN114915642A (en) * 2022-05-09 2022-08-16 安徽农业大学 Multi-user multi-terminal Internet of things sensing and control system based on cloud platform
CN115002170A (en) * 2022-08-05 2022-09-02 江苏橙智云信息技术有限公司 Multi-condition linkage instruction execution method based on Internet of things
CN115002170B (en) * 2022-08-05 2022-11-22 江苏橙智云信息技术有限公司 Multi-condition linkage instruction execution method based on Internet of things
CN116546117A (en) * 2023-07-05 2023-08-04 北京智芯微电子科技有限公司 Method and system for analyzing MQTT protocol of intelligent fusion terminal
CN116546117B (en) * 2023-07-05 2023-12-22 北京智芯微电子科技有限公司 Method and system for analyzing MQTT protocol of intelligent fusion terminal

Similar Documents

Publication Publication Date Title
CN113572853A (en) Method and system for forming Internet of things cloud platform based on MQTT
CN107800621B (en) Novel intelligent home gateway supporting multiple access protocols
Atmoko et al. IoT real time data acquisition using MQTT protocol
KR100629592B1 (en) Data processing method for application layer
WO2019205907A1 (en) Intelligent device communication platform based on mqtt message protocol
CN111031034A (en) Multi-protocol convergence edge computing gateway
CN101461194B (en) A method and system for remotely accessing devices in a network
CN109981668A (en) Common apparatus Internet of Things communication means based on the extensive agreement of MQTT
CN105610888A (en) Method of using socket to push message based on Android and system thereof
CN111555945B (en) General network communication system based on MQTT protocol
CN103916442A (en) Message pushing achieving method, mobile terminal and message pushing system
KR20040104321A (en) Home network system
CN114567620B (en) Digital model and physical equipment matching system and method based on MQTT protocol
CN103916424B (en) A kind of method, communication terminal and the communication network of management and control application program heartbeat packet
Wahle et al. The OpenMTC framework—M2M solutions for smart cities and the internet of things
CN104993979A (en) Network connection monitoring method, terminal equipment and communication system
CN112751937A (en) Distributed edge intelligent Bluetooth Mesh gateway system and implementation method
CN106899560B (en) Method for automatic intercommunication of different protocols of Internet of things and Internet of things terminal
CN110225005A (en) A kind of smart machine control method and system based on Netty network frame
CN111884938B (en) Router information acquisition method and device
CN106130787B (en) Service processing system based on software defined network
CN116319729A (en) Robot control method, device, server, system and storage medium
CN101997858B (en) Method and device for consumer premises equipment wide area network management protocol (CWMP) conversation interaction
CN104079422A (en) Method of managing network equipment
CN114205842B (en) Device cooperation synchronization method, system, device, terminal device and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
WW01 Invention patent application withdrawn after publication
WW01 Invention patent application withdrawn after publication

Application publication date: 20211029