Detailed Description
The invention is further described with reference to the following examples.
Referring to fig. 1, the intelligent bus temperature and humidity monitoring controller based on ZigBee of this embodiment includes a monitoring controller 1, a relay 2, and a remote monitoring terminal 3, where the monitoring controller 1 includes a temperature and humidity monitoring module 11, a microprocessor module 12, and a ZigBee module 13, the temperature and humidity monitoring module 11 is configured to collect temperature and humidity signals at a bus joint in real time and send the collected signals to the microprocessor module 12 for analysis and processing, the microprocessor module 12 feeds back the processed temperature and humidity data to the ZigBee module 13, the ZigBee module 13 transmits the processed temperature and humidity data to the relay 2 by using a ZigBee wireless communication technology, and forwards the processed temperature and humidity data to the remote monitoring terminal 3 through the relay 2, the remote monitoring terminal 3 includes a data display unit 31 and a hazard alarm unit 32, and the data display unit 31 is configured to display the received temperature and humidity data in real time, the hazard warning unit 32 is configured to warn when the temperature or humidity data exceeds a safety threshold.
Preferably, the temperature and humidity monitoring module 11 includes a temperature sensor and a humidity sensor, and the temperature sensor and the humidity sensor are installed at the bus joint and used for acquiring temperature and humidity signals at the bus joint in real time.
Preferably, the temperature sensor is a resistance temperature sensor.
Preferably, the humidity sensor employs a DHT11 probe.
Preferably, the repeater 2 forwards the received temperature and humidity data to the remote monitoring terminal 3 in a WiFi, network cable or RS485 bus manner.
The preferred embodiment provides an intelligent bus temperature and humidity monitoring controller based on ZigBee, bus temperature and humidity monitoring based on ZigBee wireless communication technology can effectively solve the problems that a wired network needs additional wiring, the structure is complex, the existing network communication is not smooth and the like, and the real-time monitoring function of intelligent bus temperature/humidity with low power consumption, low price and high reliability is realized.
Preferably, the ZigBee module 13 transmits the processed temperature and humidity data to the relay 2 by using a ZigBee wireless communication technology, in which a clustering routing mechanism is used.
Preferably, in each round of clustering stage, each sensor node generates a random number between 0 and 1, and when the random number is smaller than an election threshold, the sensor node is selected as a temporary cluster head, wherein an election threshold t (i) corresponding to a sensor node i has a calculation formula as follows:
where p represents the expected clusterhead percentage, r represents the current round number, and G represents the most recent
Set of nodes in turn that do not become temporary clusterheads, E
0(i) Represents the initial energy value of sensor node i, and e (i) represents the current energy value of sensor node i.
In the preferred embodiment, the random rotation is adopted to elect the temporary cluster head, so that the fairness of competition of the sensor nodes for the temporary cluster head in the network is ensured, the energy value of the sensor nodes is introduced into the election threshold value as the weight, the sensor nodes with more residual energy have more chances to be elected as the temporary cluster head, and the energy load of the network is balanced to a certain extent.
Preferably, after the election of the temporary cluster head is completed, the elected temporary cluster head is screened, specifically:
(1) firstly, determining a neighboring temporary cluster head of the temporary cluster head, and if the distance between two temporary cluster heads is smaller than the cluster radius corresponding to any one of the temporary cluster heads, and the two temporary cluster heads are neighboring temporary cluster heads, then the neighboring temporary cluster head set of the temporary cluster head Ci is expressed as:
in the formula, l (C)
i,C
j) Indicating a temporary clusterhead C
iAnd a temporary clusterhead C
jThe distance between the two or more of the two or more,
indicating a temporary clusterhead C
iThe radius of the cluster of (a),
indicating a temporary clusterhead C
jCluster radius of (C)
i) Indicating a temporary Cluster head C
iThe neighbor temporary cluster head number of (1);
(2) the temporary cluster head performs final cluster head competition in a neighbor temporary cluster head set in a competition mode, selects the temporary cluster head with the maximum probability value as a final cluster head, and sets a temporary cluster head CiThe probability of becoming the final cluster head is g (C)i) Then g (C)i) The calculation formula of (2) is as follows:
in the formula, W (C)
i) Indicating a temporary Cluster head C
iNeighbor temporary cluster head, piece (C)
j) Indicating a temporary clusterhead C
jNumber of sensor nodes within cluster radius of (e) (C)
j) Indicating a temporary clusterhead C
jThe current value of the energy of the current,
indicating a temporary clusterhead C
jAverage amount of data sent by sensor nodes within a cluster radius, E
eWhich represents the unit energy consumption of the transmitted data,
indicating a temporary clusterhead C
jCommunication radius of (e)
fsA power amplification factor representing a free space model;
and after the final election of the cluster head nodes is finished, the cluster member nodes judge which cluster head is added according to the strength of the received signals, so that the clustering is finished.
The preferred embodiment screens the selected temporary cluster heads aiming at the phenomenon that the temporary cluster heads randomly selected by the method are distributed intensively and unevenly, and selects the temporary cluster heads in the neighbor temporary cluster head set in a competition mode, so that the finally selected cluster head nodes are prevented from being aggregated.
Preferably, in a data transmission stage after clustering is completed, the cluster head nodes transmit the temperature and humidity data collected in the cluster to the ZigBee coordinator in an inter-cluster multi-hop transmission manner, and the adjacent cluster head nodes also transmit the data in a multi-hop transmission manner.
In the data transmission stage, the preferred embodiment transmits the temperature and humidity data collected by the cluster head nodes to the ZigBee coordinator by adopting a inter-cluster multi-hop mode, so that the energy consumption of the cluster head nodes in the data transmission process can be effectively reduced.
Preferably, the data transmission between the adjacent cluster head nodes is realized by selecting an auxiliary routing node in the cluster between the adjacent cluster head nodes, firstly, a candidate node for election of the auxiliary routing node is selected, and if at least one neighbor node of a sensor node in the cluster where the cluster head node is located belongs to a neighbor cluster, the sensor node is a candidate node of the auxiliary routing node competing for the cluster head node;
defining a time threshold T, and broadcasting the candidate nodes after the time threshold is reachedThe information of the auxiliary routing node competing for the cluster head node is broadcasted, if the candidate nodes of the auxiliary routing node competing for the cluster head node receive the information of the competing auxiliary routing node, the competing auxiliary routing node is abandoned, and the device is arranged
For competing cluster head nodes CH
iCandidate node of the auxiliary routing node, then the candidate node
The corresponding time thresholds are:
in the formula (I), the compound is shown in the specification,
representing candidate nodes
Corresponding time threshold, T
0Indicating the time slot duration allocated to the transfer of control messages,
representing candidate nodes
Competition cluster head node CH
iThe weight of the auxiliary routing node of (2),
wherein the content of the first and second substances,
representing candidate nodes
To its cluster head node CH
iThe distance of (a) to (b),
representing a passing of a candidate node
The number of neighbor cluster head nodes that can be connected,
representing candidate nodes
To its neighbor cluster head node CH
sThe distance of (a) to (b),
representing candidate nodes
The initial value of the energy,
representing candidate nodes
The current value of the energy of the current,
indicating a competing cluster head node CH
iM (CH), a candidate node of the auxiliary routing node of
i) Indicating a competing cluster head node CH
iThe number of candidate nodes of the secondary routing node,
representing candidate nodes
Current energy value of a
1Denotes a constant of smaller value, q
1And q is
2Is a rightCoefficient of weight, and q
1+q
2=1。
In the preferred embodiment, the auxiliary routing nodes are selected between the adjacent cluster head nodes in a broadcasting mode to realize multi-hop data transmission between the adjacent cluster heads, so that the data transmission distance of the cluster head nodes can be effectively reduced, the energy consumption of the cluster head nodes in data transmission is reduced, and the life cycle of the cluster head nodes is prolonged; because the auxiliary routing node is selected in a broadcasting mode, the auxiliary routing node is only required to be selected from the sensor nodes of which at least one neighbor node belongs to the neighbor cluster, so that the energy consumption of message transmission when the auxiliary routing node is selected can be effectively saved; in addition, in the defined weight formula of the competitive auxiliary routing node, the distance from the candidate node to the self cluster head node and the adjacent cluster head node is smaller, the currently consumed energy value is smaller, and the weight of the candidate node with more connected adjacent cluster heads is smaller, so that the time threshold set according to the weight is shorter, the probability that the candidate node selects the auxiliary routing node is increased, the elected auxiliary routing node has a longer service cycle, the distance of data transmission of the cluster head node can be effectively reduced, the diversity of next-hop cluster head node selection is ensured, and the energy consumption of message transmission when the cluster head node selects the auxiliary routing node is reduced.
Finally, it should be noted that the above embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the protection scope of the present invention, although the present invention is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions can be made on the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.