# Wireless Sensor Networks for Smart Homes:
## 1 Introduction
For instance, several protocols, such as the IEEE 802.15.4 standard [38], regulate the wireless communication of short-range, low-data-rate, and low-power devices. It specifies two working forms: active and sleep. Nodes are active only when they have to communicate, or they presume to accept data. Contrarily, they start the sleep mode, and they switch off their modules to preserve power. At the application layer, regulating the sampling time, i.e., the rate of the environment measurements [39; 40], can influence the network lifetime. A high sampling time decreases the energy consumption since few measures are expected, but it also penalizes the reactivity and effectiveness of the WSN, due to the latency in recognizing environmental variations. The adjustment of the sampling time influences also on the data link layer [41; 42], because a node can sense the environment only during the active state. This paper introduces a solution based on fuzzy logic to cope with the energy consumption issue in battery-powered devices composing a WSN for smart homes. In detail, regarding the duty cycle, the sleeping time of network nodes is dynamically adjusted by a Fuzzy Logic Controller (FLC). It is useful to note that the approach proposed in this work is an extension of the excellent solution presented in [43]. In this paper, not only a different type of membership function is used in the FLC but, mainly, the target here is to realize a practical method that reaches the goal while avoiding difficult and computationally costly solutions, such as the Particle Swarm Optimization (PSO), which would decrease the possible applicability of the procedure in real situations. The objective is to develop a proof-of-concept implementation on off-the-shelf devices, highlighting that the suggested method does not demand compelling hardware and can be openly realized on low-cost devices. The application scenario represents another difference. An Industrial WSN is considered in [43] while a WSN for smart homes is regarded in this work. It is well-known that both scenarios have different requirement concerning the duty cycle of battery-powered devices composing the wireless network. Fuzzy logic has been chosen even in this paper because the use of rule-based FLCs expedites the development of multi-criteria control policies [44; 45]. Fuzzy logic can perform real-time settlements even with incomplete information while other common control systems are based on a precise characterization of the environment. Considering that fuzzy-based systems can quickly examine the linguistic rules, they can be expressly applicable in numerous scenarios, such as WSNs employment, including smart homes. For instance, the adoption of smart tuning and setting methods for FLCs can increase the energy preservations in a WSN. As a consequence, the FLCs can be the appropriate option to represent a procedure for energy saving to lengthen network's lifetime. In this research field, a fuzzy logic system is introduced in [46] whose goal is to preserve the battery life of WSN nodes and to produce an active sensing network. The FLC suggested in [46] assists efficiently to ascertain the on/off state for active/sleep mode of sensor nodes. Simulation results prove that the proposed system is energy efficient. Considering that, usually, in a WSN most of the energy is spent in data communication to the sink and that, in recent years, several researchers have offered mobile sink methods to lessen the energy consumption, the authors of [47] present an approach in which a fuzzy-based mechanism administers the movement of the sink. Simulation results are compared with a method having a stationary base station, and results emphasize that the strategy recommended by the authors reduces the energy consumption and, thereby, enhances the lifetime of the WSN. Another approach, based on a distributed fuzzy logic control method, is offered in [48]. This fuzzy logic engine is developed on each node of the wireless network to decrease the number of message transmissions.