The control method and sensor node of a kind of sensor timesharing opening and closing
Technical field
The invention belongs to wireless sensor network technology field, more specifically, it is related to a kind of sensor timesharing to be opened and closed
Control method and sensor node.
Background technology
Generally, sensor provides electricity with rechargeable battery, alkaline battery etc..In many application scenarios, battery
It not is the easy thing of part to charge or change.Therefore, when designing sensor and setting up wireless sensor network, all should
On the premise of application demand is met, the energy ezpenditure of sensor is reduced as far as possible, after extension is once charged or changes battery
Working time.
Sensor node is the basic functional units of wireless sensor network.Fig. 1 is the structural representation of sensor node.
As shown in figure 1, the basic comprising modules of sensor node include:Sensor assembly, processor module, communication module and power supply
Module, wherein sensor assembly generally include multiple different types of sensors, and for gathering sensing data, processor module is
The nucleus module of sensor node, for equipment control, Task matching and scheduling, sensing data treatment etc., communication module is used for
Realize that data communication and control between server and sensor node and sensor node communicate.Different types of sensor
Response time(Establish the time begun to the sensing data for obtaining stabilization by cable from above)Difference is very big.For example gas concentration lwevel is passed
The response time of sensor was at 5 to 10 minutes, and the response time of optical sensor is then less than 1 second.
In Internet of Things application, in the scene of part, server needs the data of taken at regular intervals multiple sensor node.By
In needing to ensure the sensing data that all the sensors all export stabilization, if power module is supplied together to multiple sensors simultaneously
Electricity, then power-on time need be configured according to the sensor of maximum response time, so will result in other response times
Shorter sensor wastes valuable battery electric quantity.
The content of the invention
It is an object of the invention to overcome the deficiencies in the prior art, there is provided a kind of control method of sensor timesharing opening and closing and
Sensor node, the response time according to dissimilar sensor is opened and closed sensor come timesharing, so as to save electricity.
For achieving the above object, the control method of inventive sensor timesharing opening and closing is comprised the following steps:In advance will
All the sensors are divided into K groups, and every group of total working electric current is respectively less than power module rated current, are that each sensor sets one
Corresponding timer, after sensor node reports end per secondary data, processor module sets the company of sensor and power module
Connect and be constantlyDisconnect the moment beWherein T is represented in the next secondary data of sensor node
Give the correct time quarter, tn represents n-th response time of sensor, and the span of n is n=1, and 2 ..., N, N represents the number of sensor
Amount, dkThe maximum response time of all the sensors in packet k where n-th sensor is represented, the span of k is n=1,
2,…,K;When timer timing reaches the power supply connection moment, sensor is connected with power module, when reaching the disconnection moment, sensing
Device disconnects with power module.
Present invention also offers a kind of sensor node of sensor timesharing opening and closing, including sensor assembly, processor die
Block, communication module and power module, sensor assembly include 1 above type of sensor, concurrent for gathering sensing data
Processor module is given, processor module is sent after processing sensing data by communication module, and power module is to sensing
Device module, processor module and communication module are powered, and sensor is divided into K groups in advance, and every group of total working electric current is respectively less than electricity
Source module rated current, each sensor is provided with timer switch, for controlling electricity of being powered between power module and sensor
The disconnection on road with connect;
After sensor node reports end per secondary data, processor module sets to each timer switch sending signal respectively
Put closing moment and disconnect the moment, the connection moment of the corresponding timer switch of n-th sensor isIt is disconnected
Open and be constantlyWherein T represents that the next secondary data of sensor node reports moment, tnRepresent n-th sensor
Response time, the span of n is n=1, and 2 ..., N, N represents the quantity of sensor, dkRepresent packet where n-th sensor
The maximum response time of all the sensors in k, the span of k is n=1,2 ..., K;The timing of timer switch reaches connection
During the moment, switch closure when reaching the disconnection moment, is switched off.
Further, timer switch is provided between communication module and power module, in the every secondary data of sensor node
After report terminates, processor module sets the connection moment for T-p to the timer switch sending signal, and p represents the sound of communication module
Between seasonable;When the timing of timer switch reaches the connection moment, switch closure, it is fixed that communication module completes i.e. disconnection after data are reported
When device switch.
Further, after sensor node reports end per secondary data, when processor module sets the K activation of itself
Carve, k-th activation moments isWherein q represent the processor die activation of block required for time, h tables
The time required to showing that processor module receives sensing data, subsequently into dormancy;After preceding K-1 activation, processor module is connecing
Harvest and enter after sensing data dormancy, after last kth activation, processor module need to be to each module after setting completed again
Into dormancy.
All the sensors are divided into K groups, often by the control method and sensor node of inventive sensor timesharing opening and closing in advance
The total working electric current of group is respectively less than power module rated current, is that each sensor sets a corresponding timer, sensor
After node reports end per secondary data, processor module according to next secondary data report response time of moment and each sensor come
The connection moment of sensor and power module is set and the moment is disconnected, when timer timing reaches the power supply connection moment, sensor
It is connected with power module, when reaching the disconnection moment, sensor disconnects with power module.
The invention has the advantages that:
(1)Timesharing opening and closing is carried out after sensor is grouped, makes the total working electric current of the sensor for accessing power supply simultaneously
Less than power module rated current, it is ensured that the normal work and power module safety of sensor;
(2)Processor module reports response time of moment and each sensor according to next secondary data to set each sensor
With connection moment of power module and disconnect the moment, to the greatest extent can may be used while each sensor normal acquisition sensing data is ensured
The few consumption battery electric quantity of energy, the battery electric quantity that sensor can be avoided to open simultaneously and brought wastes problem.
Brief description of the drawings
Fig. 1 is the structural representation of sensor node.;
Fig. 2 is a kind of specific embodiment flow chart of the control method of inventive sensor timesharing opening and closing;
Fig. 3 is the time shaft schematic diagram at connection moment and disconnection moment in control method shown in Fig. 2;
Fig. 4 is a kind of specific embodiment structure chart of the sensor node of inventive sensor timesharing opening and closing.
Specific embodiment
Specific embodiment of the invention is described below in conjunction with the accompanying drawings, so as to those skilled in the art preferably
Understand the present invention.Requiring particular attention is that, in the following description, when known function and design detailed description perhaps
When can desalinate main contents of the invention, these descriptions will be ignored herein.
Embodiment
Fig. 2 is a kind of specific embodiment flow chart of the control method of inventive sensor timesharing opening and closing.Such as Fig. 2 institutes
Show, the control method of inventive sensor timesharing opening and closing is comprised the following steps:
S201:Sensor group:All the sensors are divided into K groups in advance, every group of total working electric current is respectively less than power supply mould
Block rated current.The step is that, in order to sensor scale is too big in preventing sensor assembly, total working electric current exceedes power module
Rated power supply so that for power module causes damage, while also ensure that the normal work of each sensor.
S202:For each sensor sets a corresponding timer, after sensor node reports end per secondary data, place
Reason device module sets sensor and the connection moment of power module isDisconnect the moment beWherein T represents that the next secondary data of sensor node reports the moment, when tn represents the response of n-th sensor
Between, the span of n is n=1, and 2 ..., N, N represents the quantity of sensor, dkRepresent institute in packet k where n-th sensor
There is the maximum response time of sensor, the span of k is n=1,2 ..., K.
Fig. 3 is the time shaft schematic diagram at connection moment and disconnection moment in control method shown in Fig. 2.As shown in figure 3, this reality
Apply and sensor has been divided into 3 groups in example, the maximum response time of all the sensors is respectively d in each packet1、d2、d3.Sensing
The next secondary data of device node reports the moment T can to determine using two ways, if sensor node is provided with data and reports week
Phase, then next secondary data can be calculated according to data report cycle and report the moment, or can obtained according to user's setting.
In the present invention, it is desirable to which the sensor in every group of sensor can obtain sensing data and be sent to processor die in synchronization
Block.By taking the 1st group of sensor as an example, the cut-off time for sending sensing data isSo
For the sensor n in the 1st group of sensor, it is with the connection moment of power moduleIt can be seen that for
The sensor of the maximum response time in 1 group of sensor, its connection moment be
S203:Timer continues timing.
S204:Judge whether the corresponding timer timing of each sensor reaches the connection moment, if not up to, returned
S203 continues timing, if reached, into step S205;
S205:Sensor is connected with power module, starts power up, and upper electricity starts collection sensing data and is sent to after finishing
Processor module, timing is continued into step S206.
S206:Timer continues timing.
S207:Judge whether the corresponding timer timing of each sensor reaches the disconnection moment, if not up to, returned
S206 continues timing, if reached, into step S208.
S208:Sensor disconnects with power module, and return to step S202 waits this secondary data to report end preprocessor mould
Block sets the connection moment next time and disconnects the moment.
A kind of present invention also control method based on sensor timesharing opening and closing, it is proposed that sensor of sensor timesharing opening and closing
Node.Fig. 4 is a kind of specific embodiment structure chart of the sensor node of inventive sensor timesharing opening and closing.As shown in figure 4,
The sensor node of inventive sensor timesharing opening and closing includes sensor assembly, processor module, communication module and power supply mould
Block, sensor assembly includes 1 above type of sensor.In the present embodiment, power module is the external dc power of 12V,
Each sensor configuration have a commutator transformer make voltage conversion be the corresponding operating voltage of sensor.Sensor is divided in advance
It is K groups(It is 3 groups in the present embodiment), every group of total working electric current is respectively less than power module rated current, and each sensor is set
There is timer switch, for controlling between power module and sensor the disconnection of power supply circuit and connecting.
After sensor node reports end per secondary data, processor module sets to each timer switch sending signal respectively
Put closing moment and disconnect the moment, the connection moment of the corresponding timer switch of n-th sensor isIt is disconnected
Open and be constantlyWherein T represents that the next secondary data of sensor node reports moment, tnRepresent n-th sensor
Response time, the span of n is n=1, and 2 ..., N, N represents the quantity of sensor, dkRepresent packet where n-th sensor
The maximum response time of all the sensors in k, the span of k is n=1,2 ..., K;The timing of timer switch reaches connection
During the moment, switch closure when reaching the disconnection moment, is switched off.
In order to reach more preferable energy-saving effect, similar manager can also be used to communication module and processor module
Formula:
For communication module, preferred embodiment is:Timer switch is also provided between communication module and power module, is sensed
After device node reports end per secondary data, processor module sets the connection moment for T-p, p to the timer switch sending signal
Represent the response time of communication module;When the timing of timer switch reaches the connection moment, switch closure, communication module completes number
According to after reporting i.e. disconnect timer switch.Just worked because communication module is grouped after collection is finished in all the sensors, therefore
Directly report constantly to determine upper electric moment of communication module according to next secondary data.
For processor module, preferred embodiment is:After sensor node reports end per secondary data, processor module is set
The K activation moments of itself, k-th activation moments beWherein q represents processor die activation of block institute
The time of needs, the time required to h represents that processor module receives sensing data, subsequently into dormancy.At this moment due to processor
Module will receive the sensing data from sensor, therefore processor activation moments are adopted according to the sensing data of every group of sensor
Determine with disconnection moment of power module after collection is finished.After preceding K-1 activation, processor module is receiving sensor number
Enter dormancy after, after last kth activation, processor module need to after setting completed enter back into dormancy to each module.
Although being described to illustrative specific embodiment of the invention above, in order to the technology of the art
Personnel understand the present invention, it should be apparent that the invention is not restricted to the scope of specific embodiment, to the common skill of the art
For art personnel, as long as various change is in appended claim restriction and the spirit and scope of the present invention for determining, these
Change is it will be apparent that all utilize the innovation and creation of present inventive concept in the row of protection.