Summary of the invention
Task of the present invention is to provide a kind of ZigBee wireless senser power-saving method, adopt increment push-model data transferring method, ensureing under the prerequisite of perceived accuracy and alarm response promptness, a large amount of transmission times that reduce repeating data and approximate data, effectively save battery electric power, extend the useful life of battery.
Technical solution of the present invention is as follows:
A kind of ZigBee wireless senser power-saving method, comprises the following steps:
(1) initialization;
(2) in the time arriving sleep interval, wake MPU up;
(3) MPU is from the variable quantity of the calculating of perception device reading out data and previous delivery value;
(4) judge whether variable quantity is more than or equal to threshold value, if so, perform step (5); If not, perform step (6);
(5) connect ZigBee power supply, set up link, send current image data, cut off ZigBee power supply, amendment sends data record, execution step (8);
(6) judge whether data variation direction changes, if so, perform step (7); If not, amendment current data record, execution step (8);
(7) connect ZigBee power supply, set up link, send previous image data, cut off ZigBee power supply, amendment sends data record;
(8) MPU enters dormancy, returns to step (2).
Described step (1) comprising: in ZigBee wireless senser MPU, transmit data register DATAsentset to 0, timestamp is current time; Current data register DATAnow0set to 0, timestamp is current time; Delta threshold register is set to set point Δ DATA0; Dormancy time register is set to set point T0, ZigBee wireless senser MPU enters resting state, and ZigBee chip is in off-position.
Described step (2) comprises arrival MPU dormancy time T0, MPU is waken up.
Described step (3) comprises that MPU reads current perception data DATA by P1.0, P1.1 pin from SCL, the DADA pin of senser elementnow.
Described step (4) comprises that MPU is by DATAnowwith in MPU, transmit data register DATAsentcompare, obtain increment Delta DATA.
Described step (5) comprises following sub-step:
(51) MPU sends instruction by P1.3 pin, controls the VCC power supply of power management chip connection Zigbee chip, and Zigbee chip enters operating state;
(52) ZigBee and father node are set up data link;
(53) MPU sends into DATA by P3.5, P3.4 pin to DOUT, the DIN pin of ZigBee chipnow;
(54) ZigBee chip is by DATAnowsend by antenna;
(55) MPU by P3.5, P3.4 pin from the DOUT of ZigBee chip, the data validation information that DIN pin receives ZigBee father node;
(56) DATAnowcharge to and transmit data register DATAsentwith current data register DATAnow0;
(57) MPU sends instruction by P1.3 pin, controls the VCC power supply of power management chip cut-out Zigbee chip;
(58) execution step (8).
Described step (7) comprises following sub-step:
(71) MPU sends instruction by P1.3 pin, controls the VCC power supply of power management chip connection Zigbee chip, and Zigbee chip enters operating state;
(72) ZigBee and father node are set up data link;
(73) MPU sends into current data register DATA by P3.5, P3.4 pin to DOUT, the DIN pin of ZigBee chipnow0value;
(74) ZigBee chip is by DATAnow0send by antenna;
(75) MPU by P3.5, P3.4 pin from the DOUT of ZigBee chip, the data validation information that DIN pin receives ZigBee father node;
(76) DATAnow0charge to and transmit data register DATAsent, DATAnowcharge to current data register DATAnow0;
(77) MPU sends instruction by P1.3 pin, controls the VCC power supply of power management chip cut-out Zigbee chip;
(78) execution step (8).
Described step (8) comprises that MPU draws oneself up and enters dormancy, and the self-clocking of MPU internal clock arrives sleep interval T0time, repeat the step starting from step (2).
The present invention is owing to having adopted above technical scheme, compared with prior art, ZigBee wireless senser power-saving method of the present invention is because perceived amount is slowly to change or seldom change, the work period quantity that need to send data every day is little, can significantly reduce power consumption, extend the battery altering cycle.
By a kind of ZigBee wireless senser power-saving method of the present invention, adopt increment push-model data transferring method, ensureing under the prerequisite of perceived accuracy and alarm response promptness, a large amount of transmission times that reduce repeating data and approximate data, effectively save battery electric power, extend the useful life of battery.
Embodiment
Below in conjunction with drawings and Examples, the present invention is elaborated.
Referring to Fig. 5, the invention provides a kind of ZigBee wireless senser power-saving method, comprise the following steps:
(1) initialization;
(2) in the time arriving sleep interval, wake MPU up;
(3) MPU reads the variable quantity of current data calculating and previous delivery value from perception device;
(4) judge whether variable quantity is more than or equal to threshold value, if so, perform step (5); If not, perform step (6);
(5) connect ZigBee power supply, set up link, send current image data, cut off ZigBee power supply, amendment sends data record, execution step (8);
(6) judge whether data variation direction changes, if so, perform step (7); If not, amendment current data record, execution step (8);
(7) connect ZigBee power supply, set up link, send previous image data, cut off ZigBee power supply, amendment sends data record;
(8) MPU enters dormancy, returns to step (2).
Described step (1) is included in transmission data register DATA in ZigBee wireless senser MPUsentset to 0, timestamp is current time; Current data register DATAnow0set to 0, timestamp is current time; Delta threshold register is set to set point Δ DATA0; Dormancy time register is set to set point T0, ZigBee wireless senser MPU enters resting state, and ZigBee chip is in off-position.
Described step (2) comprises arrival MPU dormancy time T0, MPU is waken up.
Described step (3) comprises that MPU reads current perception data DATA by P1.0, P1.1 pin from SCL, the DADA pin of senser elementnow.
Described step (4) comprises that MPU is by DATAnowwith in MPU, transmit data register DATAsentcompare, obtain increment Delta DATA.
Described step (5) comprises following sub-step:
(51) MPU sends instruction by P1.3 pin, controls the VCC power supply of power management chip connection Zigbee chip, and Zigbee chip enters operating state;
(52) ZigBee and father node are set up data link;
(53) MPU sends into DATA by P3.5, P3.4 pin to DOUT, the DIN pin of ZigBee chipnow;
(54) ZigBee chip is by DATAnowsend by antenna;
(55) MPU by P3.5, P3.4 pin from the DOUT of ZigBee chip, the data validation information that DIN pin receives ZigBee father node;
(56) DATAnowcharge to and transmit data register DATAsentwith current data register DATAnow0;
(57) MPU sends instruction by P1.3 pin, controls the VCC power supply of power management chip cut-out Zigbee chip;
(58) execution step (8).
Described step (7) comprises following sub-step:
(71) MPU sends instruction by P1.3 pin, controls the VCC power supply of power management chip connection Zigbee chip, and Zigbee chip enters operating state;
(72) ZigBee and father node are set up data link;
(73) MPU sends into current data register DATA by P3.5, P3.4 pin to DOUT, the DIN pin of ZigBee chipnow0value;
(74) ZigBee chip is by DATAnow0send by antenna;
(75) MPU by P3.5, P3.4 pin from the DOUT of ZigBee chip, the data validation information that DIN pin receives ZigBee father node;
(76) DATAnow0charge to and transmit data register DATAsent, DATAnowcharge to current data register DATAnow0;
(77) MPU sends instruction by P1.3 pin, controls the VCC power supply of power management chip cut-out Zigbee chip;
(78) execution step (8).
Described step (8) comprises that MPU draws oneself up and enters dormancy, and the self-clocking of MPU internal clock arrives sleep interval T0time, repeat the step starting from step (2).
The increment push-model data transferring method that the present invention adopts is: ZigBee wireless senser arranges delta threshold register, dormancy time register, current data register, transmits data register.When transducer is waken up at every turn, gather current data, and with transmit the last time delivery value comparison of recording in data register, if the absolute value of variable quantity is more than or equal to increment threshold values, set up ZigBee communication link, transmit these data and charge to and transmit data register and current data register, entering dormancy; If the absolute value of variable quantity is less than delta threshold and data direction changes, set up ZigBee communication link, transmit last some data that record in current data register and these data are charged to transmission data register, current data is charged to current data register, entering dormancy; If the absolute value of variable quantity is less than delta threshold and data direction does not change, do not transmit, current data is charged to current data register, enter dormancy.
Certainty of measurement is depended in the selection of delta threshold, and the response time requirement to alarm event is depended in the selection of dormancy time.
When ZigBee wireless senser is used for monitoring inertia perception amount, because perceived quantitative changeization is slow, need the long period that the variation of threshold value could occur once to reach, adopt increment push-model data transferring method, data during this period of time all will not transmit, and can save a large amount of data and transmit power consumption.Sampled data is more stable, and economize on electricity extending battery life effect are more remarkable.
Narrate the principle analysis of ZigBee wireless senser below.
1, ZigBee wireless senser principle
The initial condition of Fig. 1 (A is dormancy 60S, electric current 0.23mA, B is work 10mS, electric current 0.397mA): senser element chip is in running order, and the monitored amount of real-time perception is also converted to data.MPU chip is in resting state.ZigBee chip is in off-position.Power management chip is in running order, and battery is given each chip power supply by power management chip.MPU chip transmits in data register and records the perception data DATA sending out by ZigBee last timesentthe perception data DATA that in (containing timestamp), current data register, record last time gatherednow0(containing timestamp), delta threshold register record perceived amount delta threshold Δ DATA0, dormancy time register records dormancy time T0.
Perceived amount delta threshold Δ DATA0require to arrange according to monitoring accuracy, as to building environment temperature, generally get 0.5 DEG C.
Dormancy time T0according to the response time requirement setting to alarm event, as for real-time monitoring system, for ensureing the promptness of alarm response, generally get 60 seconds.
In the MPU of resting state self-clocking, arrive dormancy time T0time, wake oneself up and enter operating state.MPU reads current perception data DATA by P1.0, P1.1 pin from SCL, the DADA pin of senser elementnow, MPU is by DATAnowwith the DATA transmitting in data registersentcompare, obtain Δ DATA, carry out three kinds of different processing according to Δ DATA:
Δ DATA is more than or equal to Δ DATA0.MPU connects P1.3 pin and sends instruction, controls the VCC power supply of power management chip connection ZigBee chip, and ZigBee chip enters operating state, and ZigBee and father node are set up data link (approximately needing 30mS).MPU sends into DATA by P3.5, P3.4 pin to DOUT, the DIN pin of ZigBee chipnow; ZigBee chip is by DATAnowsend (approximately needing 20mS) by antenna.MPU receives by P3.5, P3.4 pin after the data validation information of ZigBee father node, MPU DATAnowvalue is replaced and is transmitted DATA in data registersentdATA in value and current data registernow0; Send instruction by P1.3 pin, control the VCC power supply of power management chip cut-out Zigbee chip; MPU draws oneself up and enters dormancy.This is the work period that has data to send.
Δ DATA is less than Δ DATA0but data variation direction has changed.This shows that variation flex point has appearred in perceived amount, need to transmit the previous collection value DATA recording in current data registernow0.The same aforementioned paragraphs of the course of work, difference is that the data of at this moment sending by ZigBee are DATAnow0, use DATAnow0value is replaced and is transmitted DATA in data registersent.
Δ DATA is less than Δ DATA0, and data variation direction does not change.Do not transmit data, MPU DATAnowreplace the DATA in current data registernow0, enter dormancy.This is the work period that does not have data to send.
2, monocycle energy consumption analysis
Calculate the power consumption situation of single work period of ZigBee wireless senser according to the data of data and actual measurement.
MPU chip adopts super low power consuming single chip processor MSP430, quiescent current 0.0001mA, operating state power consumption 0.167mA.
ZigBee chip holding state power consumption 15mA, accepting state power consumption 45mA, emission state power consumption 295mA.
Do not have data to send work period analysis:
In Fig. 2, dormancy section duration is 60S, power consumption comprises the parts such as MPU, senser element, power management chip, ZigBee is in not power consumption of off-position, and wherein MPU quiescent current 0.0001mA, senser element electric current 0.1mA, power management chip electric current 0.13mA, add up to 0.23mA.Fig. 2 active section duration is 0.01S(10mS), the difference of power consumption and dormancy section is that MPU transfers operating state to, and power consumption becomes 0.167mA, and total power consumption is 0.397mA.
Q1=∑ Qt=Qdormancy+ Qwork
=0.23mA×60S+0.397mA×0.01S
=13.8mAS+0.00397mAS
=13.80397mAS
≈0.003834mAH
There is data transmitting period analysis:
In Fig. 3, dormancy section power consumption analysis is identical with Fig. 2.
In Fig. 3, active section duration is that MPU gathers and analysis data time 10mS, ZigeBee set up DL time 30mS, ZigBee and send data time 20mS, amounts to 60mS.Wherein MPU, senser element, power management chip power consumption current value and be all mutually 0.23mA in Fig. 2, difference is that the power consumption time is 60mS.After ZigBee switches on power, enter the data link setup phase of 30mS, during this, mainly in standby power consumption state, have of short duration link setup signal transmitting and receiving, average current is about 30mA; ZigBee data transmitting time is about 20mS, and electric current is 295mA.A work period power consumption is calculated as follows:
Q2=∑ Qt=Qdormancy+ Qwork
=Qdormancy+ (QmPU work+ QzigBee link setup+ QzigBee transmitting)
=0.23mA×60S+0.397mA×(0.01S+0.03S+0.02S)+30mA×0.03S+295mA×0.02S
=13.8mAS+0.02382mAS+0.9mAS+5.9mAS
=0.6382mAS
≈0.005729mAH
Service time of battery is analyzed:
To use common No. 5 batteries, capacity is that 1000mAH is example, and ZigBee wireless senser per minute wakes up once, carries out data acquisition and transmission.
In the time of traditional not employing increment push-model data mode, each data that gather all send, and each work period is 60.06S, are to calculate for 60 seconds according to each work period, send every day 1440 times, and each power consumption is Q2.The replacement cycle of battery is: 1000mAH/(0.005729mAH × 1440) ≈ 121 days.
In the time adopting increment push-model data transferring method, because perceived amount is slowly to change or seldom change, the work period quantity that need to send data every day is little, can significantly reduce power consumption, extends the battery altering cycle.
Taking ZigBee radio temperature sensor in certain IDC center monitoring building environment temperature as example, intraday building environment temperature curve is as Fig. 4, perceived amount variable quantity threshold values Δ DATA0get 0.5 DEG C, in one day, only have 12 data transmitting period.The battery altering cycle is: 1000mAH/(0.005729mAH × 12+0.003834mAH × 1428) ≈ 180 days.
Fig. 4 is the intraday transmission data of example ZigBee radio temperature sensor.Rhombus icon is the transmission data (real data is than also intensive in figure) without increment push-model, approximately has 1440 points every day.Square icon is the data that have increment push-model to transmit, and only has 12 points in one day.As seen from the figure, the data repeatability of two kinds of modes is fine, has ensured preferably monitoring accuracy, has reflected the actual change of monitored amount, can ensure the promptness to alarm response.
Above-described embodiment shows, adopts increment push-model data transferring method ensureing in data precision and alarm promptness situation, and the battery altering cycle is 1.49 times while transmitting without increment push-model data, and power savings is obvious.
The embodiment of a kind of ZigBee wireless senser power-saving method of the present invention is as follows:
(1) initialization.In ZigBee wireless senser MPU, transmit data register DATAsentset to 0, timestamp is current time; Current data register DATAnow0set to 0, timestamp is current time; Delta threshold register is set to set point Δ DATA0; Dormancy time register is set to set point T0.ZigBee wireless senser MPU enters resting state, and ZigBee chip is in off-position.
(2) arrive MPU dormancy time T0, MPU is waken up.
(3) MPU reads current perception data DATA by P1.0, P1.1 pin from SCL, the DADA pin of senser elementnow.
(4) MPU is by DATAnowwith in MPU, transmit data register DATAsentcompare, obtain increment Delta DATA.
(5) if Δ DATA is more than or equal to delta threshold Δ DATA0:
(51) MPU sends instruction by P1.3 pin, controls the VCC power supply of power management chip connection Zigbee chip, and Zigbee chip enters operating state;
(52) ZigBee and father node are set up data link;
(53) MPU sends into DATA by P3.5, P3.4 pin to DOUT, the DIN pin of ZigBee chipnow;
(54) ZigBee chip is by DATAnowsend by antenna;
(55) MPU by P3.5, P3.4 pin from the DOUT of ZigBee chip, the data validation information that DIN pin receives ZigBee father node;
(56) DATAnowcharge to and transmit data register DATAsentwith current data register DATAnow0;
(57) MPU sends instruction by P1.3 pin, controls the VCC power supply of power management chip cut-out Zigbee chip;
(58) forward (8) to.
(6) if Δ DATA is less than delta threshold Δ DATA0, and data variation direction changes:
(61) MPU sends instruction by P1.3 pin, controls the VCC power supply of power management chip connection Zigbee chip, and Zigbee chip enters operating state;
(62) ZigBee and father node are set up data link;
(63) MPU sends into current data register DATA by P3.5, P3.4 pin to DOUT, the DIN pin of ZigBee chipnow0value;
(64) ZigBee chip is by DATAnow0send by antenna;
(65) MPU by P3.5, P3.4 pin from the DOUT of ZigBee chip, the data validation information that DIN pin receives ZigBee father node;
(66) DATAnow0charge to and transmit data register DATAsent, DATAnowcharge to current data register DATAnow0;
(67) MPU sends instruction by P1.3 pin, controls the VCC power supply of power management chip cut-out Zigbee chip;
(68) forward (8) to.
(7) if Δ DATA is less than delta threshold Δ DATA0, and data variation direction do not change, DATAnowcharge to current data register DATAnow0.
(8) MPU draws oneself up and enters dormancy.
(9) MPU internal clock self-clocking, arrives sleep interval T0time, repeat the step starting from step (2).
In sum, by a kind of ZigBee wireless senser power-saving method of the present invention, adopt increment push-model data transferring method, ensureing under the prerequisite of perceived accuracy and alarm response promptness, a large amount of transmission times that reduce repeating data and approximate data, effectively save battery electric power, extend the useful life of battery.
Certainly, those skilled in the art in the art will be appreciated that, above-described embodiment is only for the present invention is described, and not as limitation of the invention, as long as within the scope of connotation of the present invention, variation, the modification etc. of above-described embodiment all will be dropped in the scope of the claims in the present invention.