The Internet of things (IoT) is widely applied in this day and age. Many different kinds of related products have been developed, and extensive research and planning have focused on the application and design of IoT. For example, in literature , some researchers have proposed the technical design of wireless communications, sensors, and Internet for use in daily life. Humans use many intelligent objects every day, including surveillance cameras, indoor intelligent applications of the IoT, wired and wireless sensor applications, smartphones, intelligent vehicles, and smart-sensing card applications. Some researchers have proposed the concept of embedded intelligence (EI) and divided the interactive form of the IoT into three parts. First is individual intelligence , which refers to patterns related to individual behavior and understanding, such as the scope of an individual’s activities, interests, routines, etc. Second is spatial intelligence, which considers the impact of an environment on people, such as environmental-noise detection and air-quality testing. Third and last is social intelligence, which refers to the category of groups and communities such as interactions among people and the dynamics of urban life. The concept of EI originated from the IoT and it is classified into three blocks . Furthermore, many fields for study have been proposed. Many innovative applications or system development can be found in these fields, and their purpose is to improve people’s lives and allow people to interact with technology more easily and conveniently .
With the advancements in digital technology and the maturity of various software and hardware packages, this kind of related technology has been gradually introduced to all kinds of electronic and electrical appliances in our home environment to further enhance human convenience. For example, we can remotely control all kinds of furniture or electric appliances in our homes, and people do not need to be in contact with these devices to operate them . Therefore, the concept of intelligent digital home has developed vigorously in recent years .
2. Research Status of Smart Home
In literature , researchers have performed some research on smart home control system and proposed four system designs: first, information collection module that is used to collect sensor data and data of integrated database; second, central control unit that is used to make remote control decisions and to connect devices at home with those in other houses; third, the service interface that is used to provide users with simple operations and also can display some information helpful in system development; and, fourth, a network for communication and links . Wireless transmission technology and power line technology are used to link home electronic devices. Researchers have designed an intelligent alarm clock by using data collection and integration, fuzzy logic, and fuzzy neural network. For example, for people leaving for work, the intelligent alarm clock collects three factors through database system and sensor: outside weather conditions, traffic conditions, and users’ routes to their destinations. After integrating the data, the fuzzy control is used to estimate the lead time required to reach the destination and inform the user in advance that he/she should be away from home .
OSGI Alliance has been developing for many years. Its open service platform standard can be used by research and development personnel for reference. Some researchers have also proposed the design of home gateway. Based on different applications, the home gateway can be divided into the following types. The first is the remote control, which allows members of the family to simply control intelligent appliances through the Internet. The second is the broadband access, which is the most widely used product type in the market at present. It aims to link and transform different protocols in the home network and connect the Internet and basic firewall. The third is voice-data integration, including the following functions, namely security, protocol transmission, transmission of small files, and integration of voice and data. The last is fully functional integration, which has the functions of three types of products mentioned above, such as converting all kinds of audio-video technologies, protocols, good transmission quality, and remote control, with linking all Internet devices at home as the target. It is a more mature home gateway product.
Many studies on the design and practice of home gateway are presented  . In literature the author has proposed some design concepts of home gateway, providing the following services: collecting home network information, networking information management, security and back-end connection of WAN, etc. Researchers have explored how home gateway integrates home devices with home networks and categorized four types of physical devices that form home networks: Home Access (HA), Home Bridge (HB), Home Client (HC), and Home Device (HD). HA is placed on the edge of the network, as a device connecting external network and internal network. HB serves as a bridge to connect various physical layer networks at home. HC serves as the equipment that enables home devices to connect to the internal network. HD refers to a smart home appliance that can be connected to the family. In literature , the designer outlined not only a home gateway but also an embedded development platform, which can provide 3G and ZigBee services.
In the hardware design, TI OMAP3530 chip was used as CPU, and ARM CortexTM-A8 was used as the core. The chip used by 3G was SIM5218A, and the WCDMA module used by ZigBee core was CC2530. The operation system was Linux 2.6.x version. The software design was divided into two parts, namely, system software planning and advanced application development. Finally, the author integrated the functions of 3G and ZigBee to complete a home gateway .
3. Research on Closed Area of IoT
3.1. Overview of ZigBee Technology
ZigBee is used to define two types of physical device, namely, full-function device (FFD) and reduced-function device (RFD), showing sizable difference in the routing function. FFD, also called the Coordinator, has the routing function, which generally serves as the constructor of ZigBee network, whereas RFD lacks the routing function, which is generally configured in end device. ZigBee, with multinode hopping functions, can be developed to obtain various types of network connections, so-called network topology. According to different requirements, FFD can form various topological structures, including star, network, and tree structures (Figure 1).
Each network topology belongs to an independent network, that is, personal area network (PAN), and each PAN has a personal area network identifier (PAN ID) to distinguish different sections of the network. IEEE 802.15.4 defines PAN ID as two bytes. One PAN can be added into each ZigBee node. PAN ID in the frame can identify whether this frame belongs to its own network architecture. Each ZigBee node has its own network address. To avoid too long address fields affecting communication traffic, IEEE 802.15.4 standardizes a two-byte short address, which can be used inside a PAN. Therefore, there are 65536 network nodes at the most.
The fourth layer of ZigBee is more important, which is application support sublayer (APS). This layer is used to link application layer and network layer. Its basic functions are as follows:
1) Supporting end nodes and profile. Based on different applications, the device will have different attributes and output and input parameters. Furthermore, profile is a window that records the data, or it can be called output/input interface, mainly for configuration of the parameters of each application device.
2) Direct designation of address and transfer. The next node location of each transmission is directly designated at the sending end to the receiving end.
3) Response and retransmission. For response, acknowledge is usually used, abbreviated as ACK. Different from ACK in MAC layer, ACK in APS layer has stronger function, which can jump back to the sending end for confirmation, and the re-transmission interval is expanded to reduce transmission failure rate. Retransmission is repeated three times in MAC layer and APS layer. If ACK is not received by the sending data, the retransmission will be performed. If three times of retransmission failures occur, the retransmission is eliminated and returned to the upper layer.
4) Safety protection. This is an optional function, depending on the users’ settings. It contains two items, namely, authentication and encryption. The former is to prevent unauthorized hackers from invading their networks. The latter is to protect data from hackers by using 128 bit AES. The fifth layer of ZigBee is application layer (APL). This layer is defined by the developers, satisfying their own needs. ZigBee provides application framework to help users develop applications based on ZigBee specifications. Furthermore, some management
Figure 1. Self organizing linked graph.
network objects are installed on each software. These special programs installed are called ZigBee Device Object (ZDO), which is an interface providing application standard system for users to use.
3.2. Analysis on Self-Organization Mechanism
Some literature  mentions that many self-organizing algorithms for wireless sensor networks are suitable for large and multinode wireless sensor networks. However, these algorithms are not necessarily suitable for wireless sensor networks formed by a small number of nodes. Therefore, researchers propose a set of self-organizing algorithm against small wireless sensor networks. Two protocols are designed for this algorithm, namely, initialization protocol and steady- state protocol. At the same time, the author takes energy conservation into two protocols for this algorithm. Initialization protocol determines how to build a linked topological structure at the beginning of the node. Particularly, in addition to two nodes at the head and tail, each node has an upper and a lower node. The node goes into a sleep mode after the establishing the topology. When a node has data to send, steady-state protocol will start to work.
This node sends the data to its upper or lower node. The receiving node sends back a confirmation message and checks whether the data is sent to itself. If not, it will continue to transmit information to the chain. According to the concept of small wireless sensor network proposed in this paper, the self-organizing mechanism to be designed is a small wireless sensor network formed on the basis of small energy saving and strengthening the relevance of air-conditioner windows and doors, and it will also study the family topology. The general household environment, such as walls, iron cabinets, door panels, and other factors that reduce wireless signals, as well as the acquisition and conservation of electric energy, needs to be considered. At the same time, it also needs a mechanism to distinguish the neighboring network from the home network, to hinder each sensor transmission node from entering the neighboring families and even other wireless sensor networks in the outdoor or residential areas when self-organizing.
Self-organizing mechanism and self-organizing algorithm are based on an independent theory (self-organization theory) for network construction. Self-organizing theory is developed from physics, entropy, cybernetics, etc. This theory is firstly raised by Farley and Clark from Lincoln Laboratory, USA. It has been revised later by different scholars, including Dr. Peter Kruse of the University of Bremen in Germany, who performed the greatest contribution.
In network topology, self-organizing theory has also been widely used and discussed. The self-organizing algorithm designed in this paper focuses on how each wireless sensor network node with different attributes (such as ZigBee module for HG, ZigBee module for air conditioning, ZigBee module for doors, ZigBee module for windows, etc.) make self-recognition and proper self-organization based on the actual building structure automatically without users’ replanning and settings, under a given structure and layout of an arbitrary room. One item of self-recognition is to distinguish neighbor network and self-network, to prevent the independent sensor transmission node from entering the neighbor network and even other wireless sensor networks in the outdoor and residential areas when self-organizing. All these problems can be solved through the combining the algorithm and radio wave information in the physical layer. Therefore, our current design is actually a self-organizing mechanism.
4. Algorithm Design of Tree Structure in Enclosed Area
4.1. Self-Organizing Algorithm Structure
On the basis of specifications of 802.15.4, we design a self-organizing algorithm, as shown in Figure 2. We expect to build a tree-like network topology. Each ZigBee node connection has the upper and lower relations. Considering that HG is found at the most upper, it processes most of the data. In other words, HG’s ZigBee is the vertex of the tree structure and controls ZigBee wireless network of the entire family. This network is also a cluster network, with HG as its Coordinator. Its main purpose is to allow the HG to send the commands that users input. Air conditioners in the door and window are equipped with one or more ZigBee devices for the transmission and reception of wireless data. The abovementioned three ZigBee devices are end device, which must actively request HG to connect to the network. HG assigns PAN ID belonging to this network to request a connection node with a two-byte short address.
PAN ID is divided into global PAN ID and local PAN ID. Each family owns its global PAN ID. Local PAN ID is used in ZigBee node of this family, which will be used when subdividing different PAN IDs becomes necessary. For example, in the window control we designed, placing a pair of ZigBee nodes is necessary. One is ZigBee node for controlling window movement, and the other is auxiliary. Therefore, we design local PAN ID for this pair of window ZigBee nodes. Window node of the main control end still requests the network address from HG to acquire global PAN ID and the address that PAN can be used. After completing this step, it can configure the local PAN ID to its auxiliary window nodes to achieve perfect window control functions.
Figure 2. Self organizing tree diagram.
Nodes in the family may not necessarily connect to the requested address of HG. In the algorithm we designed, the door node can be used as Cluster Head (CH) of the tree structure, which helps transfer packets and forms multihop network. Nodes on air conditioner and window cannot become CH of this network and can become door nodes or the lower nodes of door. Furthermore, its upper is used to help receive or transmit the data. To reduce the burden of each ZigBee node, the address is still configured by HG, and HG is used to manage and control the entire family network.
4.2. Design of Self-Organizing Step
In our self-organizing algorithm, on the basis of the location of each ZigBee device, the nodes can be divided into five categories: 1) HG node, 2) door node, 3) air conditioning node, 4) window node for master control, and 5) window auxiliary node. They have their own behavior patterns. HG node is the coordinator of the ZigBee connection in the family. It passively waits for requests from other nodes and has the ability to assign short addresses to other nodes, and it manages and controls the entire family’s ZigBee nodes. Door node will actively request HG node to add PAN and a short address. When a door node acquires the address, it has the function of frame forwarding. It can transmit the message that the new node wants to join or the control message under HG to the destination and become a relay node of the multihop network. Air conditioning node is a terminal node. It will actively request HG to join the network. When acquiring the address and PAN, it is on standby. It executes control command or returns to air conditioning state without frame transmission capability.
The window controller consists of two ZigBee nodes. These two nodes are placed on the upper and lower edges of the window. Furthermore, they are equipped with an infrared transmitter and receiver to detect the objects. Therefore, an additional window PAN will be self-organized. The purpose of separating independent window PAN is to allow HG to save the transmission of control frame. Window control can be completed only when HG sends a control frame to window master node.
The node that is placed on the upper edge is a window master node. This node will request PAN ID and address to HG or door and allow HG to perform window control and return to the window state. In addition, after the window master node acquires the address provided by the HG, it waits for the link request of the window auxiliary node and configures an address to the window auxiliary node. At the same time, another PAN is formed. The window auxiliary node will actively send the request to the window master node. Subsequently, the usable address and PAN ID are acquired. The window auxiliary node is controlled by the window master node and does not communicate with other nodes. Therefore, HG will only know the existence of the window master node. When controlling the window is necessary, the control frame is sent to the window master node. Once it receives the control frame, it will convert PAN and send the control frame to the window auxiliary node for the control of window movement. After completing the action, the window master node will send the frame to the window auxiliary node to stop the action and switch back the original PAN the same as the HG. Finally, the window state is returned (Figure 3).
5. Application Design of Energy Saving System in the IoT
ZigBee communication device set in the window is called client node. ZigBee communication device set in home gateway is called master node. Client node returns the window opening state, security monitoring status, and other information to the master node. Furthermore, the master node can also send instructions to the client node to control the window movement (Figure 4).
As shown in the figure, users at home are called local controllers. Local controllers can directly connect to the home gateway by using computers to watch the window opening state at home, and security monitoring status, or send a command to remotely open or close windows at home. Users outdoor are called
Figure 3. HG node self organizing FSM graph.
Figure 4. Remote control schematic diagram.
remote controllers. Remote controllers can connect the home gateway through Internet by using smartphones, laptops, and other Internet-enabled tools, to watch the state of the window opening, monitor security status, or send a command to remotely control the windows at home.
The optimization algorithm proposed in this paper is to achieve power saving effect by reducing packet transmission. However, the power saving on ZigBee and electrical appliances should be considered. ZigBee control device should be in standby as no message is required. If this system can be integrated into more electrical appliances, the power-saving mechanism should be one of the important factors to be considered.
We expect that it will provide people with more convenient technologies, more comfortable quality of life in the future. At the same time, it can save more electricity charges for users. Therefore, a win-win situation can be achieved between technology and life.
The first author acknowledges the financial support by Department of education’s top talent support program of Guizhou Province (China) (KY  088). The second and third authors acknowledge the financial support by Science and Technology Project of Department of Science and Technology of Guizhou Province (China) (QKH LH  7214). The authors are grateful to the anonymous referee for a careful checking of the details and for helpful comments that improved this paper.
 Chulde, H. and Efrén, C. (2017) Internet of Things (IoT) Implementation with Nodes Based on Low Power MSP430 Microcontroller. International Conference on Information Systems & Computer Science, IEEE Computer Society.
 Oliveira, L.M.L., Rodrigues, J.J.P.C., Sousa, A.F.D., et al. (2017) Network Admission Control Solution for 6LoWPAN Networks Based on Symmetric Key Mechanisms. IEEE Transactions on Industrial Informatics, 12, 2186-2195. https://doi.org/10.1109/TII.2016.2601562