# Node Injection Control Logic Design for Intelligent Home System Based on Wireless Sensor Network

Authors: Zhenggui Zhou
Journal: Journal of Sensors
 (2022)

---

## Abstract

Smart home is a building, network, communication, automation, set management, and service, as one of the efficient, comfortable, safe, and environmental protection of the living environment, and can provide personalized living space according to the needs of different users. Due to the advantages of wireless sensor network (WSN), such as strong expansion ability, strong communication ability, and strong self-organization ability, the smart home system based on WSN has become the main development direction in the field of smart home. This paper analyzes the different functions and features of wireless sensor network routing protocol and use scope, aiming at the application layer, using the MQ queue enhance server concurrent processing capacity and system scalability and design based on application layer gateway and terminal node “data matching list,” which are introduced in the design of smart home system based on geographic information location energy-efficient routing protocols. The solution of routing void problem is improved by using information feedback mechanism and alternate nodes. Simulation results show that this method can improve the energy saving of energy-efficient routing protocol. Finally, the intelligent home system experiment platform was built to verify the overall function of the system, and the communication function of the WiFi network and ZigBee network was tested. Based on the analysis of the interference between ZigBee and WiFi network, frequency agility algorithm is used to solve the problem of the same frequency interference, so as to ensure the performance of the system to meet the needs of the smart home system.


---

## Body

## 1. Introduction

One of the most important design intentions of smart home system is to create a more convenient and modern living environment and working environment for families in real life. But the previous intelligent home environment control system generally has wiring links, and the wiring process not only is often more complex but also greatly increases the cost. Therefore, the technology based on wireless multipoint sensor network arises at the historic moment. This technology simplifies the design and deployment of traditional work implementations and reduces the overall cost of the system.At present, intelligent home has mastered this system design technology, and this technology also presents a relatively rapid development trend. But from the overall situation, on the one hand, the domestic intelligent home system industry is still in a rapid start stage, and the main manufacturers of intelligent home system products are not basing on the production and operation of intelligent home but also has not fully reached a large-scale production level. On the other hand, as wireless sensor network technology is in the process of rapid progress, some residential developers begin to plan and build more cost-effective intelligent home buildings [1]. For example, in some high-end residential areas, the internal control and management are mainly intelligent, which is the concrete embodiment of intelligent home in commercial residences.For smart home system, its characteristics are to make full use of advanced computer technology, wireless sensor network, and other modern technology, all kinds of smart home equipment connected, in order to create a more convenient and appropriate smart home way for people. At present, the more traditional intelligent home environment control sensor system is generally the basic way of wired control, but the installation process and maintenance cost of the whole system is often relatively high and there is a possibility of mobile application after being fixed. By introducing and applying the advanced technology of wireless sensor network (WSN) to the smart home, the overall situation of the smart home environment can be detected and automatically controlled, and the smart home system based on WSN technology can be established.


## 2. Related Work

Due to the high cost of the implementation scheme of wired smart home, the complexity of installation, and the inconvenience of late upgrade, it is not conducive to the promotion of smart home products. With the development of Internet of Things technology, cloud computing technology, WiFi, ZigBee, Bluetooth, and other wireless communication technologies, smart home begins to develop towards the direction of wireless system [2, 3]. The utilization rate of WiFi and Bluetooth technology is relatively high, but the power consumption of WiFi is large, and it cannot realize ad hoc networking, and network capacity is small. Bluetooth transmission can only be in the form of point to point, which cannot realize convenient automatic networking. Smart home system takes advantage of ZigBee technology in low power consumption and ad hoc networking and adds various sensors to realize the environmental monitoring of smart home system. At the same time, the intelligent home furnishing system ControlW designed in the United States also uses ZigBee technology [4]. At present, many semiconductor manufacturers in the market are developing their own ZigBee products for application in smart home system. Currently, the mainstream ZigBee suppliers include TI [5].Wireless sensor network and wireless communication technology monitor a variety of devices and monitoring targets in the form of self-grouping and multihop. At the same time, embedded processing technology can also carry out real-time analysis and processing of these monitored data, which has very broad application prospects [6]. With the development of the times, people’s quality of life continues to improve, and the intelligence of smart home is becoming higher and higher. Smart home has become the focus of discussion and research. At present, the smart home-related applications in the market are mainly connected by wired network, which not only has high cost and troublesome wiring but also may not be able to be connected by wired network under certain conditions when the number of node devices increases exponentially [7]. In some remote mountainous areas in the wild, the inconvenience caused by this networking mode will be more obvious. Through the integration of wireless sensor network and wireless communication technology, the shortcomings of wired network are effectively solved. Due to the development of science and technology, the research subject of intelligent home is further upgraded [8]. In recent years, the smart home industry in such a background in the continuous rapid development, as a very promising smart home industry, not only attracted many technology research and development companies to join the smart home industry but also increased the competition in the intelligent industry. HomeKit smart home platform was launched, through which iPhone, iPad, iWatch, and other user devices can be managed and controlled to support HomeKit framework smart home devices [9]. After the smart home device is paired with the iOS, you can control the smart accessories through commands, for example, “turn on the TV” or “turn off the TV,” “set the temperature to 20 degrees,” and “turn on the coffee machine” [10].The domestic smart home industry has realized that foreign smart home is not suitable for domestic residential environment and reversed the closed development situation of smart home [11, 12]. Foreign smart home systems mainly adopt bus control schemes, while wireless communication technology is widely used in China to meet the expansibility and practicability of Chinese residential buildings through wireless communication technology. Wireless communication technology has become an inevitable trend of the development of smart home systems in China [13]. Although the products of wireless smart home have the characteristics of flexible application, the early smart home system based on wireless communication in China also has defects, and the problems mainly focus on networking ability. This situation was gradually solved with the emergence of ZigBee and Z-Wave technologies, both of which are short-range wireless communication technologies. In addition to their cost and implementation advantages [14], their important technical characteristics are able to realize highly reliable self-organizing network, and the system can achieve rapid expansion through wireless communication technology. It not only meets the technical requirements of residential buildings but also meets the expandability requirements of smart home systems. The main feature is the intelligent home system and Internet technology highly integrated and very comprehensive function. A control platform with WiFi gateway as the core realizes a variety of application functions [15], including home security function, remote meter reading function, information release function, access control function, visual intercom function, and remote monitoring of home appliances. Through this smart home control platform, users can be provided with a variety of safe, comfortable, efficient, information-based, and other new services [16]. A series of monitoring products and advanced control modes have been developed. Engineering construction personnel can even complete their work in a few hours. Customers can flexibly configure the system according to their personal needs to adapt to their own lifestyle; intelligent household system has a very extensive application [17, 18].At present, the market of middle and high-end smart home is maintaining steady development, but there are still some key technical problems to be solved, summarized, and analyzed as follows. Industry standards are not yet fully formed. At present, there are many high-end smart home manufacturers in China, so the products they produce are also diverse, which makes high-end smart home not have good compatibility [19]. Relevant departments have a certain degree of understanding deviation in the development of smart home system, which will be difficult to integrate industry standards, thus bringing great resistance to the promotion and application of domestic products. The product does not meet the needs of users. Usually, household users tend to focus more on a product that has practical function, but for some special functions, the home users do not need to use them in the short term, indicating the function of redundancy at the same time; in the current existent products, the use of most products process is too complex and did not reflect the practical and humanized application characteristics. After-sales support needs to be improved. From the design of smart home, the system is a very complex use system, although there is integration of many different technical means, but in the process of practical application, if it is used in an unreasonable way, it is likely to cause system damage and unable to be used in the situation. In addition, the maintenance process of the system is usually more troublesome, so manufacturers need to improve the quality of their after-sales service for users and the construction of after-sales guarantee system. High attention should be paid to network security. Since smart home devices usually realize remote control operation of home through the Internet of Things, security risks will also occur in smart home systems if there are security risks in the Internet of Things network. This is a problem that enterprises should attach great importance to.Wireless sensor network (WSN) has been widely used in many fields such as safety monitoring, disaster monitoring, intelligent transportation, agricultural production, environmental monitoring, and medical monitoring due to its strong scalability and self-organization ability. One of the main application directions is the field of smart home. At present, many universities and research institutes at home and abroad have carried out research on smart home system based on wireless sensor network. The paper [20] discusses the key technologies that need to be realized for the smart home system based on wireless sensor network. The paper [21] designs and implements the smart home monitoring system based on embedded Linux system. Thesis [22] studied ZigBee intelligent home system based on IEEE802.15.4 protocol. In this paper [23], Bluetooth protocol version 4.0 is applied to wireless information transmission of smart home system, and a low energy consumption smart home sensor network is designed. The paper [24] studies the wireless smart home system based on the combination of WiFi and ZigBee technology. The paper [25] introduces the concept of cloud computing into smart home system and puts forward the concept of a new smart home system based on cloud environment. In this paper [26], a smart home system is designed, which includes ZigBee wireless sensor network, smart home gateway, and mobile phone terminal. Through the smart home gateway, the working status of each sensor can be intuitively grasped, and the remote control of terminal nodes can be realized by using mobile phone terminals. In combination with the Android operating system and the control principle of home appliances, the paper [27] proposed a scheme to control home appliances through WiFi using smart phones. These studies will be successfully applied to wireless sensor networks in smart home system and achieved good results; therefore, to say the smart home system based on wireless sensor network (WSN) is a research hotspot in the field of smart home at home and abroad, the research on the smart home system based on wireless sensor network (WSN) has the vital significance.


## 3. Overall Structure Design of Smart Home System Based on Wireless Sensor Network

### 3.1. Basic Structure and Main Function of Intelligent Home System

A typical intelligent furniture terminal has three parts, the main core control equipment, communication network, and application terminal. Making all home appliances an intelligent equipment is the most important task of intelligent home. Through the smart home system, people can live according to their own living habits, and through communication equipment to the home appliances, real-time tracking monitoring, which makes our home appliances more intelligent, of course, also can better serve the human. For example, before work, through mobile phone equipment and GPRS communication means to start the air conditioning at home in advance, a home can enjoy the comfortable temperature, can advance to the electric rice cooker and other appliances for timing, and allows you to get up after porridge and coffee have been ready for you. When you turn on the TV, the brightness of the lights automatically decreases. When your home phone rings or you are ready to make a call, the TV will automatically go silent, as shown in Figure1.
(1)
Core control equipmentFigure 1
Basic structure of smart home system.The core control device is the core part of the smart home system. Its main function is to collect the device status information reported by the terminal sensor nodes, perform basic automatic control operations, report the summarized and processed information to the user-controlled mobile control terminal, and control the operation of the device according to the received commands.(2)
Wireless sensor networkIn Figure1, the reliability, security, and rapidness of the transmission of control commands on the home network are the main criteria for the selection of smart home wireless sensor network. According to the actual needs of smart home system, wireless sensor network is mainly used to transmit home control commands in the home network of smart home system. Wireless sensor network (WSN) nodes in home networks should be small in size and flexible on the basis of meeting the basic functional requirements. To sum up, smart home system wireless sensor network nodes should have the characteristics of low cost, low speed, low power consumption, small size, and high flexibility. ZigBee is a short-range, low-cost, low-power wireless communication technology, which is characterized by self-organization, short-range, low complexity, and low data rate. ZigBee is a low-power individual domain network protocol based on IEEE 802.5.4 standard. It can be embedded in portable electronic products and is suitable for automatic control and remote control.
(3)
Application terminalApplication terminals mainly refer to household devices deployed with wireless sensors, such as refrigerators, air conditioners, and other household appliances, video intercom, access control systems, and other security devices, which are connected to the core control device through the communication network and complete the work by receiving instructions from the core control device.


### 3.2. Characteristics of Wireless Sensor Networks

Combined with the WSN system structure in Figure2, the wireless sensor network is further described. Firstly, wireless sensor network is a set of distributed network system, which requires that each network node in the system has independent computing capability in addition to network communication capability. When multiple nodes gather together, they can cooperate in computing processing tasks. Secondly, the nodes in the WSN system have the ability to sense the physical and chemical indexes of monitored objects through sensors or other external devices. Finally, wireless sensor network is an open network, the system itself can dynamically manage nodes, and information exchange is done with Internet and task management nodes through the system sink node, forming the so-called M2M technology.Figure 2
WSN system structure.In wireless sensor networks, according to the different functions of devices in network management, they can be divided into gateway device, routing node, and terminal node. The functions of the three are as follows: gateway device is the cluster head of the whole network, responsible for managing address allocation, security keys, information exchange, and application management; the main intelligence of routing devices is network management. Terminal nodes interact with gateway devices through routing devices, which solves the bottleneck of communication distance and energy consumption of terminal nodes. Terminal node is the end of the network system, mainly for information collection and task execution.Smart devices such as air conditioners and televisions can be combined with wireless sensor networks in two ways: (1) smart home appliances are equipped with data transmission interfaces such as serial ports and E2C, which are connected to wireless sensor network nodes to realize the interaction between devices and nodes; (2) smart devices have embedded wireless sensor network transceiver modules such as CC2420. In this case, users do not need to purchase additional wireless sensor network terminal nodes. However, this approach increases the burden of home appliance manufacturers; on the one hand, it increases the expenditure of transceiver module; on the other hand, it increases the product development cycle, because the device requires that the protocol stack can be burned to accommodate various wireless sensor network protocols. Users do not want to and should not interfere too much in the wireless sensor network topology:(1) users should not be affected by network reasons; for example, multiple nodes with linkage function should not be placed in adjacent areas; (2) try not to require users to install nodes with different functions on different devices for network topology reasons; (3) when some nodes fail, the network topology adapts to changes and users cannot be required to replace the faulty nodes in time; (4) users should not be required to open or close terminal nodes frequently due to security problems, let alone the home gateway.Wireless sensor networks applied to smart home must have the following characteristics: (1) network adaptation; (2) device peer (except gateway); (3) the network supports multihop and point-to-point communication; and (4) have network level or even point-to-point level security certification.


## 3.1. Basic Structure and Main Function of Intelligent Home System

A typical intelligent furniture terminal has three parts, the main core control equipment, communication network, and application terminal. Making all home appliances an intelligent equipment is the most important task of intelligent home. Through the smart home system, people can live according to their own living habits, and through communication equipment to the home appliances, real-time tracking monitoring, which makes our home appliances more intelligent, of course, also can better serve the human. For example, before work, through mobile phone equipment and GPRS communication means to start the air conditioning at home in advance, a home can enjoy the comfortable temperature, can advance to the electric rice cooker and other appliances for timing, and allows you to get up after porridge and coffee have been ready for you. When you turn on the TV, the brightness of the lights automatically decreases. When your home phone rings or you are ready to make a call, the TV will automatically go silent, as shown in Figure1.
(1)
Core control equipmentFigure 1
Basic structure of smart home system.The core control device is the core part of the smart home system. Its main function is to collect the device status information reported by the terminal sensor nodes, perform basic automatic control operations, report the summarized and processed information to the user-controlled mobile control terminal, and control the operation of the device according to the received commands.(2)
Wireless sensor networkIn Figure1, the reliability, security, and rapidness of the transmission of control commands on the home network are the main criteria for the selection of smart home wireless sensor network. According to the actual needs of smart home system, wireless sensor network is mainly used to transmit home control commands in the home network of smart home system. Wireless sensor network (WSN) nodes in home networks should be small in size and flexible on the basis of meeting the basic functional requirements. To sum up, smart home system wireless sensor network nodes should have the characteristics of low cost, low speed, low power consumption, small size, and high flexibility. ZigBee is a short-range, low-cost, low-power wireless communication technology, which is characterized by self-organization, short-range, low complexity, and low data rate. ZigBee is a low-power individual domain network protocol based on IEEE 802.5.4 standard. It can be embedded in portable electronic products and is suitable for automatic control and remote control.
(3)
Application terminalApplication terminals mainly refer to household devices deployed with wireless sensors, such as refrigerators, air conditioners, and other household appliances, video intercom, access control systems, and other security devices, which are connected to the core control device through the communication network and complete the work by receiving instructions from the core control device.


## 3.2. Characteristics of Wireless Sensor Networks

Combined with the WSN system structure in Figure2, the wireless sensor network is further described. Firstly, wireless sensor network is a set of distributed network system, which requires that each network node in the system has independent computing capability in addition to network communication capability. When multiple nodes gather together, they can cooperate in computing processing tasks. Secondly, the nodes in the WSN system have the ability to sense the physical and chemical indexes of monitored objects through sensors or other external devices. Finally, wireless sensor network is an open network, the system itself can dynamically manage nodes, and information exchange is done with Internet and task management nodes through the system sink node, forming the so-called M2M technology.Figure 2
WSN system structure.In wireless sensor networks, according to the different functions of devices in network management, they can be divided into gateway device, routing node, and terminal node. The functions of the three are as follows: gateway device is the cluster head of the whole network, responsible for managing address allocation, security keys, information exchange, and application management; the main intelligence of routing devices is network management. Terminal nodes interact with gateway devices through routing devices, which solves the bottleneck of communication distance and energy consumption of terminal nodes. Terminal node is the end of the network system, mainly for information collection and task execution.Smart devices such as air conditioners and televisions can be combined with wireless sensor networks in two ways: (1) smart home appliances are equipped with data transmission interfaces such as serial ports and E2C, which are connected to wireless sensor network nodes to realize the interaction between devices and nodes; (2) smart devices have embedded wireless sensor network transceiver modules such as CC2420. In this case, users do not need to purchase additional wireless sensor network terminal nodes. However, this approach increases the burden of home appliance manufacturers; on the one hand, it increases the expenditure of transceiver module; on the other hand, it increases the product development cycle, because the device requires that the protocol stack can be burned to accommodate various wireless sensor network protocols. Users do not want to and should not interfere too much in the wireless sensor network topology:(1) users should not be affected by network reasons; for example, multiple nodes with linkage function should not be placed in adjacent areas; (2) try not to require users to install nodes with different functions on different devices for network topology reasons; (3) when some nodes fail, the network topology adapts to changes and users cannot be required to replace the faulty nodes in time; (4) users should not be required to open or close terminal nodes frequently due to security problems, let alone the home gateway.Wireless sensor networks applied to smart home must have the following characteristics: (1) network adaptation; (2) device peer (except gateway); (3) the network supports multihop and point-to-point communication; and (4) have network level or even point-to-point level security certification.


## 4. Research on Routing Algorithm of Wireless Sensor Network in Smart Home

Smart devices such as air conditioners and televisions can be combined with wireless sensor networks in two ways: (1) smart home appliances are equipped with data transmission interfaces such as serial ports and E2C, which are connected to wireless sensor network nodes to realize the interaction between devices and nodes; (2) smart devices are embedded with wireless sensor network transceiver modules such as CC2420. The system believes that the first method is easier to obtain the support of home appliance manufacturers and will not cause too much cost. Moreover, the wireless sensor network in the first method is separated from the intelligent equipment, which can be repaired and replaced separately. The feature analysis of wireless sensor network topology in smart home is shown in Table1.Table 1
Analysis of wireless sensor network topology characteristics.
Family needsCorresponding network characteristicsThe device placement cannot be affected by network reasons. For example, multiple nodes with linkage function cannot be placed in adjacent areas.The network supports multihop and point-to-point communicationDo not require users to install nodes with different functions on different devices for network topology reasons.Device peer (except gateway)When some nodes fail, the network topology adapts to changes and users cannot be required to replace the faulty nodes in time.Network adaptiveUsers should not be required to open or close terminal nodes frequently for security reasons, nor should they open or close home gateways frequently for security reasons.Network level and even point-to-point level security authenticationRime is a lightweight and hierarchical protocol stack for sensor networks, as well as a low-power and wireless network protocol stack, which is aimed at simplifying sensor network protocols and code reuse. Rime is a part of Contiki. Mesh routing protocols can be built on top of the Rime protocol stack.Energy-efficient routing protocol can effectively prolong the network life cycle by considering the location information of sensor nodes and the information of residual energy in the process of forwarding data. However, it still encounters the problem of routing void due to the greedy algorithm. In this case, the energy-saving routing protocol takes the node with the second lowest cost to reach the target area as the next hop node and adds the routing cost of the node with the single-hop communication value as the routing cost of the node itself to solve the routing void problem. In this way, after a period of time, the original routing void node will gradually become the node with the lowest cost among all neighbor nodes due to its low energy consumption, which makes the transmission of data packets again face the previous routing void problem.In this paper, information feedback mechanism and alternate node use are adopted to select the next hop node and transmit data packets. Assuming routing hole problems as shown in the figure below, in the first place in the process of data transmission using information feedback mechanism, node C chooses H as during the forward to the next hop node, the node H will send it all the neighbors on the direction of the query message; if the node H did not get any feedback, explain routing has been into the hole, unable to set the routing path. Node H is the routing void node. Feedback can be sent to the node C and H; node C after receiving the feedback will further select node D or B as the next hop node, and the information goes back to the last jump node S; if the node S and D are found, it can directly go to the node B; in the next path in the choice, it will jump back on to the next node selection. Node C is no longer used as the next hop node.Rime’s mesh routing protocol is similar to ZigBee’s and uses AODVIr protocol. Figure3 shows the hierarchical structure of mesh, and the flow chart of mesh layer is as follows.Figure 3
Mesh flow chart of the Rime protocol stack.In Figure3, hidden conflict resolution strategies based on grouping mainly include hidden relationship discovery and grouping. Hidden relationship discovery refers to the discovery of hidden conflict nodes in the network by various technical means, which is the premise of solving hidden conflict. When grouping, nodes on the network are divided into groups that do not have hidden relationships based on all the hidden relationships collected, and the CAP (cyclic alternating pattern) cycle of the supercode box is divided into corresponding groups for use. The time cycle is divided into uniform division and nonuniform division.According to the proposed method, when a pair of hidden relations is found, the dynamic grouping algorithm is started to divide the nodes in the pair of hidden relations into different competition groups, and the cap cycle is divided into multiple equal time slots, and one time slot is allocated to each group. The specific algorithm is shown in Algorithm1.Algorithm 1: Smart home routing algorithm of wireless sensor network.
Initial: G={v1, v2... ,vn}; H=NULL;{va, tb} is the input pair of hidden relations. {va, tb} is the input pair of hidden relationsgt=Find group wheretb belong;gt=gt-{vb};// In all groups, find the group that meets the requirement that all nodes in the group have no hidden relationship with vbFound = false; // Assume that no appropriate grouping is foundFor each g in Gif g=gt continue;Iftb has no hidden relationship with members of group Gg = g + {tb } ;Schedule(0, send(vb, group adjust, g)); // Immediately notify vb node to join group GFound=true;break;if not found thenG=G+ {vb}; // Create a new group and place vb in the new groupMerge(G, H); // Merge nodes}Merge(G, H)// If there is no hidden relationship between groups, Merge the nodesCan_ merge=true;While(Can_merge){Can_ merge=false;For each ga in GFor each gb in GIf all nodes in ga&gb have no hidden relation thenga=ga+gb;G = ga +gb;Can_ merge=true;Schedule; // Notify gb group members to change groups}Smart home system based on wireless sensor network can be roughly divided into three subsystems: home monitoring subsystem, network management subsystem, and extended application subsystem. Home monitoring subsystem is used for residential users with intelligent household management service; the main features include intelligent lighting control, intelligent home appliances control, home security alarm, situational model management, intelligent audio and video sharing, family environment control, and visual intercom system; these function through the upper machine system by the user; Web applications and smart home gateways perform monitoring operations. The various control units, sensors, household appliances, and lighting devices involved in the home monitoring subsystem are manufactured by each product manufacturer and connected to the home wireless sensor network by means of external or built-in wireless sensor network terminal nodes.The role of network management subsystem is to realize the home network system management, including network interface management functions, the wireless sensor network management, network equipment management, network status monitoring and diagnosis, and the network environment subsystem of intelligent management function room through family gateway centralized management, involving the WSN network configuration, the Internet interface, visible interphone interface, etc., in view of the network fault repair. The system provides network status monitoring and diagnosis functions.The function of extended application subsystem is to provide application support for expanding the service range of smart home, including third-party payment interface management, emergency call management, public utility interface management, information release interface management, and remote assistance management. In this system, the intelligent home system is not only for residential users but provides also an application platform for financial information services, public utilities, public safety, and information product suppliers. It can provide diversified family information services for residential users through this system.(1)
For the smart home device based on wireless sensor network, when the device is started, the initialization of the device, including MCU, peripherals, protocol configuration, and network initialization, will be carried out first and then enter the network work process(2)
If the device has not completed the network configuration, it indicates that it is in the offline state. Then, the device will check its own device category to determine whether it is the network coordinator. If the device is a network coordinator, the device and other network coordinators will assume the networking task and automatically complete the construction of the whole wireless sensor network; if the device is another device, the device is added to the network(3)
If the device is a terminal device and has been added to the network, check its own configuration to check whether it has the routing function. If it has the routing function, it will enter step (2) to build wireless sensor network together with other coordinators(4)
Finally, after finishing the startup task, the device should run the task function to judge whether there is any task to be executed in the current task queue. If there is any task, the task will be executed. Otherwise, MCU will be configured to enter idle mode and wait for the task to wake up


## 5. Example Verification

Due to the limitation of laboratory conditions, NS2 software is used for simulation in this paper. As shown in Figure4, the size of the scene is assumed to be 40m×40m, the number of common nodes is 70, and one sink node (no. 65) is located in the center of the scene. Coordinate positions of other nodes are mainly divided into three parts, which simulate three regions, respectively. The initial energy of nodes 19-25 and 27-35 is 20 J, which is easy to form routing holes. The initial energy of other nodes is 30 J, and the power consumption of transmitting and receiving is 800 mW, and the power consumption of hibernation time is 1 MW. The size of the data packet is fixed at 32 bytes, and the value of the two ratio parameter is 0.8. The communication radius of the node is 10 m, and the simulation period is 300 s. In order to improve the reliability of simulation, Monte Carlo method was used to test each group of experiments for 20 times, and the average value was taken as the final simulation result.Figure 4
Comparison of packet sending and receiving quantity and comparison of average energy consumption of nodes.The first stage is as follows: firstly, the reliability of data transmission is tested, and then, the algorithm is adopted for experiment. During the whole experiment, the whole network sends 10347 packets and receives 10187 packets, with the packet loss rate of 0.02%, which is in an acceptable range. Therefore, Algorithm 2 can meet the requirements of smart home system. The node energy consumption of Algorithm 1 and Algorithm 2 is further compared. Figure4 shows the average energy consumption of other nodes in the network over time, except for the 6 nodes used to simulate routing voids.In order to evaluate the performance of the protocol, we let all nodes start send packets to node 0 at the same time 10 until the end of time 100 and calculate the packet delivery rate, end-to-end delay, network throughput, and energy consumption of 802.15.4 timeslot protocol, respectively. The time interval for nodes to send data increased by 0.4 from 0.4 PPS to LPPS, which was used to simulate the performance of protocols under different loads. Each group of data was tested for 20 times, and the results were averaged. Specific experimental results are shown in Figure5.Figure 5
Experimental results of wireless sensor network smart home.As can be seen from the above four figures, in IEEE 802.15.4 beacon-enabled star network, when the nodes in the network have hidden relations, with the increase of network load, the CSMA/CA channel access mechanism in IEEE 802.15.4 cannot reflect good performance, and frequent conflicts and retransmissions are inevitable. Network performance is greatly reduced, and energy consumption is increasing. When the wireless sensor network smart home is used, IEEE 802.15.4 network in throughput, energy consumption, and other performance indicators have been significantly improved.ZigBee wireless communication technology and WiFi wireless communication technology mainly exist in the communication network of smart home system. The main function of WiFi technology is to realize the data exchange between intelligent gateway and smart phone based on TCP/IP protocol. In order to ensure the communication quality between smart gateway and smart phone and ensure the stable and reliable operation of the whole system, it is necessary to test and analyze the communication performance of the WiFi network. Since WiFi and ZigBee networks both belong to the 2.4 GHz band, the ZigBee coordinator module in the intelligent gateway is used as the interference source to study the impact of ZigBee network on the WiFi network. The performance of WiFi network was observed by observing the signal intensity value and transmission rate of the WiFi network displayed by Wireless of upper computer software.The upper computer runs Wireless software, which is 5 meters away from the intelligent gateway. RSSI values of the WiFi network are measured in the open and closed status of ZigBee module of the intelligent gateway. 500 groups of measured data are imported into MATLAB, and RSSI comparison with or without ZigBee disturbance is obtained, as shown in Figure6.Figure 6
Comparison diagram of WiFi performance test.As shown in Figure6, the abscissa is the point number and the ordinate is the signal strength (dBm) axis. The ordinate value is expressed as a negative value, and the smaller the absolute value is, the better. Under the disturbance of ZigBee signal, the quality of WiFi signal declines, indicating that ZigBee network has a certain impact on WiFi network, but the minimum value of RSSI is around -68, and if the intelligent gateway needs to achieve better wireless network coverage performance, the signal intensity is above -78 dbm. Therefore, under the interference of ZigBee network, the performance of WiFi network still meets the requirements of smart home system. This is mainly because the transmitting power of WiFi signal is generally above 24 dBm, compared with the transmitting power of 1 dBm of ZigBee signal, and the signal bandwidth of WiFi signal is about 22 MHz, much larger than ZigBee’s 2 MHz, and the interference of ZigBee signal has a limited impact on it.The ZigBee wireless sensor network software design in the smart home system of this design refers to the ZigBee 2007 version of open-source protocol stack officially launched by TI. For the coexistence of ZigBee network and WiFi network, the ZigBee Alliance proposed a frequency agility algorithm in the analysis report and recommendations to reduce or even avoid the interference between the two. The essence of frequency agility algorithm is to scan and jump to the channel with low energy when there is interference. The channel distribution of ZigBee and WiFi is shown in Figure7.Figure 7
ZigBee and WiFi channel distribution diagram.As can be seen from Figure7, ZigBee 1.5, 3.5, 5.5, and 7.5 channels and WiFi communication channels basically do not overlap, so when the RSSI value detected by the ZigBee coordinator module is large or there is interference, it is limited to scanning above four signals to find free and available channels. It should be noted that the smart home system network may be disturbed not only by WiFi signals but also by networks composed of other ZigBee coordinators. Therefore, energy scanning needs to be performed again.


## 6. Conclusion

In this paper, through the research of ZigBee wireless sensor network technology, WiFi technology, and Android technology, the design and implementation of smart home system are based on wireless sensor network. With the energy control algorithm based on topology control, wireless sensor network is self-organized, so there is frequent network management and energy consumption is mainly concentrated in a few core network nodes. Aiming at this kind of network activity, an energy control algorithm based on topology control is adopted to realize the overall energy saving of the system by controlling the topology energy distribution strategy and improve the energy utilization efficiency of the system from the perspective of network energy load balance. The system function and workflow are designed in detail from the perspective of external function and internal workflow. Various wireless sensor network routing protocols for smart home are compared, and experiments are carried out under unified home layout and application scenarios. Through simulation and actual deployment, the detailed performance comparison was carried out, several routing protocols used in the smart home system were discussed; in view of the smart home system, node position is relatively fixed, has long working period, is real-time and reliable, and has strong network coverage characteristics of information requirements; this paper will be based on the geographic location information of energy-efficient routing protocol which is introduced in the smart home system. In addition, information feedback mechanism and alternate use method are adopted to improve the efficiency of routing protocol, and the solution of routing hole problem and flood transmission method are adopted to effectively reduce the energy consumption of network system. Simulation results in NS2 environment verify the effectiveness of the improved algorithm.



---

*Source: 7284426-2022-08-11.xml*