Abstract
The wireless sensor networks (WSNs) are characterized by several small nodes able to perform measurements on one or more parameters and to communicate with each other through several protocols. Most of home automation networks (depending on the specific application) are mainly characterized by periodic traffic flows. In soft real-time contexts, the main problem is represented by the efficient allocation of guaranteed time slots (GTSs) for periodic traffic flows transmission in IEEE 802.15.4 networks. Moreover, it is important to ensure adequate performance for those embedded devices competing for the access to the medium through the carrier sense multiple access/collision avoidance algorithm (CSMA/CA). The main aim of this paper is to show a new approach for network flows scheduling in home automation applications based on IEEE 802.15.4 wireless sensor networks. This work addresses several advantages due to the introduction of rate monotonic (RM) for guaranteed time slots (GTSs) allocation combined with priority-based CSMA/CA for latencies reduction on transmission attempts as clearly demonstrated by obtained results.
1. Introduction
In order to provide a detailed introduction to the issue, this section will be divided into three subsections. Section 1.1 specifically deals with wireless sensor networks for home automation systems, explaining the reasons which led to the choice of the IEEE 802.15.4 protocol. In Section 1.2, a general overview of the IEEE 802.15.4 protocol will be shown, placing emphasis on how it supports real-time communication using the guaranteed time slots mechanism. Finally, Section 1.3 will discuss the main motivations and aims of this research work.
1.1. Wireless Sensor Networks in Home Automation Systems
Wireless sensor networks are widely used in several application areas including data processing [1], industry [2–5] home automation [6–8], and road monitoring [9, 10] thanks to several characteristics like flexibility, adaptability, and scalability [11]. An automated house is the integration of embedded devices with other nonautomated systems such as lighting, heating, and air conditioning in order to realize smart applications for home control. The main aim of this integration is to provide greater comfort, safety, optimizing and the energy consumption. Wireless sensor networks are fundamental in home automation applications whose main requirements are quality of service (QoS) and real-time constraints satisfaction [12]. Most of the domotic systems, currently available on the market, use wired networks through different communication protocols like Ethernet [13], X-10 [14], Modbus [15], or Powerline [16]. Although their functionality and reliability have been proven over the years, some important disadvantages must be considered. For example, Powerline and X-10 use the existing power line but suffer of high error rates on poor quality lines affected by noise. Modbus and Ethernet require cables for both power and data transmission. This can be expensive in terms of implementation and maintenance costs as well as being aesthetically not very functional. WSNs represent the obvious solution to these problems because they consist of several low cost and low power devices. There are several protocols available for sensor networks like Bluetooth and IEEE 802.15.4 [17]. Through Bluetooth it is possible to connect up to seven active devices for each piconet and it uses frequency hopping (FH) and time division multiplexing (TDM) in order to regulate transmissions. Moreover, it is characterized by high power consumption. As a consequence, the IEEE 802.15.4 standard protocol is more appropriate for home automation applications.
1.2. The IEEE 802.15.4 Protocol
The IEEE 802.15.4 standard provides the physical (PHY) layer and medium access control (MAC) sublayer specifications for low data rate (up to 250 kbps in ISM frequencies, 2.4 GHz) wireless connectivity. According to the IEEE 802.15.4 standard protocol, a wireless sensor network can optionally operate in beacon-enabled mode (the more suitable for real-time traffic flows management). In this case, the time axis is divided into a sequence of superframes, each one delimited by special signaling packets (beacons). The beacons are transmitted by the PAN coordinator and are responsible for the synchronization of all network devices. In this operating mode, the superframe is divided into time slots and contains a contention access period (CAP) in which the multiple accesses to the channel are managed through the CSMA/CA algorithm. The superframe also provides a contention free period (CFP), in which certain stations can obtain access to the medium without collisions (in FIFO order) in special guaranteed time slots (GTSs), and an inactive period in which the radio interface can be put in a low energy consumption status in order to improve energy savings. Figure 1 shows the IEEE 802.15.4 superframe structure.

IEEE 802.15.4 MAC superframe structure.
1.3. Motivations and Main Aim
The use of wireless technologies in home automation networks needs the study and the implementation of new scheduling and QoS [18, 19] management mechanisms in order to meet real-time constraints. In fact, considering the IEEE 802.15.4 protocol, in contention access period the access to the medium is variable and unpredictable due to the backoff mechanism. In this work, we propose an approach based on the combined use of rate monotonic (RM) [20], for GTSs allocation in the contention free period, and a variation of the CSMA/CA algorithm for channel accesses management in the CAP based on traffic flows classification. The proposed approach can help in the development of home automation applications characterized, as known, by soft real-time constraints. The main aim of this work is to reduce the waiting time during access attempts to the radio channel of embedded devices improving, at the same time, network performance of home automated environments. Results, obtained through several measurement campaigns, show how differentiating traffic flows makes it possible to effectively improve performance in terms of throughput/workload (Th/Wl) on each embedded device and, in general, on the whole network. The paper is organized as follows. Section 2 reports the main literature works about approaches to improve IEEE 802.15.4 networks performance. Section 3 shows the considered network architecture, the proposed approach, and a probabilistic analysis about relationship between network throughput and the probability of each node to find the radio channel free. Section 4 proposes a test-bed scenario showing obtained results, while Section 5 summarizes the paper reporting conclusions.
2. Related Works
The IEEE 802.15.4 wireless sensor networks have been studied by researchers which evaluated several aspects. In order to cover the main issues, the related works section has been organized by topic areas. Our main aim is to take stock of the current situation about the various aspects of the issue object of this work and then to propose our improvements.
2.1. Home Automation Networks Applications Based on the IEEE 802.15.4 Standard Protocol
In the literature, there are several works focused on home and building automation, and many of them use the IEEE 802.15.4 standard protocol for wireless connectivity of sensor nodes. In [21], the deployment of wireless sensor networks and wireless systems applied to home and building automation systems is analyzed. Authors propose an in-house deterministic code based on 3D ray launching in order to analyze the effect of the indoor topology and morphology in the operation of wireless links within different realistic scenarios. Several simulations were performed in order to obtain performance parameters, such as RSSI (received signal strength indication) and PER (packet error rate). Simulation results show that the analysis of the topology of the wireless sensor network has a strong impact on complex indoor scenarios. The use of adequate radio-planning strategies, through the application of deterministic techniques in the planning phase, leads to optimal wireless network deployments in terms of capacity, quality of service, and energy consumption. The purpose of [22] is to demonstrate the use of IEEE 802.15.4 to provide real-time environmental information to a smart home simulator. In this work, the simulator itself and a brief technical introduction of the IEEE 802.15.4 standard are presented. Moreover, the authors analyze the reliability of IEEE 802.15.4 in a real home automation application. In fact, authors came to the conclusion that the IEEE 802.15.4 standard is very reliable and easy to implement in home wireless network scenarios thanks to the versatility and scalability of the protocol. In addition, an analysis on exposure levels to electromagnetic fields is provided. Using the IEEE 802.15.4 protocol, the exposure levels of electromagnetic radiation are very low, about 600 times lower than an ordinary cell phone. The authors of [23] describe the IEEE 802.15.4/ZigBee communication protocol, and they present its potential deployment in smart home environments. Some examples of prototype applications, in home security and automation using a ZigBee-based wireless sensor network, are presented. The authors made a comparison between the designed ZigBee-based wireless smart home system and other existing systems in market. A careful analysis on wireless architecture shows that sensors and communication devices, used for the deployment in smart home, are not required to have a high speed in communication capacities. The authors show how using the ZigBee network technology, as wireless communication standard, makes it possible to satisfy home automation networks requirements, because IEEE 802.15.4 allows to obtain robust mesh networks and complete interoperability. Instead, more studies are needed to limit the energy consumptions of devices, to improve the network scheduling mechanism, and to validate the coexistence of multiple protocols.
2.2. Energy Saving IEEE 802.15.4 Applications in Home Automation Networks
The need of smart energy management in home environments, for sustainable energy efficiency and monetary savings, is analyzed in several works. The authors of [24] provide a comprehensive summary of the state of the art in home area communications and networking technologies for energy management. The analysis shows that there are several wireless standards for home area networks, including IEEE 802.15.4, and, accordingly, the system designers choose the wireless technology that best fits their application. Moreover, the authors point out on the challenges dealing with the design of energy management systems, in terms of accuracy, compatibility, low power cost, and integration, in order to provide the guidelines for standardized and more user-friendly smart energy home automation systems. Energy management is also examined in [25]. This work introduces a novel home-energy control system design, based on ZigBee devices, that provides intelligent services for users. The authors implement the proposed system and demonstrate its potentiality using a real test bed. After an accurate analysis, the paper clearly shows that smart home control systems can provide significant cost savings in home environment applications. In this work, a specific dissertation about lighting energy reduction is done. In fact, by using an automated control system it could be possible to turn lights off based on several factors such as available daylight or time of day. Therefore, the use of wireless connections rather than wired networks involves several benefits in terms of flexibility and money savings. In order to meet home automation networks requirements, several aspects of the IEEE 802.15.4 medium access control (MAC) in contention access period (CAP), contention free period (CFP), and the overall cross period, respectively, are analyzed in [26]. An extensive discussion focuses on a variety of adaptive real-time protocols based on IEEE 802.15.4 and on many problems of wireless networks like high latency, system complexity, implementation overhead, and, mainly, great energy consumption. The authors come to the conclusion that the requirements of all aspects usually cannot be satisfied simultaneously. However, the network efficiency can be significantly improved optimizing the original specifications and dynamically adjusting the IEEE 802.15.4 protocol parameters. A home automation network architecture for energy management inside smart grid environments is presented in [27]. In order to achieve smart grid potential, the authors aim to resolve the problem of interoperability among different communications technologies deployed in the grid. The authors propose a framework for end-to-end interoperability in home and building area networks. This framework includes the 6LoWPAN protocol in order to simplify the use of IPv6 and ZigBee application profiles. The authors also focus on other issues, including interference mitigation and load scheduling, and they propose a solution to them. They propose a priority contention algorithm for high priority messages management, while, at the same time, the proposed approach uses a compression and scheduling mechanism in order to increase the efficiency of transferred data. Moreover, a frequency-agility-based interference mitigation algorithm is proposed in order to guarantee the performance of network protocols coexistence.
2.3. GTS Mechanism in Home Automation Networks
Wireless technologies in home automation applications need the development of new scheduling mechanisms in order to meet real-time constraints. A scheduling scheme, whose main aim is to obtain optimal parameters regarding the IEEE 802.15.4 frame and subframes in home automation networks, is presented in [28]. The proposed approach uses guaranteed time slots (GTSs) for transmission of real-time periodic traffic flows, since they can guarantee time constraints using the periodic delivery of beacon frames as provided by the IEEE 802.15.4 protocol. The authors consider a set of nodes requirements in an IEEE 802.15.4 network in order to define the beacon interval considering the required periods and the duty cycles. Moreover, the active subframe duration is chosen according to required bandwidths and to ensure energy saving. The authors show results in terms of throughput for different frame and subframes lengths. Numerical results show that frame and subframe duration and GTS's schedule can be determined in order to ensure an efficient use of the network resources. Several works on the GTS aim at increasing utilization and reducing the waste of bandwidth. Anyhow, using IEEE 802.15.4 standard protocol, the GTS does not guarantee the reliable transmission in multihop networks. For this reason, GTS mechanism is also analyzed in [29] where authors propose and implement a multihop GTS mechanism for reliable transmission in multihop networks. After a discussion on the reliable transmission in multihop networks, the authors present simulations results. In fact, several simulations have been carried out through NS-2 simulator, and results show that low end-to-end delay and high delivery ratio can be checked. Therefore, thanks to these features, the proposed mechanism is especially suitable for delivering time-sensitive data. In [30], a preliminary solution for the transmission of real-time time-triggered traffic over the IEEE 802.15.4 standard in a home automation environment with real-time requirements is shown. Authors define the design solutions focusing on GTSs transmission and reception for time-triggered traffic with real-time requirements. The proposed approach can be useful for infrastructure-to-vehicle and vehicle-to-vehicle communications and home automation applications supporting life monitoring. The authors focus their future works in peer-to-peer topology because, in this case, a device can communicate with any other device and, furthermore, several coordinators may exist. The peer-to-peer topology has the advantage of increased coverage area but it involves increased message latency and nodes synchronization.
2.4. Coexistence of IEEE 802.15.4 with Other Communication Protocols in Home Automation Networks
Several works in the literature analyze the coexistence of IEEE 802.15.4 with other networks protocols in home automation applications. In [31], a tunneling solution that allows running KNX/EIB over IEEE 802.15.4 links is presented. The authors analyze wireless sensor and actuator networks as an alternative to wired solutions in the home and building automation domain because several technologies that fulfill the specific requirements of this class of wireless networks have reached commercial status. The approach proposed by authors emulates the properties of the KNX/EIB wired medium via wireless communication, over an IEEE 802.15.4 network, allowing a seamless extension. Moreover, this novel architecture provides a basic level of communications security using a shared key through standard IEEE 802.15.4 security mechanism. As future works, the authors aim to a better evaluation of proposed approach performance, in terms of the effects of contention occurring on the tunneling medium. The use of 6LoWPAN and IEEE 802.15.4 protocols has been presented in [27], while 6LoWPAN, IPv6, and IEEE 802.15.4 protocols are also used in [32]. The authors propose a prototypical implementation of a home automation network that uses IPv6 over 6LoWPAN to control home applications. The proposed implementation is based on an embedded web server which, connected over a low-power IEEE 802.15.4 network, provides the ability to remotely open and close an electric door lock. Through this architecture, it is also possible to control other electronic consumer devices such as heating, air conditioning, lighting systems, and many others. The use of the proposed approach can offer many benefits for energy conservation, and, at the same time, it can involve new usage patterns in home automation applications, such as assisted living or smart grids. In [33] the development process of a smart home network is presented based on IEEE 802.15.4/ZigBee technology with the combination of SAANet, a smart home appliance communication protocol. The SAANet protocol aims at solving the data recognition between different types of devices because most of ZigBee devices profiles were not built completely. Therefore, the combination of ZigBee and SAANet protocols can be a solution to solve several problems. The integration between the two protocols has been successfully applied in order to achieve a supervisory home control system. The approach proposed by authors implements the functions of entrance control, temperature and humid sensing, and appliance control. A methodology to measure and avoid WiFi interference while deploying and installing ZigBee-based products in a home automation architecture is introduced in [34]. A detailed analysis shows that ZigBee products can successfully withstand interference from microwave ovens and Bluetooth devices but they are still vulnerable to high load WiFi traffic. Anyhow, the authors come to the conclusion that ZigBee can coexist with WiFi in a typical home environment if several preventative measures are taken into account. The recommendations to avoid WiFi interference, that authors derived experimentally, are to place WiFi router no closer than 5 meters of window shutters, and, moreover, it would be appropriate to use a frequency offset of at least 20 MHz between ZigBee and WiFi. However, other factors, such as traffic type, might also affect the performance of a system under WiFi interference. In future works, the authors focus on a more thorough study, taking into account these factors and using real user traffic instead of synthetically generated traffic.
3. The Proposed Approach
In this work, a two-tiered architecture in home automation environment (Figure 2) is shown. The first tier is characterized by a WSN in which devices are organized in home cells (HCs). Each HC is managed by a PAN coordinator that provides several modules.
Ethernet module: it is the interface through which it is possible to establish a wired connection between each home cell and the real-time Ethernet backbone. The IEEE 802.15.4 module through which the PAN coordinator receives and processes data detected by its home devices (HDs). Scheduling module: this module is a quality of service (QoS) manager for real-time (RT) communications and dynamically decides transmission priorities of HDs using an approach based on rate monotonic (RM) and priority-based CSMA/CA (PB).
As already said, main system devices are home devices (HDs) and PAN coordinators. Each HD sends data acquired to its PAN coordinator and can be either an IEEE 802.15.4 reduced function device (RFD) or a full function device (FFD) in a clustered network. This paper addresses several advantages in the use of a novel intracell scheduling approach combined with the use of CSMA/CA-PB. The PAN coordinators are responsible for data transmission of their associated nodes and for scheduling traffic decisions within their respective home cells.

Network scenario.
The intracell scheduling in this architecture is realized through the preallocation of guaranteed time slots to devices involved in transmissions of periodic messages through the RM scheduling algorithm [20]. The GTS list contains the addresses of all devices interested to transmit. Each device will wait its turn according to its address position in the GTS List and then it will transmit using its allocated GTS. In case of high workloads or high number of nodes, it is possible to use the CSMA/CA-PB. The use of GTSs, allocated with RM, guarantees a deterministic allocation of slots. Consider
a set of messages online scheduling; nonpreemption.
Rate monotonic and earliest deadline first (EDF) [20] produce the same schedule. Under these assumptions, we could also use the EDF algorithm. Figure 3 demonstrates how 7 messages, each with
Scheduling parameters.

Set of messages scheduled at the same way with EDF and RM.
It is important to remind that in case of RM algorithm, the schedulability is guaranteed if
It is also possible to have a guarantee about messages schedulability, in accordance with deadlines, through the known Jeffay's theorem [20]. A set of periodic requests (messages) is scheduled using a nonpreemptive algorithm if two conditions are met. The first equation (1) relates to system utilization (in terms of bandwidth, as we are dealing with the transmission of packets), whereas the second equation (2) refers to the system demand.
Theorem 1.
A system can schedule a set of periodic requests using nonpreemptive EDF algorithm if Jeffay's conditions ((2) and (3)) are met:
The periodic traffic flows are represented by a set of periodic variables
Equation (3) relates to the system utilization (in terms of bandwidth, as we are dealing with the transmission of packets), whereas (4) refers to the system demand. Equation (3) defines that total bandwidth utilization must not exceed 1; CW (contention window): it is the contention window length, in other words, the number of backoff periods during which it is necessary to listen to the channel before the transmission. BE (backoff exponent): it is the variable that determines the number of backoff periods the device shall wait before channel access attempts.
The number of waiting periods (CW) is a random number inside the range [0,
In home automation environments, the coexistence of different traffic types must be taken into account. In order to define the priority class, BE and CW variables of the CSMA/CA have been used. BE has been considered as a variable in the range
Priorities classification.
These values must be set on each HC's node in order to define the priority of each device. The choice of contention window and backoff exponential determines nodes transmission frequency. High-priority nodes will listen to the channel more frequently and with higher probability of transmission success. Clearly, this approach does not resolve the nondeterminism of the wireless channel but significantly reduces latencies of nodes involved in the contention access to the channel.
3.1. Probabilistic Analysis of IEEE 802.15.4 Transmissions through CSMA/CA-PB
Another aspect considered and proposed through this paper concerns the relationship between the probability that a station finds the channel free and the network throughput varying CW and BE parameters. As already proposed by several works in the literature [35–37], the CSMA/CA algorithm can be modeled through an M/G/1 queue. Consider
n: the number of nodes associated to a PAN coordinator; N: the total number of network nodes (associated and not); λ: packets generation rate (according to a poisson process); Wl: network workload; σ: backoff slot duration.
The probability (α) of channel busy during the contention window CW, the packet loss probability

Transmission probability estimation.
It is easily observable that the transmission probability of low priority nodes is slightly better than the standard, while medium and high priority nodes have a higher transmission probability.
4. Performance Evaluation
Performance of our approach has been tested through a real experimental scenario implemented using IRIS MTS300 [38] and MTS300 boards from Crossbow/Memsic and taking into account requirements of an IEEE 802.15.4 network described in [39]. Tests have been conducted on a star topology network with 9 RFD devices (HD) and a gateway (PAN coordinator). In particular, 3 “high priority” nodes, 2 “medium priority” nodes, and 4 “low priority” nodes have been considered as shown in Figure 5.

Test-bed scenario.
Varying CW and BE parameters, 4 case analyses have been identified, as better explained through Table 3.
Nodes priorities classification cases.
Case 1.
Consider the following:
high priority nodes → medium priority nodes → low priority nodes →
Figures 6 and 7 show performance obtained in Case 1. Figure 6 shows how higher priority nodes are characterized by throughput/workload (Th/Wl) values higher than nodes with lower priority. On average, high priority nodes obtain better performance with the use of CSMA/CA-PB than the standard. This is due to the fact that they have higher probability to transmit. In other words, they have a high reduction of waiting times during radio channel accesses attempts. On the contrary, lower and medium priority nodes measure values lower than the standard because for them

Case 1: Th/Wl measured on each node.

Case 1: Th/Wl results for priority classes.
Case 2.
Consider the following:
high priority nodes → medium priority nodes → low priority nodes →
Figures 8 and 9 show performance obtained in Case 2. Figure 8 shows Th/Wl values measured on each node. Even in this case, higher priority nodes reach throughput/workload (Th/Wl) values higher than nodes with lower priority. But, it is possible also to see that even medium priority nodes obtain better performance through our approach. At the same time, differences in results, between CSMA/CA-PB and the standard, decrease also for low priority nodes. Figure 9 shows improvements in terms of Th/Wl classified for priority classes. Using a priority classification of traffic flows, the obtained Th/Wl of the whole network is higher than the standard and, in this case, even the Th/Wl measured by all low priority nodes is better than the standard.

Case 2: Th/Wl measured on each node.

Case 2: Th/Wl results for priority classes.
Case 3.
Consider the following:
high priority nodes → medium priority nodes → low priority nodes →
Figures 10 and 11 show performance obtained in Case 3. Figure 10 shows Th/Wl values measured on each node. Even in this case, higher priority nodes reach throughput/workload (Th/Wl) values higher than nodes with lower priority. Just nodes 1 and 3 measure the worst performance than the standard. This is due to the fact that the traffic flows classification, based on priorities, supports a more frequent transmission of messages with higher priority, resulting in a slight increase of waiting times for some nodes having medium or low priority. Figure 11 shows improvements in terms of Th/Wl classified for priority classes. Results clearly show how, using the proposed algorithm, the Th/Wl ratio of the whole network is higher than Th/Wl obtained using the standard algorithm. As already explained in Figure 10, the Th/Wl obtained by all low priority nodes is lower than the standard because they can transmit with lower frequency.

Case 3: Th/Wl measured on each node.

Case 3: Th/Wl results for priority classes.
Case 4.
Consider the following:
high priority nodes → medium priority nodes → low priority nodes →
Finally, Figures 12 and 13 show performance obtained in Case 4. In particular, Figure 12 shows Th/Wl values measured on each node. Even in this case, higher priority nodes reach throughput/workload (Th/Wl) values higher than nodes with lower priority. This case study produced best performance results. In fact, just node 3 obtained the worst performance, and generally, even low priority nodes obtained better performance than the standard algorithm, as it is possible to see through Figure 13.

Case 4: Th/Wl measured on each node.

Case 4: Th/Wl results for priority classes.
5. Conclusions
In this paper, a novel scheduling mechanism for periodic traffic flows management has been proposed in order to support the development of home-automated networks. The main aim is to reduce latencies of channel access attempts of network embedded devices in home automation applications. This new approach, called rate monotonic + CSMA/CA-PB, provides the preallocation of guaranteed time slots (GTSs) through the rate monotonic algorithm for those devices which want to transmit periodic messages. As known, the standard algorithm provides a FIFO allocation of GTSs. Moreover, this approach reduces waiting times of nodes competing for the medium access using the CSMA/CA in contention access period through a priority classification of network traffic flows. An experimental real scenario, based on the IEEE 802.15.4 standard protocol, has been deployed in order to demonstrate benefits introduced by this approach. Varying the contention window (CW) and the backoff Exponential (BE) parameters, it has been possible to produce a traffic flows classification based on priorities. Obtained results show how high priority nodes will reach better performance than those with lower priority. Measured performances are generally better than the IEEE 802.15.4 standard that does not differentiate network traffic flows.
