Disclosure of Invention
The invention aims to overcome the defects of the prior art and provide an environment sensing open service system and an application method, and the system and the application method fully utilize the standard access and application template type design provided by an M2M open platform to realize the monitoring of parameters such as indoor temperature, humidity, PM 2.5/dust concentration and the like.
In order to solve the technical problems, the invention provides an environment-aware open service system, which comprises a plurality of monitoring terminals, a gateway, an M2M open platform, an environment-aware service platform and a user side; the monitoring terminal collects environmental data, is wirelessly connected to the gateway through WiFi, and is uploaded to the M2M open platform through the gateway; the environment perception service platform pulls real-time data information or pushes control information to the M2M open platform through a standard open interface, and finally presents the real-time data information or the control information to a user side;
the monitoring terminal comprises a microprocessor core board, and a power module, a multi-path relay, a wireless module, a temperature sensor, a humidity sensor and a PM 2.5/dust sensor which are connected with the microprocessor core board; the temperature sensor, the humidity sensor and the PM 2.5/dust sensor are used for collecting environmental data of temperature, humidity and PM 2.5/dust concentration; the power module is used for intensively supplying power to the microprocessor core board, the plurality of sensors, the multi-path relay and the wireless module, and the microprocessor core board is used for monitoring the voltage of the power module in real time; the wireless module uploads environmental data;
the microprocessor core board completes system clock and interrupt configuration, system initialization, environment data cyclic uploading and upper layer instruction analysis instruction operation relay monitoring;
the monitoring terminal is accessed to an M2M open platform in a business service agent mode; the service agent comprises a primary service agent and a secondary service agent;
the microprocessor core board of the monitoring terminal is provided with a secondary business service agent for realizing the adaptive access of a sensor of the monitoring terminal, sensing and monitoring the working state of the sensor, a relay and a power supply module integrated with the monitoring terminal, converging and preprocessing the sensor data and sending the sensor data to a primary business service agent of the gateway;
the gateway configures a primary business service agent, performs adaptive access and management on environmental data transmitted by a single or a plurality of monitoring terminals, and performs distributed management on a secondary business service agent in the monitoring terminals;
the primary business service agent comprises a gateway working state sensing module, a scene setting module, a remote transmission module and a strategy downloading module;
the gateway working state sensing module is used for monitoring the working resources and the memory occupation of the gateway and monitoring the communication link with the M2M open platform in real time;
the scene setting module is used for establishing an intelligent perception application scene aiming at the multiple monitoring terminals;
the remote transmission module realizes remote communication between the gateway and the M2M open platform;
the strategy downloading module is used for remotely downloading software update versions of the primary SSA and the secondary SSA from the M2M open platform;
the working parameters, the configuration strategies and the interaction mechanisms of the primary service agent and the secondary service agent are uniformly managed by an M2M open platform;
the user side refers to a user mobile phone or a tablet personal computer, and the user side directly embeds the M2M open platform generated temperature, humidity and PM2.5 services for display.
The microprocessor core board adopts an STM32 series chip kylin seat V2.4 development board; the wireless module adopts an ESP8266 wireless module.
The initialization of the microprocessor core board system comprises the initialization of a system clock, the initialization of sensor hardware and the initialization of a wireless module.
The interrupt configuration refers to setting a timer interrupt when programming based on a microprocessor core board, or setting feedback according to an external sensor or a control instruction to form an interrupt signal.
When the newly added sensor hardware is accessed, the acquisition and processing of the newly added sensor data are completed by performing software programming on the secondary service agent; meanwhile, the version of the second-level service agent of the newly added software programming can initiate a policy downloading request to the M2M open platform through the first-level service agent, so that remote updating is realized;
when the process resources of the monitoring terminal are in shortage to cause overhigh memory occupation, the second-level business service agent and the first-level business service agent of the gateway carry out communication interaction, and under the condition that the configuration strategy allows, the monitoring terminal enters a restarting state and automatically closes the process with lower priority;
when the working power supply of the power supply module of the monitoring terminal enters a set area, after the second-stage SSA and the first-stage SSA synchronize information, the monitoring terminal enters a stage energy-saving working mode or a dormant mode according to a set configuration strategy, and the original working mode is switched back after the power supply module is supplied.
The standard open interface described above employs a RESTful API interface.
The application method of the environment-aware open service system comprises the following steps:
1) the monitoring terminal is accessed to an M2M open platform, and the specific steps are as follows:
11) installing an application APP at a user side; starting a gateway;
12) the monitoring terminal is electrified to enter a starting state, and the working state of the monitoring terminal is identified through the monitoring terminal indicator lamp;
13) the user side application APP is wirelessly connected with the gateway, and the wireless connection between the application APP and a first-level business service agent in the gateway is started;
14) establishing a wireless association relationship between a first-level business service agent in the gateway and a user side application APP, and enabling the first-level business service agent to enter a configuration process, namely starting a code matching function of the gateway;
15) the wireless module of the monitoring terminal automatically enters an access detection working mode, and an IP address is obtained through an OPTION extension field in a dynamic host configuration protocol, wherein the OPTION extension field comprises an LOID, an SSID and a password of a gateway;
16) the monitoring terminal extracts the SSID and the password according to the OPTION extended field and then turns to the step 17); if the extraction is not successful, the network joining is failed, and the monitoring terminal ends the network parameter configuration process;
17) the monitoring terminal automatically joins the wireless network established by the gateway;
18) after the monitoring terminal successfully realizes the network parameter configuration and information storage by the primary service agent in the gateway, the configuration process of the primary service agent exits at the moment; the exit of the primary business service agent is triggered by the fact that the monitoring terminal successfully joins in a wireless network, or is manually executed in a user side application APP;
2) the method for monitoring the registration and binding process of the terminal specifically comprises the following steps:
21) the monitoring terminal initiates a terminal registration and binding request to the environment sensing service platform, or initiates a request to the gateway, and a primary service agent in the gateway performs acceptance and management;
22) the real-time request of the monitoring terminal is executed by the environment sensing service platform and replies feedback information of successful binding;
23) logging in an environment perception service platform by a user to use a monitoring terminal service;
24) the environment perception service platform sends the user account information to the M2M open platform for authentication;
25) after the authentication of the M2M open platform is passed, the environment sensing service platform allows the user account to use the service, and the user directly associates and manages the monitoring terminal under the name of the user and uses the related service;
3) after the registration is successful, adding a new project under the user account, and adding a monitoring terminal under the new project;
4) the microprocessor core board of the monitoring terminal completes system clock and interrupt configuration and carries out system initialization;
5) the monitoring terminal detects indoor temperature, humidity and PM 2.5/dust concentration, collects environmental data, and uploads the environmental data to an M2M open platform in a WiFi mode through a business service agent mode;
6) and the environment perception service platform pulls the environment data information or pushes the control information to the M2M open platform through a standard open interface, and then displays the environment data information or the push control information on a user side webpage in real time for a user to monitor.
The user monitors the change of the environmental data through a Web page of a user side, and the change of the data is reflected in a form of a support dial plate or a curve form; the Web page adopts HTML, CSS and bootstrap frames, wherein the HTML and the CSS are used for page layout.
The aforementioned M2M opens the platform configuration trigger and sets an alarm threshold, and alarms abnormal environmental data exceeding the alarm threshold.
The monitoring terminal collects environmental data and uploads the environmental data to an M2M open platform every 5 seconds.
The invention achieves the following beneficial effects:
(1) the system disclosed by the invention is mainly used for realizing remote real-time online monitoring on the basis of the M2M open platform in function, and has the characteristics of clear development thought, low development cost, quick application and incubation and the like in the development process.
(2) According to the invention, a user can monitor the indoor environment quality at any time and any place, and a series of environmental intervention measures are taken according to the monitoring result, so that the human health guarantee and the article property safety guarantee are provided.
(3) The application method for providing terminal access and background monitoring based on the M2M open platform can improve the generation efficiency of new services and is convenient for the convergence and development of the Internet of things services.
(4) The invention is also suitable for scenes such as fire monitoring and prevention, preservation cultural relic protection, smokeless room monitoring and the like, and has better universality and popularization value.
Detailed Description
The invention is further described below. The following examples are only for illustrating the technical solutions of the present invention more clearly, and the protection scope of the present invention is not limited thereby.
As shown in fig. 1, the environment-aware open service system of the present invention includes a plurality of monitoring terminals, a gateway, an M2M open platform, an environment-aware service platform, and a user side. The monitoring terminal collects environmental data, wirelessly connects the environmental data to the gateway through WiFi, and uploads the environmental data to the M2M open platform through the gateway; the environment-aware service platform pulls real-time data information or pushes control information to the M2M open platform through a standard open interface (such as a RESTful API interface), and finally presents the real-time data information or the control information to the user side.
The monitoring terminal mainly realizes the collection of environmental data information, the uploading of data to an M2M open platform and the corresponding action of receiving instructions. The specific structure is shown in fig. 2, and comprises a microprocessor core board, a power supply module connected with the microprocessor core board, a multi-path relay, a wireless module (such as an ESP 8266), a temperature sensor, a humidity sensor, a PM 2.5/dust sensor and the like. Wherein, the temperature sensor, the humidity sensor and the PM 2.5/dust sensor are used for collecting environmental data of temperature, humidity and PM 2.5/dust concentration. The power module carries out the centralized power supply to microprocessor nuclear core plate, a plurality of sensor, multichannel relay and wireless module, microprocessor nuclear core plate carries out real-time voltage monitoring to power module simultaneously, power module voltage when monitor terminal crosses low (undervoltage) will trigger the undervoltage warning automatically, this warning message will report to the open platform of M2M and environmental perception service platform through the gateway, monitor terminal self simultaneously reminds through pilot lamp etc. to can get into dormancy mode etc. according to monitor terminal's settlement. The wireless module uploads the environmental data. The switches of the related equipment are controlled by the multi-path relays, and meanwhile, the microprocessor core board carries out timing detection on the working state of each relay, so that the safety confirmation of the working state of the relay is achieved.
The microprocessor core board completes four main functions of system clock and interrupt configuration, system initialization, environment data loop uploading, upper layer instruction monitoring and action response and other auxiliary functions, and the implementation flow is as follows with reference to fig. 3:
the system initialization mainly comprises the initialization of a system clock, the initialization of sensor hardware and the initialization of a wireless module, in order to improve the real-time performance of the system and the accuracy of acquiring and uploading terminal environment data, receiving instructions and completing operations, the system clock configuration operation is realized, and for example, the system clock configuration is the highest frequency 72MHZ supported by STM32F103VET 6.
Interrupt configuration refers to setting a timer interrupt (e.g., a periodic sampling timer, which is interrupted every set period) when programming based on the microprocessor core board, or setting an interrupt signal according to external sensing or control feedback.
After the system initialization is completed, the microprocessor core board receives the upper layer instruction to realize the operation of the relay by circularly sending the environmental data and analyzing the instruction.
Furthermore, the microprocessor core board adopts an STM32 series chip kylin socket V2.4 development board. The wireless module adopts an ESP8266 wireless module. The dust sensor adopts a GPYY1010AU0F optical dust concentration detection sensor.
In the invention, the monitoring terminal adopts a wireless interface mode, and if an M2M open platform and an environment-aware service platform are added, the monitoring terminal needs to be connected to a home wireless gateway (such as a home wireless router). Therefore, in the practical application process, the monitoring terminal is accessed to the M2M open platform by configuring the service agent (SSA).
Referring to fig. 4 and 5, the SSA includes a two-stage architecture, and a microprocessor core board of the monitoring terminal configures a two-stage SSA, which is mainly used to implement adaptive access of a sensor of the monitoring terminal, perform sensing monitoring on working states of peripheral devices such as a sensor, a relay, and a power module integrated with the monitoring terminal, aggregate and preprocess sensor data, and send the sensor data to a one-stage SSA of the gateway.
When the newly added sensor hardware is accessed, the software programming can be directly carried out on the secondary SSA, so that the acquisition and processing of the newly added sensor data are completed; and at the moment, the secondary SSA version of the newly added software program can initiate a policy downloading request to the M2M open platform through the primary SSA, so that remote updating of the secondary SSA of the monitoring terminal can be automatically realized.
When the process resource of the monitoring terminal is in shortage to cause overhigh memory occupation, the secondary SSA and the primary SSA of the gateway carry out communication interaction, and the monitoring terminal can enter a restarting state and automatically close part of processes with lower priority under the condition allowed by the configuration strategy.
When the working power supply of the power supply module of the monitoring terminal enters a set area, after the second-level SSA and the first-level SSA synchronize information, the monitoring terminal can enter a stage energy-saving working mode or a sleep mode according to a set strategy, and the original working mode is switched back after the power supply is supplied.
The gateway configures a primary SSA mainly responsible for adaptive access and management of data transmitted by a single or multiple monitoring terminals, and can perform distributed management on a secondary SSA in the monitoring terminals. The first-level SSA comprises a gateway working state sensing module, a scene setting module, a remote transmission module and a strategy downloading module, wherein the gateway working state sensing module is used for monitoring the working resource and memory occupation of the gateway, and monitoring the communication link between the gateway working state sensing module and the M2M open platform in real time, so that the smoothness of a remote communication link is ensured, and the reliability of remote communication is ensured.
The scene setting module is mainly used for establishing an intelligent sensing application scene aiming at multiple monitoring terminals, for example, when the indoor temperature enters a set temperature threshold value area, the monitoring terminals connected with the air conditioning equipment (supporting wireless communication control) are controlled to start the air conditioning to work, and intelligent environment sensing service is achieved through the cooperative work of the multiple monitoring terminals.
And the remote transmission module is mainly used for realizing the remote communication function between the gateway and the M2M open platform.
And the strategy downloading module can remotely download the software updating versions of the primary SSA and the secondary SSA from the M2M open platform.
The user sends the network parameters to the monitoring terminal through the SSA by triggering the SSA in the gateway and the DHCP extension field, and the wireless connection convenience of the monitoring terminal is improved through an SSA software control mode.
Referring to fig. 7, the environment-aware service platform pulls environment data information or pushes control information to the M2M open platform through a standard open interface (e.g., a RESTful API interface), and then displays the environment data information or the push control information on a front-end webpage in real time for a user to perform operations such as monitoring and control.
The user side of the invention refers to a user mobile phone, a tablet personal computer and the like, and the user monitors the change of the environmental data through the Web page of the user side. The Web page is mainly designed by using a plurality of mainstream front-end technologies including HTML, CSS and bootstrap frameworks, wherein the HTML and CSS are mainly used for layout, the display of a user side directly embeds applications (such as services of temperature, humidity, PM2.5 monitoring and the like) generated by an M2M open platform, the data change is mainly reflected in a dial plate form or a curve form, and the user side can call a real-time weather control so that the user can monitor the indoor environment and know the outdoor weather condition.
The invention accesses the monitoring terminal into the M2M open platform according to the standard access flow and design method provided by the M2M open platform, and the process is roughly divided into several steps of login and registration, new project, new equipment, new data flow, uploading and checking data and new application, and the like, as shown in FIG. 6.
Before accessing the monitoring terminal into the M2M open platform, a user account needs to be registered on the M2M open platform (i.e., a new service platform and system are generated based on the M2M open platform), and after successful registration, a new project can be added under the user account, a new device can be added under the new project, and a new data stream can be added under the device. After the environment data is successfully uploaded, data points will be generated in the corresponding data streams of the platform, and finally, in order to present the changes of the data more intuitively, the user can customize the personalized application and publish it to the application hatcher.
Referring to fig. 8, the procedure for monitoring the access of the terminal to the M2M open platform is as follows:
11) installing an application APP at a user side; starting a gateway;
12) the monitoring terminal is electrified to enter a starting state, and the working state of the monitoring terminal can be identified by the monitoring terminal indicator light;
13) the application APP is wirelessly connected with the gateway, and the wireless connection between the application APP and a first-level service agent (SSA) in the gateway is started;
14) establishing a wireless association relationship between a first-stage SSA in the gateway and a user side application APP, and starting a code matching function of the gateway when the first-stage SSA enters a configuration process;
15) the wireless module of the monitoring terminal automatically enters an access detection working mode, an IP address is obtained through a dynamic host configuration protocol, an extended field in the dynamic host configuration protocol, namely an OPTION field, is required in the process, the OPTION field belongs to the dynamic host configuration protocol, is a variable-length field and mainly comprises message types, partial lease information and the like, the number of the extended field is 1-255, and the extended field comprises an LOID (account number of user registration service), an SSID and a password of a gateway;
16) the monitoring terminal extracts the SSID and the password according to the OPTION field and then turns to the step 17); if the extraction is not successful, the network joining is failed, and the monitoring terminal ends the network parameter configuration process;
17) the monitoring terminal automatically joins the wireless network established by the gateway;
18) after the monitoring terminal successfully realizes network parameter configuration and information storage by the primary SSA in the gateway, the configuration process of the primary SSA is exited at the moment; the exit of the first-stage SSA operation may be triggered by the monitoring terminal successfully joining the wireless network, or may be implemented in the user side APP by a manual operation mode.
After the monitoring terminal is successfully accessed through the wireless network, a registration and binding process is required, and a main flow is shown in fig. 9, and the method specifically includes the following steps:
21) and the monitoring terminal initiates a terminal registration and binding request to the environment sensing service platform, and the registration and binding process of the monitoring terminal can also initiate a request to the gateway by the monitoring terminal and is accepted and managed by a primary SSA in the gateway.
22) And monitoring real-time requests (including registration and binding requests of the primary SSA) of the terminal, and executing and replying feedback information of successful binding by the environment-aware service platform.
23) And the user can log in the environment sensing service platform to use the monitoring terminal service.
24) The environment perception service platform sends the user account information to the M2M open platform for authentication; the M2M open platform can be conveniently accessed to different types of terminals of different manufacturers, and can better support the generation of more service platforms, thereby achieving the purposes of opening cooperation and realizing service incubation.
25) After the M2M open platform passes the authentication, the environment-aware service platform allows the user account to use the service, and the user can directly associate and manage the monitoring terminal under the own name and can use the related service.
The monitoring terminals and the gateway are managed by software SSA application logic, wireless connection, data transmission and communication management of a sensing layer are achieved, access of more sensor modules and control communication of actuators are expanded by development of a second-level SSA (in a software mode), the first-level SSA (in a software mode) can flexibly access monitoring terminals of more manufacturers and more models, and the purposes of conveniently and flexibly establishing environment sensing application development and access application are achieved by sensing monitoring and service management between the first-level SSA and the second-level SSA. Further, the working parameters, configuration strategies and interaction mechanisms of the first-level SSA and the second-level SSA are uniformly managed by the M2M open platform, can be remotely released and updated according to the needs of the sensing terminal, and can be developed to be applied to more environment-aware service platforms, so that the range and the field of environment-aware application development are expanded.
Further, a platform configuration trigger may be opened at M2M and an alarm rule may be set to alarm abnormal environment data exceeding a preset threshold for the user's attention. If the indoor humidity is more than 60% RH, an alarm is generated, namely a mobile phone number or a mailbox is reserved for the user to alarm by a message.
In the practical application process, the monitoring terminal collects environmental data and uploads the environmental data to an M2M open platform every 5 seconds.
To test the monitorability of humidity, the humidity sensor was placed on the air humidifier for one to two seconds, producing fluctuating humidity data as shown in fig. 10.
To test the temperature monitoring, the temperature sensor was placed next to the hot water cup for a period of time and then removed, and the gradual fall of the temperature data polyline was seen, as shown in fig. 11. It is worth mentioning that as the temperature decreases, the humidity increases, and the corresponding change in humidity is shown in fig. 12. The phenomenon directly reflects the relationship between temperature and humidity under abnormal conditions (generally, the temperature and the humidity are in positive correlation, such as high temperature and high humidity in summer).
The PM 2.5/dust concentration is directly detected as the indoor concentration, as shown in fig. 13, the concentration of inhalable particles in the current environment is relatively stable, the concentration is maintained at 140, and the air quality is excellent according to the corresponding rule introduced in the sensor specification.
The above description is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, several modifications and variations can be made without departing from the technical principle of the present invention, and these modifications and variations should also be regarded as the protection scope of the present invention.