Design of Smart home System Based on Basic Radio Frequency Wireless Sensor Network

— This paper attempts to integrate the wireless sensor network (WSN) into the smart home system. To this end, a smart home system was developed based on the basic radio frequency (RF) WSN. First, the author introduced the architecture, nodes and features of the WSN. Then, the design process of the smart home system was detailed. The hardware of the system consists of such three parts as the master control, wireless transceiver and sensor terminal; the software of the system includes the basic-RF WSN program and the master module STM32 programme. After that, the established system was applied to temperature collection and control. The results show that the collected temperature agreed well with the temperature measured by the thermometer. Finally, the temperature control effect of the system was successfully simulated with a potentiometer and an LED lamp. The research findings shed new light on the design of smart homes.


Introduction
With the technical development of sensor, semiconductor and embedded system, the wireless sensor network (WSN) has become a research hotspot. Through various tiny sensors, the WSN can monitor, perceive and collect distributed environmental information in real time, and transmit the processed information to the users. Over the years, the network system has been applied to numerous fields, ranging from industrial/agricultural control, urban management, national security to disaster prevention [1].
The WSN is an organic integration of cutting-edge information technologies, such as data sensing, embedded computing, wireless communication and distributed information processing. It is much more flexible, stable and scalable than the traditional wired communication network [2][3][4]. In particular, the WSN supports multi-hop group monitoring of devices, and real-time processing of the monitored information [5]. Suffice it to say that the WSN opens up a new research field to scholars at home and abroad [6,7].
One of the potential application fields of the WSN is the innovative concept of smart home. The concept was first proposed in developed countries like the US, Canada, and Australia [8,9,10]. Nowadays, smart home is increasingly accepted by those in pursuit of a convenient lifestyle [11,12]. Traditionally, the smart home system is grounded on a wired home network, which is costly and hard to maintain. Coupled with remote control technology, the WSN is being integrated into the smart home system. This move greatly enhances the flexibility, stability and scalability of the home network [13,14].
The smart home industry started early and developed fast in foreign countries. Many famous companies have set foot in this field, namely Honeywell and Control4. The latest information technology has been harnessed to create a safe, comfortable and convenient living environment for ordinary people [15,16]. For instance, the Control4 smart home system can be configured flexibly according to their personal needs [17,18]. In China, however, the smart home industry has just entered the application stage.
In general, a smart home consists of three components: the extranet, the intranet and the gateway. The extranet may be a residential LAN, a CCTV or a telephone network, most of which rely on mature technologies. The intranet is the LAN that links up all kinds of home devices. The form of the intranet varies with the devices in it. The gateway connects the intranet to the extranet, allowing the extranet to control the networked appliances. Besides, the gateway supports different networking technologies so that the networked devices in each subnet can communicate with each other. The architecture of a smart home system is shown in Figure 1.  In light of the above, this paper designs a smart home system based on the basic radio frequency (RF) WSN. First, the author introduced the architecture, nodes and features of the WSN. Then, the design process of the smart home system was detailed. After that, the established system was applied to temperature collection and control. The results show that the collected temperature agreed well with the temperature measured by the thermometer. Finally, the temperature control effect of the system was successfully simulated with a potentiometer and an LED lamp.

2
Principles and Characteristics of Wireless Sensor Network

WSN Architecture
The WSN system mainly consists of three parts, namely sensor nodes, sink node and task management node. Each part has its own function. A great number of sensor nodes are distributed in the monitoring area and the wireless communication network transmits data to the sink nodes in a self-organized way. After receiving the sensor data transmitted by the network nodes, the sink node forwards the data to the task management node through an extranet, such as a satellite communication network. The task management node can monitor the operations in the area through terminal display, and also manage the sensor network remotely.
The architecture of the wireless sensor network is shown in Figure 2.

Fig. 2. Wireless sensor network architecture
Sensor nodes perform data acquisition in the network built by themselves. Sensor nodes have limited storage and processing capacity, and most nodes are dormant in order to save power. Each node has a life cycle of more than one year. The sink node has a strong processing ability and storage capacity. It usually uses fixed power supply to receive data transmitted from the sensor network at any time and forwards it to the task management node through the extranet. The task management node can receive the data collected in the sensor network to monitor the conditions of the sensi-tive areas. It can also send control commands to configure and manage the entire sensor network.

WSN node structure
A sensor node is a tiny embedded system with data processing, storage and wireless communication capabilities. It is composed of four parts -sensor module, processor module, wireless communication module and power supply module. The structure of the node is shown in Figure 3. The nodes acquire the environmental parameters in the monitoring area by collecting the data of the sensors, and the processor module processes and stores the sensor data. The processed data are transmitted to the sink node one by one through the wireless communication module, and the energy module provides the power for the normal operation of the nodes. With tiny batteries, the nodes generally consume very low power to ensure that nodes can run for a long time.

Characteristics of Wireless Sensor Network
A wireless sensor network has the following characteristics: 1. Large-scale network. Nodes are widely distributed in the monitoring area, which can improve the monitoring accuracy through the data fusion algorithm. The nodes are densely deployed in the monitoring area and thus can monitor large geographical areas. Therefore, WSN is a large-scale network. 2. Ad hoc network. In a WSN, the locations of nodes are uncertain. Nodes may be distributed through random seeding in the monitoring area, so it is necessary for nodes to form their own network and then transmit data over the network. 3. Dynamic network. In a WSN, the number of nodes, the sensing objects and the monitoring environment can change at any time, so it is a dynamic network.
4. Reliable network. Sensor nodes are randomly distributed in the monitoring area, so network nodes need to run reliably and cannot be easily damaged, and the data transmission nodes should have a series of reliable response mechanisms to guarantee reliable transmission in the monitoring data. 5. Data Centre network. The communication between nodes in a wireless sensor network is based on the data transmission in the network. The object of sensor network monitoring is uncertain, and the nodes are identified in the network through data interaction.

Hardware Design
The design of a smart home system based on WSN mainly involves three partssensors acquiring data, wireless transceiver chips sending or receiving data and commands, and the master chip processing data. This system is mainly composed of two parts -master control and sensor terminals. The master control terminal is used to receive and analyse the data of the sensor terminals, and the sensor terminal is used to acquire and transmit data. The functions of the master control are realised by the master control module and the wireless transceiver module, and the functions of sensor terminals are completed by the wireless transceiver module and the smart sensor module.
The hardware design of the smart home system is shown in Figure 4.

Master control design
The master control consists of the master control module and the wireless transceiver module. It is designed to receive data from each sensor terminal. After data analysis, the control of home appliances is completed. The master control unit can decide whether to add or delete other sensor terminals, and can also send, receive and analyse the processing instructions to or from the sensor terminals. The master control module coordinates other modules, so that the whole system can run in an orderly fashion, and also to analyse and process the acquired data. It can also connect with the computer, write the programme into the MCU with the help of the development environment, display the data and information acquired by sensors, and select the functions of the system. The data processing chip of the master control module is STM32.

Wireless transceiver module design
The wireless transceiver module is composed of a wireless transceiver chip and antenna, etc. It is designed to carry out data transmission with a single chip microcomputer, receive and transmit the commands of the single chip computer, send the commands to other sensor terminals, and acquire sensor terminal data. This module uses Nordic's monolithic RF transceiver n RF905 as the wireless transceiver chip to receive and transmit data or commands.

Sensor terminal design
The sensor terminal is composed of an intelligent sensor module and a wireless transceiver module. The sensor terminal is used for data acquisition and transmission. DS18B20 is used as the temperature sensor to collect temperature data. The MCU sends the collected data and displays them on the LCD screen. The humidity sensor HS1101 is used to collect humidity data. The MCU sends the collected data and displays them on the LCD screen.

4
Software Programming

Program design of wireless sensor network based on Basic-RF
According to the actual needs, the Basic-RF wireless communication protocol of TI CC2530 chip is chosen as the wireless sensor network for the smart home system. The wireless sensor network consists of three parts, namely the coordinator node, routing nodes and terminal nodes. The coordinator node is the core of the wireless sensor network, which is the location the home control commands from the user will be eventually sent to. Routing nodes in a wireless sensor network are responsible for data transmission. In practice, a routing node is installed in each room of the house to ensure that all home control commands can be eventually transmitted to the terminal nodes to control the electrical appliances. The WSN coordinator sends a command to the corresponding routing node and terminal node, which finally sends the control command to the home appliance terminal. The home appliance terminal receives the control command and sends feedback information after completing the control response. The feedback is sent along the same path as the control command, but in the opposite direction. The structure of the wireless sensor network in home network is shown in Figure 5.

Programming of the master control module STM32
The master control module of the smart home is based on the STM32 microcontroller, and the programme flow chart of the STM32 in the smart home system is shown in Figure 6.

Temperature measurement experiment
The system uses Dallas DS18B20 as the temperature sensor, with a temperature range of -55~125°C. In the experiment, as human body cannot sense any indoor temperature change within 0.1°C, the measurement is only accurate to one decimal place. The temperature test is done in a heated room, and the temperature of the thermometer varies between 11~14°C. The minimum temperature is measured during ventilation, and the maximum temperature is measured at noon. The measured temperature lists and curves are shown in Table 1 and Figure 7. The indoor temperature is not very accurate, but the measurement error is basically controlled within the range of +/-0.6, which meets the design requirements.

Temperature control experiment
In the experiment, because the temperature measured in a day changes little, and cannot help achieve control, the author uses a potentiometer to simulate the changes of temperature Through adjustment of the potentiometer, the outputs of different voltages represent different temperatures. By common sense, the best living environment for people is 18 to 25°C; otherwise people will feel uncomfortable. In the test, a light emitting diode is used to indicate the temperature control signals, and the diode emits light when the temperature simulated by the potentiometer exceeds the set point. The relationship between temperature and status of light is shown in Table 2.

Conclusions
This paper designs a smart home system based on WSN. Firstly, the author introduces the architecture, node structure and characteristics of WSN. Then, the author describes the design process and method of the smart home system using Basic-RF wireless sensor network. Finally, the author tests the system by using it to collect and control the temperature. The results show that the temperature collected by this system is basically the same as that obtained by the thermometer. The control effects of the system can be successfully simulated with a potentiometer and an LED lamp.