Keywords

1 Introduction

WSN (Wireless Sensor Networks) is a wireless network. Sensor nodes are exchanging data between them to transmit data into base station. Sensor contains small battery that is difficult to rechargeable or replacement. So, the challenges are improving the prolong life time of sensor. Recently, many techniques are proposed to improve life time of networks in wireless communication such as clustering algorithm. K-means is one of algorithm in WSN. The applications of WSN are related to environment, agriculture, building, health care, military as well as industry. It consists of many small devices. These devices are able to compute, cooperate, send the information related to the observed materialistic environment over single-hop WN. The sensor devices sense data and transmits to BS for additional processing in term of processing, sensing, energy, bandwidth, and memory [1,2,3].

So, it is important to consider D from sensor nods to BS (sending/receiving) in wireless communication. The energy consumption reverse proportion to square distance, that is lead to less energy consumption and extend life time of the sensor batteries and the overall networks. The balance process from communication to processing considering how to save energy leads to an advantage of using of periodic wireless sensor networks (PSN). In this papers clustering algorithm are used. K-means algorithm can be considered as a less complicated and lightweight technique, and for choosing the optimal or efficient number of clusters K, we will use Elbow methods. all of this to ensure the efficient energy consumption and prolong of the network. The temperature can be considered as an environment applications of WSN [4]. Sensors batteries is limited in energy saving and it couldn’t recharge it, especially critical and hostile environment. Therefore, the power saving is important of the batteries. Thus, the lifetime of WSN is extended. Table 1 clears the techniques of energy efficiency.

Table 1. State of art of energy efficiency techniques

2 Proposed Method

In this section, K-mean clustering algorithm is used to improve energy efficacy. The goal can be considered as reducing distance between the SNs and the BS and communication process. Then, extending the life time of the SNs as well as the overall network have been enhanced. Figure 1 shows the flowchart of proposed work. The first step is to initialize the energy, thresholding, no. of measuring then the energy test.

2.1 Network Setup and Deployment

A Wireless Sensor Network can be exemplified as a connected graph Gp = (ND, EG). Whereas ND = {ND1, ND2,… , NDn} can be considered as n sensor node set, EG is an edge set. Data is collected by SN during a long time and afterwards transmitted every sensed information towards the hierarchy CH’s following level.

At first, energy threshold \(\varepsilon\) are Initialized. The threshold is 10% of total sensor energy. data sensing measurement number M are 20, 50, and 100. the residual energy for each sensor is tested after finishing the transmitting process of data. if greater than or equal threshold, repeating the process until the residual energy smaller than threshold the sensor is excluded and stop the processing [25].

Fig. 1.
figure 1

K-means clustering algorithms

2.2 Choice Optimal Number of Clusters:

Several methods are used by a lot of published papers to decrease D from the sensor nodes to the base station by using a clustering algorithm, the K-means algorithm is a less complicated and lightweight technique, to use the optimal or efficient number of clusters K, we must choice one of the following methods (Elbow, Average Silhouette, Gap statistic). In this part, the elbow method is used as good techniques. This method is shown in Eq. 1. Which it contains distances between all the sample points’ of clusters and the centroid of clusters [15]:

$$SSE = \sum\limits_{{k = 1}}^{k} {\sum\limits_{{xi\in sk}} {\left\| {xi - ck} \right\|^{2} }}$$
(1)

where SSE is sum of squared errors, x is the sensor presented in clusters, Ck is the Kth cluster. The K’s optimal value can be located as the value of SSE decreases over the curve very much and creates a smaller angle [26]. Figure 2 shows the algorithm of K-means clustering.

2.3 Network Clustering Algorithms

K-mean clustering is a process to group or classify of a few sets of data into more than one K cluster utilizing the mean of cluster. The l-mean’s main goal can be reducing the overall Euclidean D from CH to CM. K-mean clustering algorithm is good researched mechanism of exploratory data analyzing [22]. K is represented by a total of clusters which is positive. The major notion of K-Means can be considered as defining the K centroid for all clusters. All the points of n data sets can be taken and under association with the closest centroid. This is the first step. If there is not any pending points, this move completes and a sooner grouping finishes. Each novel K centroid needs to re-calculate as a cluster’s bary-center that results from the prior move. Then, a novel binding should finish among the data set points themselves and the closest novel centroid. There can be a loop. This means that the location of the K centroid is updated gradually to the extent that there is no extra finished updates [5].

Fig. 2.
figure 2

The algorithm of K-means clustering

2.4 Data Collecting and Sending to CH

Account the model of data collection which is driven by time can be used here that is called Periodic. A novel reading for all time slots individually s is captured by SN i. then, a new vector is shaped by SN i. the periodic sensing is shown in Fig. 3 [27].

Fig. 3.
figure 3

Periodic sensing of data in sensors node

2.5 Energy Update

As mentioned above that communication is the maximum energy consumption then must update the energy level of each sensor after sending data if greater than threshold continue, else exclude the sensor.

The model of consuming energy is illustrated in Fig. 4.

The energy by which can be under consumption via two parts: the transmission part and the reception part. The transmission’s energy needs more power for signaling amplification in accordance with its D where it sets off. Hence, for sending a packet of L-bit towards a point at distance equals D, the exhausted energy can be computed as shown in Eq. 2.

$${E}_{tx}\left(L,D\right)=\left({E}_{elec}\times L\right)+ {E}_{amp} {D}^{2}$$
(2)

where Eelec: Expended energy for the radio’s electronics, Eamp: Expended energy via amplifier [28].

Fig. 4.
figure 4

Radio unit of sensor node

3 Experiment Result

The experiment of our method used python language that is called custom python simulator to validate tis work. In this experiment a collection of temperature monitoring measurement data is collected online from sensors provided by Intel Berkeley’s research Laboratory. This type of data is used in many published papers that relate with WSN. The network implemented in this lab consists of x number of sensors arranged in single-hop topology, as illustrated in Fig. 5 .lab consist of 54 Mica2Dot sensors used for many environment monitoring such as light values, voltage, temperature and humidity, fitted in 35 × 45 m dimension as shown in Fig. 5. In our work temperature is selected for simplicity. Sensors capture the temperature data in lab every 31s.sensed data was compiled into 2.3 million readings as a log file which is utilized in proposed experiment. IEEE 802.15.4 can be utilized via a sensor like MAC protocol. The protocol here can be responsible for getting the interfering of sensors under control. The yellow flag within a few sensor nodes which is shown in Fig. 5 referring that the data of theirs are lost that lead to there are only 47 sensors are chosen and their data is used. The parameters values of our experiments are illustrated in Table 2 [29].

Fig. 5.
figure 5

(Intel Berkeley lab’s sensors deployment)

Table 2. Experiment parameters

In this work, four scenarios are introduced. First, is the flat network without clustering. An aggregator (BS) location coordinate (X, Y) is (17.5, 22.5) placed in the lab’s center. The sensor distributed there sends the data reading towards the aggregator, as shown in Fig. 6. Second, the clustering algorithm is used. The number of clusters K = 2 as shown in Fig. 7 . The SN sends its data to CH, then CH sends data towards BS. The D from SN towards BS can be decreased in this scenario. Third, Fig. 8 shows the number of clusters k is 3. The distance is reduced more than cluster k = 2. Last scenario is When k = 4 the distance is reduced more than k = 2 and 3 as illustrate in Fig. 9.

Fig. 6.
figure 6

(x, y) coordinate of sensors in lab

Fig. 7.
figure 7

(x, y) dimension of the lab

Fig. 8.
figure 8

(x, y) dimension of the lab

Fig. 9.
figure 9

(x, y) dimension of the lab

3.1 Data Sets Transmitted

In this section of the experiment, we use clustering technique on network without using any manipulation on the data, for this reason the data sensed by the sensor node are transmitted directly to the BS in the flat network.

3.2 Energy Consumption

The goal for this section can be considered as demonstrating the how our technique can decrease the energy consumption.

The figure below highlights sensor node energy consumption, sensor number and the energy consuming of networks. The consuming of energy is measured by joules when sensor reading measurement (M = 20) in the flat network (black-line) and the network with number of clusters k = 2 is blue - line, k = 3 is red - line, and k = 4 is green-line. It clears that SN energy consumption is 0.00 into 0.25 J while Network energy consumption is 0 into 5 J (Fig. 10).

Fig. 10.
figure 10

Network and sensors energy consumption (Color figure online)

Figure 11 illustrates the sensor node energy consumption, number of sensors and network energy consumption. The energy consumption in joules when the sensor reading measurement (M = 25) in the flat network (black-line) and the network with number of clusters k = 2 is blue - line, k = 3 is red - line, and k = 4 is green-line. It clears that SN energy consumption is 0.15 into 0.50 J while Network energy consumption is 0 into 14 J.

Fig. 11.
figure 11

Network and sensors energy consumption (Color figure online)

Figure 12 illustrates the sensor node energy consumption, number of sensors and network energy consumption. The energy consumption in joules when the sensor reading measurement (M = 100) in the flat network (black-line) and the network with number of clusters k = 2 is blue - line, k = 3 is red - line, and k = 4 is green - line. It clears that SN energy consumption is 0.02 into 1.2 J while Network energy consumption is 0 into 27 J.

Fig. 12.
figure 12

Network and sensors energy consumption (Color figure online)

We calculate energy saving for all scenario as shown in Eq. 3, and the enhancement of the energy saving in Eq. 4 for all scenario as well.

$${E}_{sav}\%=\left(\frac{{E}_{consum-clus}\times 100}{{E}_{consum-flat}}\right)$$
(3)

where \({E}_{sav}\%\) is energy saving, \({E}_{consum-clus}\) is energy consumption using clustering, \({E}_{consum-flat}\) without clustering.

$${E}_{enhans}\%=\left(100\%- {E}_{sav}\%\right)$$
(4)

Table 3 illustrates the number of clustering with data sensed measurement for all scenarios.

Table 3. Energy saving

Accuracy.

The accuracy indicates measure loss’ ratio, accuracy means the measure loss’ ratio after getting it in BS node. we use clustering technique on network without using any manipulation on the data. Data sensed are transmitted directly via sensor node towards BS in flat networks. Accuracy could be enhanced.

3.3 Life Time

Here, we can find an explanation for sensor node’s lifetime in flat network that represents in black-line. the clustering technique is used with the cluster number k = 2 as represents in blue - line, k = 3 in red - line, k = 4 with green - line and the sensor reading measurement M = 100. The same initial energy 0.2 J is used for all sensor node in network. The prolong life time of WSN is enhanced. As shown in Fig. 13.

Fig. 13.
figure 13

Network and sensors nodes lifetime (Colur figure online)

We calculate life time for all scenario as shown in Eq. 5, and calculate the enhancement in the life time also in all scenario as shown in Eq. 6

$${LT}_{sav}\%=\left(\frac{{LT}_{clus}\times 100}{{LT}_{flat}}\right)$$
(5)

where \({LT}_{sav}\) is life time of saving energy, \({LT}_{clus}\) is life time using clustering, \({LT}_{flat}\) is life time without clustering.

$${LT}_{enhans}\%=\left(100\%- {LT}_{sav}\%\right)$$
(6)

Table 4 shows the lifetime enhancement of clustering 2, 3, 4 with M = 100.

Table 4. Lifetime Enhancement

4 Conclusion

Energy Saving is main challenging issues in WSN. This paper, presents a k-mean clustering algorithm to enhance energy saving (ES) and prolong life time of sensor node in term of the packet of L-bit towards a point in a distance equals D. D from sensor nodes to BS is decreased here by dividing the region of interest into number of clusters. Each node transmits data into CH, then it transfers the data towards BS. Energy efficiency is improved as well. Custom Python simulator results show that our work increases energy saving from 14.43% in to 26.61% and the significant improvement of the lifetime of the sensor from 15.03% to 66.78%.

In future work, we plan to use one of the data compression algorithms after using the K-means algorithm to provide better energy efficiency and a longer network lifetime.