Background technology
Wireless sensor network is current receive much concern in the world, relate to multidisciplinary height intersection, the integrated hot research field, forward position of knowledge height. It combines sensor technology, embedded computing technique, modern network and wireless communication technology, distributed information processing etc., can be by all kinds of integrated microsensors information of the various environment of Real-Time Monitoring, perception and collection or monitoring target collaboratively, these information exchanges are crossed wireless mode and are sent out, and be sent to user terminal with the network mode of certainly organizing multi-hop, thereby realize physical world, the connection of calculating the world and the human society ternary world. Sensor network has very wide application prospect, at many key areas such as military and national defense, industrial or agricultural, city management, biologic medical, environmental monitoring, rescue and relief work, anti-probably anti-terrorism, deathtrap Long-distance Control potential practical value is arranged, cause the great attention of many national academias and industrial quarters, be considered to one of technology of power that 21 century had an immense impact on.
Wireless sensor network shown in Figure 1 is comprised of the wireless sensor node (hereinafter to be referred as sensor node or node) of a lot of self-energizings and sensor gateway (hereinafter to be referred as gateway). Each sensor node can carry out collection and the simple computation of ambient data, and contacts by gateway and extraneous (user terminal or server).
The basic platform of wireless sensor network is sensor node, and it is the embedded system of a microminiaturization. The design of many kinds of sensor nodes has appearred at present both at home and abroad, they are realizing that principle is similar, different microprocessors or different communication protocol modes have just been adopted respectively, such as adopting 802.11 agreements, Zigbee protocol, Bluetooth protocol and UWB communication mode etc. But these agreements are more complicated all, needs special chip or high-performance processor to realize.
In addition, sensor node can only be equipped with limited power supply as micro devices, and under some application scenario, it is almost impossible changing battery. This is major issue that Design of Wireless Sensor Network need to consider so reduce power consumption with the service life that prolongs system so that the life-span of sensor node depends on the life-span of battery to a great extent.
Summary of the invention
The objective of the invention is needs special chip or high-performance processor to realize and the wireless signal detecting of sensor node is long with launch time, power consumption is large for present wireless sensor network node and gateway, be unfavorable for adopting the problems such as powered battery, the characteristic of utilizing wireless sensor node itself to possess is invented a kind of new wireless sensor network node and the communication means between the gateway, so that between the wireless sensor network node of lower-performance and gateway, realize two-way wireless communication, and the working life that can prolong sensor node, and reduce product cost.
Technical scheme of the present invention is:
Communication means between a kind of wireless sensor network node and the gateway is characterized in that:
A, take sensor node as main Master, the sensor gateway is the communication pattern from Slave, utilize each sensor node to have ID number unique and can not a change characteristic, with an ID number field as each transceiving data bag, be used for that sign is sent or the sensor node of receive data bag;
B, in each gateway, deposit an ID number tabulation, make gateway know in advance with each wireless sensor node of this gateway communication ID number, set up simultaneously ID number and serial number SN between one-to-one relationship;
C, make each sensor gateway take a wireless channel, the adjacent sensor gateway of installing and using works in different wireless channels;
D, sensor node registration:
Sensor node powers up the rear login state that works in first, and automatically outwards transmission once comprises the registration request signal of self ID number at regular intervals, and the operating frequency of transmitted signal is followed successively by the operating frequency of each gateway in the whole data acquisition control system; If the registration request signal that sensor node sends is received at a certain gateway and the registration request signal in ID number identical with certain ID number of storage in this gateway ID number tabulation, then this gateway is replied the response signal that contains sensor node ID number and corresponding serial number SN, if sensor node is received the response signal that gateway is replied, then succeed in registration, this gateway is the registration gateway of described sensor node; If sensor node is not received the response signal that gateway is replied, then enter sleep period, dormancy sends the registration request signal after finishing again, and so forth, until succeed in registration;
The data of e, sensor node send:
Enter the image data state that sends after the sensor node registration success, calculate its dormancy time Twait according to the serial number SN that receives first, and enter sleep period; Begin to gather sensing data after dormancy finishes, the operating frequency with the registration gateway sends the data that collected again; The registration gateway receive that sensor node sends include ID number image data signal after reply response signal; Sensor node recomputates Twait after receiving the response signal of gateway, and enters sleep period, thereby has finished a data acquisition and transmission work, and after this, sensor node will so constantly repeat this step;
F, in the data transmission phase of sensor node, if after sensor node sent the data that collect, continuous several times failed to receive the response signal of gateway, then reenters login state, and again registers according to steps d.
The sensor node number that carries out radio communication with each gateway is limited by the memory size of gateway in theory without limits during actual enforcement, 255 nodes of each gateway management are better.
The value of described dormancy time Twait is: as (SN-1) * △ t 〉=TuThe time, Twait=(SN-1/2) * △ t-Tu Otherwise, Twait=(Ts-T
u)+(SN-1/2)×△t,
Wherein:
SN is the serial number that sensor node ID number is deposited in the gateway internal memory
T
sSensor node sends the cycle of image data
N
tSensor node number for gateway management
T
uBe this transmission image data cycle time in the past
△t=T
s÷N
tDistribute to the time of the transmission image data of each sensor node for gateway
Beneficial effect of the present invention:
1, sensor node only when registration and uploading data initiatively and gateway communication, and the time compole that is used for the sending and receiving wireless signal is short, make the power consumption of wireless senser very low, guarantee that the life-span of sensor node interval work can reach more than 5 years when adopting small battery powered.
2, the complexity of algorithm is very low, is convenient to realize favourable reduction product cost at low-grade Software in Single Chip Microcomputer.
3, be all discontinuous transmitting wireless signals of sensor node or gateway, reduced the air interference to environment, meet national relevant radio rule.
4, can two-way communication between sensor node and the gateway, make things convenient for uploading of sensor node image data, and change at any time the running parameter of sensor node.
5, have stronger network self-adapting ability, can change at any time the operating frequency of radio communication. After the operating frequency of gateway changed, sensor node can Adaptive change, automatically again sets up new communication connection with gateway.
6, the communication collision probability between a plurality of sensor nodes and the same gateway is extremely low, has guaranteed the success rate of data upload, has also reduced the sensor node power consumption.
The specific embodiment
The present invention is further illustrated below in conjunction with drawings and Examples.
Communication means between wireless sensor network node of the present invention and the gateway has adopted take sensor node as " main Master ", the sensor gateway is the liaison mode of " from Slave ", and channel takies the mode that has adopted frequency division multiplexing FDMA and time division multiplexing tdm A to combine.
(1) initiatively outwards send at regular intervals a signal by sensor node, with finish sensor node on gateway registration and upload image data.
(2) the sensor gateway only after receiving the registration request and uploading data that sensor node sends, just sends necessary response signal, does not initiatively outwards launch at ordinary times any wireless signal.
(3) each sensor gateway only takies a wireless channel, and the sensor gateway of adjacent installation is selected different wireless channel work when reality is used, and namely a plurality of gateways of areal adopt the frequency division multiplexing mode to work.
(4) sensor node has two kinds of duties: " login state " and " sending the image data state ". Login state is used for determining the gateway of this sensor node of management, and obtains the running parameter of node necessity; Send the image data state and be used at regular intervals that node gathers sensing data once automatically, send the data that collect with the identical operating frequency of registration gateway again.
(5) adopt time division multiplexing tdm A working method to solve the collision problem of a plurality of sensor nodes and same gateway communication. Node has just been determined the gateway that it is communicated by letter after succeeding in registration, obtain simultaneously the serial number SN of node on this gateway; According to serial number SN, node calculates the working time slot of oneself, with posterior nodal point only in the time slot of oneself and gateway communication. Because the serial number SN of each node is different, its communication time slot is also just different, and therefore the collision problem of communicating by letter simultaneously with gateway just can not occur each other.
Each sensor node that communication means of the present invention uses should be unified distribution " ID ID " when dispatching from the factory, this ID number when each communication all as a field in the packet, being used for identifying the on-air radio signal is which sensor node is just at transceiving data.
Communication means of the present invention need to know in advance which sensor node each sensor gateway manages, and requires the node of different gateway managements not overlapping. The all sensors node ID number that each gateway is managed is saved as a tabulation in the gateway internal memory, be called " node ID number table ", and ID number the order of depositing represents with " serial number SN " in the table. In system's running, allow to revise at any time the content in " node ID number table ", so that the sensor node in newly-increased or the minimizing network.
Be further described below in conjunction with accompanying drawing.
Fig. 1 is the wireless sensor network structure chart that the embodiment of the invention adopts, and this wireless sensor network belongs to the hierarchical structure network, and sensor node 1 is positioned at the bottom of network, sensor gateway 2 layer that mediates, and sensor server 3 is in top. Centered by sensor gateway 2, the sensor node 1 around it uploads to sensor server 3 to the environmental data that gathers by this gateway 2. Adopt wireless mode to communicate by letter between sensor node 1 and the gateway 2, and general employing wired mode is communicated by letter between gateway 2 and the server 3. Contain a plurality of gateways 2 in the sensor network, each gateway 2 is managed again several sensor nodes 1. Data communication does not occur in the sensor node 1 of present embodiment each other, yet not mutually communication between each gateway 2.
The sensor node 1 of the embodiment of the invention is unified distribution " ID ID " when dispatching from the factory, and is solidificated among its EEPROM with program, and ID number length is 32bits.
The working channel of the sensor gateway 2 of the embodiment of the invention has 5, is respectively 433.1MHz, 433.3MHz, 433.5MHz, 433.7MHz, 433.9MHz. Each gateway is set in advance and is worked in one of them channel.
Each can manage at most 255 sensor nodes 1 the sensor gateway 2 of the embodiment of the invention, these ID numbers of being managed sensor node 1 are all left in the internal memory of gateway 2, and number in order, i.e. serial number SN of each ID correspondence, the value of SN is 1~255. If SN is 0, sensor node corresponding to expression do not belong to this gateway management.
Fig. 2 is the software flow pattern of embodiment of the invention sensor node 1. Sensor node 1 has two kinds of duties:
(1) login state: sensor is in login state after powering up. At this state, sensor node outwards sent once " registration packet " every 30 seconds, and each working channel that sends " registration packet " is different, was followed successively by in 5 working channels of gateway. Therefore, as long as the sensor gateway is working properly, sensor node needs at most 30 * 5=150 second, just can succeed in registration.
The form of " registration packet " is as follows:
Sequence number | Field name | Field length | Explanation |
1
| Opening flag STX |
1Byte
| Be fixed as AAH |
2
| Type of data packet Type |
1Byte
| 01H is expressed as registration packet |
3
| Sensor ID number |
4Bytes
| Be ID number of the sensor node that sends registration request |
4
| Check code CRC8 |
1Byte
| 8 CRC check codes for front 2 fields |
5
| End mark ETX |
1Byte
|
55H
|
After the sensor gateway of this channel work was being received the registration packet of sensor node, gateway returned following " communication control information bag ":
Sequence number | Field name | Field length | Explanation |
1
| Opening flag STX |
1Byte
| Be fixed as AAH |
2
| Type of data packet Type |
1Byte
| 81H is expressed as the communication control information bag |
3
| Sensor ID number |
4Bytes
| Be ID number of the sensor node that receives this packets of information |
4
| Serial number SN |
1Byte
| For this sensor node on this gateway |
| | | Serial number. If be 0, represent that this node does not belong to this gateway management. |
5
| Management of sensor number N t |
1Byte
| The total quantity of the sensor node of this gateway management |
6
| Data collection cycle Ts |
2Bytes
| Sensor node gathers the time interval of monitored data, the 10ms of unit |
7
| Service time in this cycle Tu |
2Bytes
| The current data collection period is elapsed time, the 10ms of unit. |
8
| Check code CRC8 |
1Byte
| 8 CRC check codes for front 6 fields |
9
| End mark ETX |
1Byte
|
55H
|
If sensor node can be received " communication control information bag " in 10ms, and " serial number SN " in the bag be not 0, then succeeds in registration, and sensor node enters the image data state work that sends. Otherwise registration failure, sensor node dormancy be again registration after 30 seconds, and so circulation is until succeed in registration.
(2) send the image data state: under this state, sensor node waits for that Twait gathers monitored data once after the time automatically, sends " image data bag " with the identical operating frequency of registration gateway again. Gateway returns response message-" communication control information bag " to node after receiving " the image data bag " that node is sent; If node can be received the response message of gateway, then again enter dormancy, wait for next time and gather and send; If the continuous response message of failing to receive gateway for three times, then node reenters login state.
The form of " image data bag " is as follows:
Sequence number | Field name | Field length | Explanation |
1
| Opening flag STX |
1Byte
| Be fixed as AAH |
2
| Type of data packet Type |
1Byte
| 02H is expressed as the image data bag |
3
| Sensor ID number |
4Bytes
| Be ID number of the sensor node that sends packet |
4
| Uploading data Data |
4Bytes
| The actual monitoring data |
5
| Check code CRC8 |
1Byte
| 8 CRC check codes for front 3 fields |
6
| End mark ETX |
1Byte
|
55H
|
The embodiment of the invention, each gateway are all returned " communication control information bag " after receiving the data that sensor node uploads, and its effect one is to coordinate the working time slot that each node sends data; Another is at any time modification parameter of convenient notice node, and these parameters comprise: image data time interval Ts, the number that increases or reduce the gateway management sensor (shows as Nt, SN change).
The computational methods of Twait are as follows:
● the one uploading data period that each sensor node is assigned to is called as time slot, and the time span of each time slot is:
△t=T
s÷N
t
● serial number is that the working time slot that the sensor node of SN is assigned to is:
(SN-1)×△t≤t<SN×△t
● after receiving " communication control information bag " at every turn, after sensor node need to be waited for Twait, the ability uploading data:
As (SN-1) * △ t 〉=TuThe time,
Twait=(SN-1/2)×△t-T
u;
Otherwise,
Twait=(T
s-T
u)+(SN-1/2)×△t。
Wherein:
SN is the serial number that sensor node ID number is deposited in the gateway internal memory
△ t is the time that gateway is distributed to the collection transmission data of each sensor node
T
sSend the cycle of data for the sensor node collection
N
tSensor node number for gateway management
T
uBe this collection transmission data cycle time in the past
Fig. 3 is the composition frame chart of embodiment of the invention sensor gateway 2. The sensor gateway mainly is comprised of three parts: (1) wireless communication module 2-A, be responsible for the transmitting/receiving wireless signal; (2) communication processor 2-B, the realization program of its operation communication means of the present invention; (3) main control module 2-C is responsible for processing uploading image data, also does interim storage; And be connected uploading data and receive running parameter and set with sensor server 3 by Ethernet. Communication processor 2-B contains inside a time slot timer 2-B-1, and it is with counting mode work, and initial value is set to data collection cycle Ts, and every 10ms counter subtracts 1 automatically, after count value is kept to 0, automatically again puts initial value again, and work so moves in circles. Also build " node ID number table " 2-B-2 in the communication processor 2-B internal memory, be used for to preserve ID number of all the sensors node of this gateway management.
Fig. 4 is the software flow pattern of the upper work of communication processor 2-B of embodiment of the invention sensor gateway 2, and process description is as follows:
1, from main control module 2-C, download the gateway running parameter, and foundation " node ID number table ". Download parameters comprises: gateway working channel CH, sensor node data collection period Ts, the number of nodes Nt of gateway management and each node ID number;
2, the working channel of setting communication module 2-A is CH; Putting slot timing device 2-B-1 initial value is Ts, starts slot timing device 2-B-1.
3, put communication module 2-A in intercepting mode, wait for registration request or the uploading data of receiving sensor node 1. If receive the packet that node is sent, then enter next step.
4, receive in the packet ID number with " node ID number table " in compare one by one for each ID number, obtain " the serial number SN " of this sensor node. In " if node ID number table " not ID number of this sensor node, SN=0 then.
5, read the currency t of slot timing device, the calculating book collection period service time Tu=Ts-t.
6, generate " communication control information bag ", and " communication control information bag " mail to sensor node.
If 7 sensor nodes that send data are subjected to this gateway management (SN ≠ 0), and the packet of receiving is " image data bag ", then image data is uploaded to main control module 2-C.
8, jump to step (3), always periodic duty is gone down.
Sensor node involved in the present invention and the hardware circuit of gateway can be with reference to the disclosed content of the embodiment of the invention and correlation technique file self design, and it is self-evident for the technology people in affiliated field.