## 4 Experiments
### Experimental Testbed
Death of sensor node was detected each time the sensor node has consumed a predetermined amount of energy (3500 mWh). This approach has ensured repeatability of the conducted experiments. The considered WSN was designed for indoor detection of moving objects, e.g., people passing through a corridor in a building. Therefore, each sensor node was equipped with a light sensor [36], which converts the lighting level into a proportional value of the voltage at its output. This  
Figure 3: Part of experimental testbed for one sensor node. voltage is then measured through one of the ADC (Analogue-to-Digital Converter) channels of the microcontroller. An example of lighting level measurement is shown in Figure 4. It should be noted that the designed sensor nodes recognize important events as significant changes in the voltage level at the light sensor output. To be detected as event, the registered changes must be above a threshold, which is determined dynamically by using a moving average filter [37]. Determining the threshold in this way guarantees correct detection of objects in various lighting conditions. The moving average filter is used with time window of 100 samples. The smart sensor nodes were programmed to perform the algorithms presented in Section 3.2. In this implementation, one step of the WSN operation corresponds to 0.5 s. It means that the sensor data are collected, event occurrence is verified, and result is reported to the sink two times per second. This enables detection of fast-moving objects. For detailed evaluation of the proposed CH rotation algorithm it was necessary to conduct experiments with various probabilities of event detection by particular sensor nodes. It would be difficult to control the light intensity to achieve a desired probability of event detection. Therefore, a function was programmed, which allows the sensor nodes to randomly generate the events with a given probability. IAs a result, the smart sensor node performs transmission when an event is randomly generated. If no event is generated then the data transmission is suppressed. The simple suppression procedure does not require any additional parameters. This approach has significantly facilitated the experimental evaluation. During tests of the elaborated WSN it was observed that increased energy consumption is caused by retransmissions that occurs in case of incorrectly synchronized sensor nodes. It should be noted that the cluster members send data to CH node according to TDMA schedule and their timers need synchronization to avoid transmission errors due to collisions. Moreover, if cluster member is not correctly synchronized their messages can be not received by the CH node. In such situations, when frame transmission is not finished successfully, the xBee modules perform retransmissions. The impact of synchronization period on energy consumption by sensor node is illustrated in Figure 5. The results presented in Figure 5 were obtained for two synchronization periods: 5 min and 10 min. In the first case the CH node consumed 265 mWh of energy on average, while cluster member used 189 mWh. After extending the synchronization period to 10 min, the average energy consumption increased to 268 mWh for CH node, and to 195 mWh for cluster member. The sensor nodes consume less energy when the synchronization is performed every 5 min since in this case fewer retransmissions are necessary. The number of retransmissions is reduced as the sensor nodes are better synchronized and send their data in the TDMA slots allocated to them, exactly when the CH is waiting for the data. In case when the synchronization is performed every 10 min, the number of transmissions executed out of the specified time slots increases at the last phase of the synchronization period. Such transmissions cannot be completed correctly and the data are retransmitted at the next opportunity. Based on these results, a short synchronization period was used in further experiments.