Disclosure of Invention
The invention aims to provide a system and a method for visualizing sensor network node data, which solve the problems of node connection congestion and data redundancy in the prior art.
In order to achieve the purpose, the invention provides the following scheme:
a system for sensor network node data visualization, comprising: the system comprises a plurality of sensors, a main processor, an Ethernet controller and a browser;
the data transmitting end of each sensor is connected with the data input end of the main processor; the main processor is used for storing the data of the sensor;
the main processor and the Ethernet controller are in bidirectional communication through an Ethernet network, and the Ethernet controller and the browser are in bidirectional communication through an IPv6 network; the main processor is used for reading the data of the sensor according to webpage visualization request data input by a user in the browser, and transmitting the data to the browser for display through an Ethernet and an IPv6 network.
Optionally, the main processor includes a microcontroller and a storage unit;
the microcontroller is connected with the data sending end of each sensor through an asynchronous receiving and transmitting transmitter; the microcontroller is connected with the storage unit in a bidirectional mode, the microcontroller is used for carrying out average processing on the data of the sensor, and the storage unit is used for storing the data of the sensor after the average processing;
the microcontroller is bidirectionally connected with an interface of the Ethernet controller through an Ethernet peripheral interface; the microcontroller is further configured to read the data of the sensor stored in the storage unit according to the web page visualization request data sent by the ethernet controller, and send the data to the ethernet controller through an ethernet network.
Optionally, the microcontroller is loaded with a driver, an embedded operating system, an IPv6 protocol stack, and an HTTP service program.
Optionally, the model of the main processor is STM32F 107.
Optionally, the ethernet controller is of the type LAN 8742A.
A method for data visualization of a sensor network node, the method for data visualization of a sensor network node being applied to the system for data visualization of a sensor network node according to any one of claims 1 to 5, the method for data visualization of a sensor network node comprising:
acquiring webpage visualization request data; the webpage visualization request data is IPv6HTTP service address data input by a user in a browser;
analyzing and verifying the visualization request data by adopting a processing function of an IPv6 protocol stack;
when the analysis and verification pass, reading data of a sensor corresponding to the IPv6HTTP service address data from a local storage unit;
packaging the data of the sensor by adopting an IPv6 protocol stack;
sending the encapsulated data of the sensor to a browser of a user through an Ethernet controller and an IPv6 network for visualization;
and returning to the step of acquiring the webpage visualization request data when the analysis and verification are failed.
Optionally, the acquiring webpage visualization request data further includes:
acquiring data of each sensor in a sensor network;
carrying out average processing on the data of each sensor to obtain processed data;
and storing the processed data to the local storage unit according to the IPv6 protocol stack.
Optionally, the storing the processed data to the local storage unit according to the IPv6 protocol stack further includes:
initializing the Ethernet controller;
initializing the IPv6 protocol stack to obtain an IPv6HTTP service address corresponding to the data of each sensor in the local storage unit.
Optionally, the encapsulated data of the sensor is sent to a browser of a user through an ethernet controller and an IPv6 network in a JavaScript Object notification format for visualization.
According to the specific embodiment provided by the invention, the invention discloses the following technical effects:
the invention provides a system and a method for visualizing sensor network node data, which are characterized in that a main processor analyzes and verifies visualization request data by adopting a processing function of an IPv6 protocol stack, and obtains sensor data corresponding to IPv6HTTP service address data, namely each sensor network node has a fixed IPv6 address; the data of the sensor corresponding to the IPv6 address can be determined through the fixed IPv6 address, and further visualization of the data of each sensor is achieved; moreover, each sensor network node has a fixed IPv6 address, so that the congestion of IPv6 addresses caused by a plurality of sensor network nodes being one IPv6 address is prevented; and realize the data of each sensor is processed independently, prevent the data redundancy that causes while processing a large amount of data.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The invention aims to provide a system and a method for visualizing sensor network node data, which solve the problems of node connection congestion and data redundancy in the prior art.
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in further detail below.
Fig. 1 is a schematic structural diagram of a system for visualizing sensor network node data provided by the present invention, and as shown in fig. 1, the system for visualizing sensor network node data provided by the present invention includes: a plurality of sensors, a main processor 1, an ethernet controller 2 and a browser 3. The sensors are respectively a gas sensor, a temperature sensor, a humidity sensor and an air pressure sensor, and a data acquisition board is formed by the sensors. The model of the main processor 1 is STM32F 107.
The data transmitting end of each sensor is connected with the data input end of the main processor 1; reading data of the sensor through a serial port data communication protocol; the main processor 1 is used for storing the data of the sensor.
The main processor 1 and the Ethernet controller 2 are in bidirectional communication through an Ethernet network, and the Ethernet controller 2 and the browser 3 are in bidirectional communication through an IPv6 network; the main processor 1 is configured to read data of the sensor according to web page visualization request data input by a user in the browser 3, and transmit the data to the browser 3 through an ethernet network and an IPv6 network for display.
Corresponding to fig. 1, fig. 2 is a schematic diagram of a system for visualizing data of a sensor network node provided by the present invention, as shown in fig. 2, the present invention maps data to an IPv6, 128-bit address space, and as can be seen from fig. 3, in the prior art, all data of a sensor are gathered together and mapped to an IPv4, 32-bit network space.
The ethernet controller 2 is of the type LAN8742A, and implements data transmission at the network physical layer via an RJ45 standard ethernet interface.
In order to achieve the above-mentioned effect of the main processor 1, the main processor 1 comprises a microcontroller and a memory unit.
The microcontroller is connected with the data sending end of each sensor through a Universal Asynchronous Receiver/Transmitter (UART); the microcontroller is connected with the storage unit in a bidirectional mode, the microcontroller is used for carrying out average processing on the data of the sensor, and the storage unit is used for storing the data of the sensor after the average processing;
the microcontroller is bidirectionally connected with an interface of the Ethernet controller 2 through an Ethernet peripheral interface; the microcontroller is further configured to read the data of the sensor stored in the storage unit according to the web page visualization request data sent by the ethernet controller 2, and send the data to the ethernet controller 2 through an ethernet network.
Fig. 4 is a schematic structural diagram of each program loaded on the microcontroller provided by the present invention, and as shown in fig. 4, the microcontroller is loaded with a driver, an embedded operating system, an IPv6 protocol stack, and an HTTP service program. The microcontroller realizes communication between data of each sensor and the main processor 1, between the main processor 1 and the ethernet controller 2, and between the ethernet controller 2 and the browser 3 through respective loaded programs.
The control processor needs to implement software drivers in the internal software in order to connect the sensors. The interface after the sensor drive is realized comprises two functions: read sensor data and write sensor control commands. The embedded operating system calls a function control to read the data of the sensor when the task needs.
The driver provides data receiving and sending services of a physical layer for an IPv6 protocol stack, after the driver is completed, when the IPv6 protocol stack needs to send data, a driven data sending function is called to send the data to an IPv6 network, and when the IPv6 network has data to send to an embedded operating system of the system, a network hardware driver analyzes the data and then transmits the data to the IPv6 protocol stack for next processing.
The IPv6 protocol stack provides various application interfaces of IPv6 for the system and provides IPv6 network access capability. The IPv6 network access capability comprises IPv6 address resolution, IPv6 protocol received data resolution and data transmission encapsulation. And the HTTP network application service is provided for the embedded operating system based on the IPv6 protocol stack.
The program realizes the complete operation of the program by calling the functional interfaces of the embedded operating system, such as task management, semaphore, message mailbox, timer and the like.
As shown in fig. 5, the present invention further provides a method for visualizing sensor network node data, and the method for visualizing sensor network node data is applied to the system for visualizing sensor network node data. The method for visualizing the data of the sensor network node comprises the following steps:
s501, acquiring webpage visualization request data; the web page visualization request data is IPv6HTTP service address data input by the user in the browser 3.
The transmission of the web page visualization request data is completed through an HTTP protocol. The main processor 1 obtains the web page visualization request data through the ethernet controller 2.
S502, analyzing and verifying the visualization request data by adopting a processing function of an IPv6 protocol stack.
And S503, when the analysis and verification pass, reading the data of the sensor corresponding to the IPv6HTTP service address data from the local storage unit.
S504, the data of the sensor is encapsulated by adopting an IPv6 protocol stack.
And S505, sending the encapsulated data of the sensor to a browser 3 of a user through the Ethernet controller 2 and the IPv6 network for visualization.
The data of the sensor is sent to the browser 3 of the user in a JavaScript Object notification format through the Ethernet controller 2 and the IPv6 network for visualization.
S506, when the analysis and verification are failed, returning to the step of acquiring the webpage visualization request data.
Before S501, the method further includes:
data of each sensor in the sensor network is acquired.
And averaging the data of each sensor to obtain the processed data.
And storing the processed data to the local storage unit according to the IPv6 protocol stack.
The ethernet controller 2 is initialized.
Initializing the IPv6 protocol stack to obtain an IPv6HTTP service address corresponding to the data of each sensor in the local storage unit.
The transmission process of the webpage visualization request data in the practical application comprises the following steps:
1) initializing an IPv6 protocol stack and an Ethernet controller 2; and creates an HTTP listening service thread.
2) And directly accessing the IPv6 address of the sensor node through the browser 3 under the IPv6 network environment, and acquiring a webpage corresponding to the data of the sensor.
3) The HTTP monitoring service thread judges whether a webpage visualization request data connection exists; if the webpage visualization request data connection exists, sending the data, disconnecting the current connection, and returning to the step 1); otherwise, directly returning to the step 1).
The sending the encapsulated data of the sensor to the browser 3 of the user through the ethernet controller 2 and the IPv6 network in the JavaScript Object notification format for visualization specifically includes:
the browser 3 parses the sensor data in JavaScript object notification format.
The webpage visualization request data usually adopts a static array to store the HTML document, while in the invention, the data of the sensor needs to be dynamically displayed in the webpage, so that a JavaScript program needs to be embedded into the dynamic request node data in the HTML document.
The specific process of the browser 3 accessing the sensor data once is as follows:
1) the access node IPv6 address is entered in the browser 3.
2) And acquiring sensor data corresponding to the IPv6 address of the access node, and sending the static webpage data to the browser 3.
3) After receiving the HTML format file, the browser 3 analyzes the sensor data in the JavaScript Object notification format.
4) And sending a data request URL to obtain the data of the sensor in the JSON format.
"$. get ("/GetAir. JSON ", function (data)" sends a URL request to obtain data of a sensor in JSON format
5) And analyzing the data of the sensor in the son format, and displaying the real-time data of the sensor.
6) The access is ended.
The reason why the data of the sensor is transmitted in the JavaScript Object notification format is to acquire the data of the sensor again and display the data.
When the browser 3 is executed again, the function of "$. get ("/getdevice. json ", function (data)" is only required to be input to request the connection information of the device, so that the IPv6 addresses of the device node and the client can be seen on the webpage, and the management is convenient for the user.
The system and the method for visualizing the data of the sensor network node realize an IPv6 protocol in an embedded system with limited resources, so that the sensor node can be remotely accessed through a fixed IPv6 address.
The data transmission mode of the traditional sensor network node is broken through, and the HTTP network server is realized in the embedded system based on the IPv6 technology, so that the sensor node can be remotely accessed through a webpage to obtain the acquired data.
Aiming at the characteristic of resource limitation of an embedded system, a special webpage design scheme is adopted, the webpage design on the embedded system is realized by directly converting a static webpage into a C language array, and the data are dynamically displayed on the webpage by combining a JavaScript program.
The embodiments in the present description are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. For the system disclosed by the embodiment, the description is relatively simple because the system corresponds to the method disclosed by the embodiment, and the relevant points can be referred to the method part for description.
The principles and embodiments of the present invention have been described herein using specific examples, which are provided only to help understand the method and the core concept of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, the specific embodiments and the application range may be changed. In view of the above, the present disclosure should not be construed as limiting the invention.