1 Introduction

Wireless Sensor Networks (WSN, or WSNs) [1] is a very hot research direction in recent years, because this technology has a very excellent performance in harsh environments, unattended, limited resources and other special environment. The topology of the WSN is not static, and the energy of each node in the network is also limited. Therefore, it is the most critical of the WSN to be able to connect all the sensor nodes and reduce the energy consumption.

The main responsibility of the routing protocol is to find the forwarding path for data transmission, which involves the path optimization between the target node and the forwarding node, and guides the data to be transmitted on the correct path. Because of the characteristics of different networks, different applications, and different requirements, routing protocols are also different. Wireless sensor network is different from other networks, and its main function is to adapt to the harsh environment, and obtain the data information of the monitoring object without the continuous supply of energy. In view of these characteristics, wireless sensor routing protocols focus on energy consumption priority, data centric and application related. Routing protocol is the lifeline of the whole network; the existence of routing makes the WSN power consumption is relatively low with fast addressing conditions scalability and robust. In order to maximize the role of wireless sensor networks in a variety of environments, routing protocol design must be developed in a variety of directions.

In the structure, WSN routing protocol [2] can be divided into plane protocol and hierarchical protocol, the plane protocol need to maintain a large routing table which is not suitable for large-scale network; hierarchical protocol, also known as distributed protocol or clustering protocol, as shown in Fig. 1.

Fig. 1
figure 1

WSN clustering diagram

1.1 Several other typical clustering protocols

The TEEN protocol [3] in hierarchical routing protocols is the first responsive event driven protocol used in WSN, that is to say, the sensor node sends the collected information to the sink node only when the observation object in the monitoring area has a sudden change. Single hop communication is the communication way between the member nodes and the head nodes of each cluster in the TEEN protocol.

A cluster member node transfers the collected information directly to the cluster head instead of forwarding the neighboring nodes within the time specified in the cluster head; the cluster head also transmits the fused information to the Sink node in a single hop mode [4,5,6,7,8].

Compared with LEACH routing protocol, TEEN routing protocol uses a clustering algorithm similar to LEACH protocol, and uses the concept of “round” in routing algorithm. The main idea of dynamic clustering routing algorithm:

The core of the dynamic clustering routing algorithm is the “round” mechanism, which mainly displays in the routing algorithm, the cluster head nodes are dynamically generated in the “round”, so they are more flexible in practical applications. The main design idea of the algorithm is: first, cluster head nodes are generated. In the sensor nodes, several cluster head nodes are randomly generated, and the cluster head nodes are different in different “round”. First, when the cluster head node is generated, the message is sent immediately to the node in the network. The sensor node is the first node of the current round; Next, the generation of member nodes. In the algorithm, some mechanisms and strategies are designed. When the cluster head node is generated, the rest of the network will look for the cluster head node according to the designed mechanism and strategy to become its member node; Last, the transmission and processing of data within a cluster. An important function of cluster head nodes is to coordinate and distribute data transmission among sensor nodes in a cluster. Of course, the cluster head node will initially process the received data and then send it to the sink node.

Each round in the TEEN protocol needs to set a suitable run-time value. If you set it a little longer, you can reduce the amount of time it takes to build this round. However, the longer the time, the longer the working time of the cluster head, and the energy consumption of the cluster head will be exhausted, which will make the energy consumption die prematurely. And if it is shorter, then the frequent reconstruction of the cluster will cause a lot of energy consumption and waste. The “round” mechanism of TEEN protocol is mainly completed in two stages: the establishment of cluster and the data processing and transmission of module

Next, another clustering protocol called PEGASIS [9] is introduced. This is a protocol that is improved on the basis of LEACH. The idea of PEGASIS is to divide the nodes in the network into multiple chains instead of dividing them into clusters as before. In this case, there will be no overlap in the cluster as in the LEACH protocol. In the PEGASIS protocol, there is a prerequisite that each node knows the location of each other, and that the nearest node is chosen as the next hop. Then the greedy algorithm is followed, and this method is repeated, so that multiple chains can be formed. Only nodes close to sink can be selected as chain heads. The nodes on the chain can perform data fusion operations, and the communication between the chain head and the sink can be made directly or by means of other chain heads.

Fig. 2
figure 2

The chain structure of the PEGASIS protocol

The chain structure of the PEGASIS protocol is shown in Fig. 2. In this protocol, the chain head is not periodically changed. Moreover, when the information is transmitted, the nodes on the chain perform the operation of fusing information, and the amount of data transmitted can be reduced, so the power consumption of the PEGASIS protocol is obviously smaller than the power consumption of the LEACH protocol. However, since there are only chains in the PEGASIS, when the chain header fails or dies, it results in the failure of data to be transmitted to the sink node. In addition, if the size of the network is large, then the chain will be long, resulting in a great delay in data transmission [10,11,12,13].

Fig. 3
figure 3

LEACH operation process

1.2 The LEACH protocol

The more classic of the hierarchical protocol is the one to be discussed in this paper—the Low Energy Adaptive Clustering Hierarchy, LEACH [14]. It was proposed by MIT’s Heinzelman in 2000, in which the cluster head (CH) is held by every node in turns, so the energy consumption of each node can be balanced as much as possible. However, the protocol also exist defects such as CH distribution is unreasonable, uneven energy consumption, single-hop selection and so on. Improved protocol, such as W-LEACH [2], T-LEACH, LEACH-RA and LEACH-C, etc., have improved the original protocol in different directions [14], but most of the algorithm still use LEACH distributed method in the election cluster stage.

The selection of CH node is the core process of the LEACH protocol, so the concept of “round” is proposed. Each round consists of two states: the selected state and the steady state. The beginning of each round is to re-determine the location of the CH, and then CH broadcast their own location and information, after that the ordinary node received information from their nearest CH node then join it. When all the CH and ordinary nodes have been identified (in the actual application, not all of the head has a subordinate ordinary node, not all ordinary nodes can join a CH either), the network began to enter a stable state, and then enter the election state once again. The whole process is shown in Fig. 3. It is such a process of periodic elections until the system’s energy is exhausted and the network is dead

$$\begin{aligned}&\left\{ {{\begin{array}{ll} T(n)=0, \quad \qquad \qquad \qquad \qquad otherwise \\ {T(n)=\frac{p}{1-p\times (r\bmod \frac{1}{p})}, \qquad \; n\in G} \\ \end{array} }} \right. \end{aligned}$$
(1)

In order to determine the CH nodes, each node generates a number between [0,1] randomly. If it is less than T(n) in formula (1), then the node is selected as CH node, and the rest is ordinary node. In formula (1), p is the ratio of the CH node to the total node in the network, r is the number of rounds of the current election, and G is the set of ordinary nodes in the remaining 1/p round (Fig. 3).

The CH allocate the time points for each subordinate node to transfer the data in TDMA mode (transmit slot). In the stable stage, the CH fuses the data which is received by each common node, and then forward it to the Base Station (BS).

2 Comprehensive improvement of LEACH protocol

LEACH protocol can reduce energy consumption by more than 15% compared to other plane protocol [14]. Later, people began to study the improvement of LEACH protocol and put forward many practical improvement directions.

2.1 The main issues of the LEACH protocol

First, in practical applications, the partitioning of clusters is extremely uneven. Some clusters are too large, while others have only one node, which results in a great waste of node energy. According to document [15], the energy consumption of the minimal cluster nodes is about 20% higher than that of the maximum cluster nodes, and the original protocol is not reasonable enough for the nodes join cluster failures.

Second, the communication between cluster nodes and BS is single path point to point transmission. If the CH is too far from the BS, it needs a large transmission power [16]. At the same time, in the stable phase, if a CH has sudden death due to unexpected circumstances, the original LEACH protocol has no spare CH node, and then the ordinary nodes in the cluster will still communicate according to the original assigned time until the end of the round, resulting in a great deal of energy waste.

Third, document [17] points out that the ratio of CH node to common node is better than 1/19, that is to say, when the proportion is 5%, the system efficiency is the highest. In fact, the ratio determine the number of CH nodes based on the number of initial nodes, and there is more topology changes caused by the addition of new nodes and the death of existing nodes in actual operation.

2.2 First-order radio model

WSN is mainly composed of these subsystems: energy supply electronic system, communication subsystem, processing subsystem and sensing subsystem, besides some sensor networks will have positioning subsystem. The energy consumed by the communication subsystem is much higher than that of the processing subsystem. The experiment proves that the energy consumption of data transmission is very large, and the energy consumption needed for data processing is relatively small. Based on this principle, the energy consumption model mainly considers the energy consumption of the sensing subsystem and the energy consumption of the communication subsystem.

Figure 4 is a first-order radio model. In this paper, a simple model for sending and receiving signals is assumed [14], the energy consumption is \(E_{elec} =50\hbox {nJ}/bit\), and the transmit amplifier has a magnification factor of \(\varepsilon _{amp} =100\hbox {pJ}/bit/m^{2}\), so we can get acceptable \(\frac{E_b }{N_o }\) value. At the same time, it is assumed that there is some energy loss in the channel transmission. Thus, when the radio model sends k bit information from the D distance node, the radio expands to:

$$\begin{aligned} E_{Tx} (k,d)= & {} E_{Tx-elec} (k)+E_{Tx-amp} (k,d) \nonumber \\ E_{Tx} (k,d)= & {} E_{elec} ^*k+\varepsilon _{amp} ^*k*d^{2} \end{aligned}$$
(2)

Under the same conditions, the receive message radio extension is:

$$\begin{aligned} E_{Rx} (k)= & {} E_{Rx-elec} (k) \nonumber \\ E_{Rx} (k)= & {} E_{elec}^ *k. \end{aligned}$$
(3)
Fig. 4
figure 4

The first order radio model

2.3 CH proportion

One of the most important factors that affect the lifetime of a clustered network is the selection of cluster heads. The probability of the cluster head node is too large or too small, which will directly affect the network lifetime, and the probability of cluster head nodes can not be too large or too small. It is assumed that there exists an optimal probability of cluster head to maximize the lifetime of the network, and the best proportion of cluster heads is analyzed theoretically.

Suppose there are N network nodes in the network, which are evenly distributed in the area of M * M, The network selects R cluster head nodes, and the number of nodes in each cluster is the same. There should be \(\left( {N/r} \right) \) nodes in each cluster, and each of them consists of 1 CH nodes and \((N/r-1)\) CM nodes. Next, the energy consumption of the whole cluster is analyzed to obtain the best proportion of cluster head, so that the energy consumption of the whole sensing network is lowest.

In WSN, the cluster heads are responsible for collecting data from the members of the cluster and fusing them, and then forwarding them to the BS Station (Base), also known as the SINK. Therefore, the energy of cluster head nodes is mainly consumed in the following sections: energy consumption of data received by members of \(\left( {N/r} \right) \) clusters, energy consumption of data fusion processing, and energy consumption of sending the fused data to the base station. The energy of the nodes in the cluster is mainly in the process of sending the data to the cluster head node. The energy consumption of a cluster \(E_{cluster}\) is divided into two parts: the energy consumption of cluster head node \(E_{CH}\) and the energy consumption of cluster members \(E_{CM}\). However, the energy consumption of the whole network is the sum of the energy consumption of each cluster, that is, the following formula:

$$\begin{aligned} E_{net} =rE_{cluster} =r\left[ {E_{CH} +\left( {\frac{N}{r}-1} \right) E_{CM} } \right] \end{aligned}$$
(4)

From the above energy model analysis, it is assumed that each node communication only sends and receives data of a k bit packet, then energy consumption of each CM communication:

$$\begin{aligned} E_{CM} =E_{static} +k*\left( {e_{static} +\varepsilon *d^{2}} \right) \end{aligned}$$
(5)

where D is the distance from CM to CH, and the average value of D is (from the document [15]):

$$\begin{aligned} \overline{d^{2}} =\frac{1}{2\pi }\frac{M^{2}}{r} \end{aligned}$$
(6)

And:

$$\begin{aligned} E_{CM} =E_{static} +k*\left( {e_{static} +\varepsilon *\frac{1}{2\pi }\frac{M^{2}}{r}} \right) \end{aligned}$$
(7)

CM needs to upload all the CH data to BS and it is assumed that CM can ideally fuse CH data, compressing all received data into 1 packets (k bit data). Then the energy consumption of CH can be divided into: \((N/r-1)\) times k bit data received energy, the energy consumed by a k bit data transmission, and the energy consumption of data compression fusion processing (This energy is consumed by the processor program and can be incorporated into the energy consumption inherent in the non-RF circuit section \(E_{static} )\), thus:

$$\begin{aligned}&E_{CH} =\left( {\frac{N}{r}-1} \right) *E_{receive} +E_{send} \end{aligned}$$
(8)
$$\begin{aligned}&E_{receive} =E_{static} +k*e_{static} \end{aligned}$$
(9)
$$\begin{aligned}&E_{send} =E_{static} +k*\left( {e_{static} +\varepsilon *D^{2}} \right) \end{aligned}$$
(10)

where D is the distance of CH to BS, from the above three formula:

$$\begin{aligned} E_{CH} =\frac{N}{r}\left( {E_{static} +ke_{static} } \right) +k\varepsilon D^{2} \end{aligned}$$
(11)

And:

$$\begin{aligned} E_{net}= & {} r\left[ \frac{N}{r}E_{static} +\frac{N}{r}ke_{static} +k\varepsilon D^{2} +\left( {\frac{N}{r}-1} \right) \right. \nonumber \\&\times \left. \left( E_{static}+k*\left( {e_{static} +\varepsilon *\frac{1}{2\pi }\frac{M^{2}}{r}} \right) \right) \right] \end{aligned}$$
(12)

Because of \((N/r) \gg 1\), thus:

$$\begin{aligned} E_{net} =\left[ {2N\left( {E_{static} +ke_{static} } \right) +k\varepsilon \left( {rD^{2}+\frac{N}{2\pi }\frac{M^{2}}{r}} \right) } \right] \nonumber \\ \end{aligned}$$
(13)

The derivation of R is:

$$\begin{aligned}&D^{2}-\frac{N}{2\pi }\frac{M^{2}}{r^{2}}=0 \end{aligned}$$
(14)
$$\begin{aligned}&r=\sqrt{\frac{N}{2\pi }}\frac{M}{D}. \end{aligned}$$
(15)

3 A clustering WSN routing protocol based on node energy and multipath

Nowadays multipath routing can be divided into opportunistic routing, multi-path parallel routing and single path routing extension. Among them, opportunistic routing is a probabilistic model based routing, in which the intermediate nodes listen to the packets of the source nodes in various probability forms, thus reducing the number of data forwarding; multipath parallel transmission is determined by link resource and hop number, and the data to be transmitted is dispersed to pre-selected disjoint paths; more common is the last one—expansion of the single path, when the path discovery is recorded, the multi hop path is selected, and one of the best performance is used as the current path, and if the path fails, the data is transmitted from the alternative path.

Many researchers use redundant or network coding to implement multi-path routing protocols to ensure reliability and real-time. Traditional WSN multipath routing protocols, such as AOMDV, can build multiple paths from terminal nodes to sink nodes in the routing discovery phase, And the least hop path is used to transmit the data until it is found unavailable. AOMDV protocol can reduce the number of re discovery of routing, but lead to other serious consequences, thus, when using multipath routing, we need to consider not only the number of hops in the path, the energy of nodes, but also the distance between nodes [18,19,20,21,22].

3.1 Related multipath routing algorithm

In the research work of predecessors, there is an idea to reserve multiple paths in the improvement of multi-path routing mechanism. When the current path fails, the backup path is used and new paths are generated on demand to replace the failure paths, thus maintaining the number of backup paths unchanged. In this paper, we propose a energy based multipath routing algorithm (LEACH-Impt), multiple disjoint paths are generated from the routing topology of inter cluster nodes. In data transmission, the current optimal path is dynamically selected considering the path energy consumption, the route hops and the path residual energy [23,24,25,26].

As shown in Fig. 5, there areNnodes and m completely disjoint routing from source node S to sink node (BS) [17]. For the m routing \((P_1 ,P_2 ,\cdots P_m )\), location and energy of each node, the high priority path must have few hops, small transmission distance and large path residual energy.

Fig. 5
figure 5

The completely disjoint routing between nodes (S,D)

Nodes energy consumption parameter on the routing path is:

$$\begin{aligned} \left\{ {{\begin{array}{c} {E_1 =E_{11} +E_{12} +...+E_{1k_1 } } \\ {E_2 =E_{21} +E_{22} +...+E_{2k_2 } } \\ \vdots \\ {E_m =E_{m1} +E_{m2} +...+E_{mk_m } } \\ \end{array} }} \right. \end{aligned}$$
(16)

Total transmit and receive energy consumption parameters \(E_i \) of article i path is:

$$\begin{aligned} E_i =\mathop \sum \nolimits _{j=1}^{k_j } {E_{ij} ,(i=1,2,\cdots ,m)} \end{aligned}$$
(17)

The Node \(N_{\mathrm{i}}\) remaining energy parameters \(a_w \) after the completion of the data retransmission is:

$$\begin{aligned} a_w =\frac{(a_0 -a_e )-Ei_j }{a_0 }(i=1,2\cdots ,m;j=1,2,\cdots ,k_i )\nonumber \\ \end{aligned}$$
(18)

Defines the energy remaining for path i is:

$$\begin{aligned} \begin{array}{ll} R_i &{}=\frac{(a_0 -a_e )-E_{i1} }{a_0 }*\frac{(a_0 -a_e )-E_{i2} }{a_0 }*\cdots *\frac{(a_0 -a_e )-E_{ik_i } }{a_0 } \\ &{}=\prod _{j=1}^{k_j } {\frac{(a_0 -a_e )-Ei_j }{a_0 }} ,(i=1,2,\cdots ,m) \\ \end{array} \end{aligned}$$
(19)

If the energy of one node is close to the critical state, the energy consumption parameter converges quickly, and the reliability and relative balance of the energy transmission of the path can be guaranteed.

Combining the total energy consumption and hops of the path, the routing energy priority parameter is defined as:

$$\begin{aligned} \hbox {P}_{\mathrm{r}} (i)=\frac{R_i }{E_i *H_{hop} }(i=1,2,\cdots ,m) \end{aligned}$$
(20)

Among them, \(H_{hop}\) represents the hop number of \(S\rightarrow D\), and \(R_i \) represents the residual energy of path i, and \(E_i \) represents the energy consumption of path i. Substituting formulas (17) and (6) we can obtain the energy priority parameter of path i:

$$\begin{aligned} P_r (i)=\frac{\prod _1^{k_i } {\frac{(a_0 -a_e )-Ei_j }{a_0 }} }{H_{hop} *\sum _1^{k_i } {Ei_j } },(i=1,2,\ldots ,m). \end{aligned}$$
(21)

3.2 A clustering WSN routing protocol based on node energy and multipath

Based on the problems existed in the original protocol, in this paper, the improved protocol is proposed called LEACH-Impt whose process is shown in Fig. 6. After the first round, the next CH is selected by the BS according to the residual energy, the distance from the BS, the number of times to be elected and the number of neighbor nodes; and set alternate CH nodes and more scientific and reasonable multi hop inter cluster routing.

The first round election mainly adopts the method of the original protocol, and define wait time is \(t_s \), each round duration \(t_r; E_{current} (n_i )\) is the residual energy of node \(n_i ; d_{toBS}(n_i )\) is the distance of node \(n_i \) to BS; \(N(n_i )\) is the total number of nodes in the same cluster on this node; and suppose node \(n_i \) is belong to cluster \(c_i \). So the evaluation function \(f(n_{i} ,c_{j} )\) of CH is defined as follow [27]:

$$\begin{aligned} \left\{ {{\begin{array}{l} f_e (n_i ,c_j )=\frac{E(n_i )-\min \{E_{n_k \in c_j } (n_k )\}}{\max \{E_{n_k \in c_j } (n_k )\}-\min \{E_{n_k \in c_j } (n_k )\}},\\ \quad \max \{E_{n_k \in c_j } (n_k )\}\ne \min \{E_{n_k \in c_j } (n_k )\} \\ {f_e (n_i ,c_j )=0 ,\hbox {otherwise}} \\ \end{array} }} \right. \end{aligned}$$
(22)
$$\begin{aligned} f_d (n_i ,c_j )=\frac{\min \{d_{toBS\;n_k \in c_j } \}}{d_{toBS} (n_i )} \end{aligned}$$
(23)
$$\begin{aligned} \left\{ {{\begin{array}{l} f_c (n_i ,c_j )=\frac{N(n_i )-\min \{N_{n_k \in c_j } (n_k )\}}{\max \{N_{n_k \in c_j } (n_k )\}-\min \{N_{n_k \in c_j } (n_k )\}},\\ \quad \max \{N_{n_k \in c_j } (n_k )\}\ne \min \{N_{n_k \in c_j } (n_k )\} \\ {f_c (n_i ,c_j )=0 ,\hbox {otherwise}} \\ \end{array} }} \right. \end{aligned}$$
(24)
$$\begin{aligned} \left\{ {{\begin{array}{l} f(n_i ,c_j )=w_e f_e (n_i ,c_j )+w_d f_d (n_i ,c_j )\\ +w_c f_c (n_i, c_j ),n_i \in G,w_e +w_d +w_c =1 \\ {f(n_i ,c_j )=0 ,\hbox {otherwise}} \\ \end{array} }} \right. \end{aligned}$$
(25)

In the Formula (22)–(25), \(f_e \), \(f_d \,\hbox {and}\, _{ }f_c \) are used to examine the energy condition of the remaining nodes, the distance to the BS and the number of adjacent nodes respectively. \(w_e ,w_d\,\mathrm {{and}}\,w_c \) are weight index whose specific values can be adjusted according to network size and application. At the same time, the new protocol specifies that the CH election program will select an alternate CH node . When the CH is far from BS, the multi hop routing is used to select the minimum path to transmit data to the BS. When the distance is close, the CH is directly connected with the communication.

Fig. 6
figure 6

LEACH-Impt operation process

4 Simulation analysis

4.1 Network parameter settings

In the Matlab-R2012 environment, the model is built with its Editor tool, and 100 nodes are randomly distributed in the area of 200 * 200. The BS nodes are located at (100, 200) position, each round is 20 s, and each time the energy consumption is 50 nJ/bit. The simulation parameters are shown in Table 1.

Table 1 The simulation parameters

4.2 Simulation result analysis

The program starts running. As shown in Fig. 7, the distribution density of the nodes is relatively average, without excessive concentration or sparseness. The CH nodes within the BS 75 m are required to communicate directly with the BS, and the other CH take multi hop routing.

Fig. 7
figure 7

Initial node distribution

Fig. 8
figure 8

First round and dead node appear network routing topology

The simulation system uses LEACH-Impt optimization algorithm for clustering and communication. The selection of the first round cluster is the same as that of the original protocol, but a more reasonable multi hop transmission is added to the communication among the clusters. The protocol specifies that the cluster head nodes within the base station 75 m communicate directly with the base station, and the other cluster heads take multi hop routing. The best path is selected from the path priority given in the third chapter, as shown in Fig. 8a

As shown in Fig. 8b, the death node appears in this round. The data show that the node appears in the 784th round, 52 rounds later than the original death node of the original protocol. One of the dead nodes is the cluster head before, which corresponds to the previous theory (cluster head nodes are easy to consume and die too fast).

The death node appears faster after the first death node appears. As shown in Fig. 9, the network still has a very scientific self-organizing topology. In multi-hop transmission, the direction of hop path is also reasonable. Through the network diagram, we can find that the CH of the improved algorithm is more uniform, and the multi-hop among clusters is more reasonable. As shown in Fig. 9, the entire network has 91 dead nodes which is more than 90%, that means the network has died and the entire network has no CH nodes and multi-hop transmission.

4.3 Comparative analysis

Analysis data show that the original protocol has no death node in the first to 731 rounds, and the first death node appeared in the 732nd round. Subsequently, the death node increased dramatically, all nodes were dead to the 1220th round, and the entire network died; The LEACH-Impt has no dead nodes in the first to the 783 round, and all nodes are alive, the first death node appeared in the 784nd round. Subsequently, the death node increased dramatically, but the number of surviving nodes is always larger than the original protocol, and the number of dead nodes is always less than the original protocol, the first death node appeared in the 1560nd round, all nodes were dead. Through the curve contrast, it can be intuitively found that the performance of LEACH-Impt in survival is better than the original protocol (Figs. 10 and 11)

Fig. 9
figure 9

Snapshot of network operation topology

Fig. 10
figure 10

The entire network is paralyzed

As shown in Fig. 12 is the network data throughput and transmission contrast of the two protocols (specify that the amount of communication between each cluster and in the cluster is 1), and it can be intuitively found that the amount of data transferred by the improved protocol is much higher than the original protocol.

From Fig. 13, we can find that the energy consumption of the two protocol network is almost the same in the early term (the 0–500 round) of the network operation phase, and the growth rate is relatively fast; In the medium term (round 500–1000), the energy consumption of the two protocol is different, and the improved protocol energy consumption is relatively less than that of the original protocol, and the rate of growth of the two protocol is relatively fast; In late (round 1000–1500), the energy consumption of the two protocol is different, the improved protocol energy consumption is relatively less than that of the original protocol, and the rate of growth of the two protocol is relatively slow.

Although a lot of improvements have been made to the original protocol, which will increase the overall workload of the agreement, however, the total energy consumption of the network is certain, so the total energy consumption varies little, about 50.44 units.

5 Hardware verification

The one value of an algorithm is to apply it to practice. In the network node, we select the current popular RF microcontroller—CC2530 to communicate to PC via USB-CP2102-UART. Host computer interface is designed by Qt which is a very smart and Object-oriented C++ editor. The overall architecture diagram is shown in Fig. 14.

Fig. 11
figure 11

Comparison of LEACH and LEACH-Impt death nodes over time

Fig. 12
figure 12

Comparison of data transmission between LEACH and LEACH-Ipmt

Fig. 13
figure 13

Comparison of energy consumption between LEACH and LEACH-Ipmt networks

CC2530 requires two crystal oscillators, 32 MHz and 32.768 KHz. The LED circuit is directly driven by the port, when the port output is low, LED is lit. The LED circuit on the core board is used to indicate the working state of the nodes, such as joining the network, sending or receiving data, etc.. The power circuit is different—the coordinator node of this system uses USB to supply power, and the other nodes use 2 AA batteries to supply power. Reset circuit can reset the microcontroller, is a typical button reset circuit

In the design of the host computer, Qt is adopted. Qt is a well-known cross platform C++ graphical user interface application framework, which is very large, not just GUI, but also can be used to develop non GUI programs, such as console tools and server. Qt is an object-oriented framework that uses special code to generate extensions (called Meta Object Compiler, MOC), and some macros that are easy to extend and allow component programming. Therefore, Qt is chosen to verify the network host computer, and the Qt program involved in this chapter is based on the Windows operating system.

Fig. 14
figure 14

Overall architecture diagram

Fig. 15
figure 15

LEACH-Impt network diagram

The host computer is mainly in order to obtain the topological structure of network, in order to accurately verify the network quality, the system adds five temperature acquisition nodes, and all the nodes are set to away from the coordinator in the physical distribution network. And the collected temperature will be sent to the PC; in addition, these five nodes has the function of wireless lighting, aim to verify whether the network communication patency (Fig. 15).

Observation of the host computer shows that LEACH-Impt can form a multi hop path between clusters, and the death time of the first node is about 4 h and 49 min later than that of the LEACH protocol. Experiments show that temperature information acquisition and light control are unobstructed (Table 2).

This chapter mainly deals with the hardware implementation of the two protocols respectively. The system uses the current popular radio frequency chip—CC2530 as network nodes, take CP2102 (convert of USB to UART serial port) to communicate with the PC machine, and use powerful Qt to design the host computer interface. The network system is designed quite scientific.

Table 2 comparison of network lifetime

6 Conclusion

In this paper, the LEACH protocol is studied and improved, and the simulation and hardware verification are carried out. The experimental results show that the survival time and data throughput of the improved protocol network have been greatly improved. There is some shortcoming in this paper, When nodes are separated from the network or join the network, the network forms a new topology network structure, which takes a long time. At this time, it is easy to miss a lot of important information collection and transmission; in an improved protocol, the node’s location moves can cause the network to paralyze. In terms of mobility of nodes, static location of WSN sometimes has limited its functions. Fast moving wireless sensor networks may be the direction of future development.

In future work, the issue of the topology changes and information delays in the network when the nodes are suddenly joined and separated; and the self-organization of the network in the case of high speed movement will be focused.