Research on Smart Home System Based on SC2440 and ZIGBEE Protocol

This paper realizes the remote management and wireless transmission of smart home system adopting ARM technology and ZigBee protocol, and proposes a design scheme combining S3C2440A processor and ZigBee wireless technology, Web technology, ZigBee wireless network technology and Internet communication technology. It realizes the real-time monitoring and management of the intelligent home system remotely based on real Internet of things, and improves the comfort, convenience and security of the home living environment.


Introduction
The concept of the Internet of things has two meanings. First, the core and foundation of the Internet of things is still the Internet, which is an extended and expanded network based on the Internet. Second, its clients extend to any item for information exchange and communication. Therefore, the definition of the Internet of things is anything connected to the Internet, through RFID, infrared sensors, GPS, the laser scanner information sensing devices and agreement, it finally realizes information exchange and data communication to realize a kind of network for intelligent identification, positioning, tracking, monitoring and management of goods.
Smart home is a residential environment, using the communication technology of cable and wireless network platform, including the integrated wiring system, security system, music broadcasting system, light curtain control system, air conditioning control system, and home theater control system and so on. And it can realize intelligent control in life, and remote monitoring and management of the network.

The overall structure design
The Internet of things smart home system is mainly composed of four parts: the home gateway (main controller), the terminal controlled device, the family internal control network and the external communication network. Among them, the terminal controlled equipment mainly includes family equipment control, security system, residential management system, home information management and so on. The system block diagram is shown in Figure 1.
The home gateway (master controller) is the control center in the whole system. It is not only responsible for the communication between the internal network and the external network of the system, but also the real-time monitoring and management of the intelligent terminal equipment through the ZigBee wireless network. In addition, the intelligent terminal will perform the corresponding operation after receiving the command, and feedback its working state through the coordinator to the home gateway. Through this implementation mode, it can improve the stability, reliability and flexibility of the whole system to a certain extent, and also facilitate the management and use of the user.
Because the Internet of things smart home is a complex system, it requires many people to work together. First, under the control of the home gateway, the system realizes the communication between internal network and external network. Second: in the home control network, due to the need to control a wide range of terminal equipment, this design mainly aimed at the switch control and temperature control in home appliances. 3 Hardware design of home system 3

.1 Design of home gateway module
The home gateway module is the core part in whole intelligent home system based on the Internet of things. It is a bridge between external communication network and the home internal control network (ZigBee). On the one hand, the home gateway supports the TCP/IP protocol and can provide Web services to allow users to access it remotely by Internet; on the other hand, it is responsible for the conversion functions such as the protocol and information between the home control network and the home external communication network, which can be used by the internal control network to the physical union. Smart terminal devices in smart home are monitored and managed.

ZigBee wireless communication module
The wireless communication module mainly involves two kinds of devices: the ZigBee node and the terminal node. The coordinator realizes data transmission through the RS232 serial interface and the home gateway, which is mainly responsible for setting up the internal wireless control network in the home, searching for the effective channel and terminal node, and completing the data forwarding function. The terminal node is mainly responsible for receiving the commands from the coordinator, controlling the temperature sensor and the switch of the home appliance in its location, and feedback the corresponding temperature value and the switch state information of the bedroom lamp to the coordinator node, and forwarding the message to home gateway through the coordinator node, the system structure is as shown in Figure 1.

Design of switch control module for household electrical appliances
The control of household electrical appliances is a very important part in smart home system. Generally, it is mainly to control the start and stop of household electrical appliances. Of course, some powerful household appliances may also need to set up their working mode and working environment. For example, air conditioning, we may need it to implement the refrigeration or heat, and set temperature values according to our requirements. Here we mainly use the ZigBee terminal node and relay to control the switch of bedroom lamps and lanterns. The schematic diagram is shown in Figure 3.

Design and implementation of smart home software
For embedded system development, we usually do it in the following order: (1) Install virtual machine and Linux operating system on PC, configure SMB and NFS server, install some development debugging tools on Windows platform, and establish corresponding cross compiling environment.
(2) Install the Bootloader that guides the operating system. In this design, Bootloader that we need to transplant is U-Boot.
(4) Develop root file system to mount our file system, which manage operating system files and corresponding applications.
(5) Develop the hardware driver, and developing specific applications.

Communication protocol between coordinator and terminal node
The data transmission format and the data response format are also different for the host computer and lower computer. Their format used in this design is shown in Table 1 and table 2 respectively.

Data transmission between coordinator and terminal node
The coordinator node is the core in whole family's internal control network, which is connected to home gateway through RS232 serial port, receives commands from home gateway, controls terminal nodes, and send the information from terminal nodes to home gateway. The terminal node is responsible for receiving commands from the coordinator node, and control temperature measurement module and bedroom lamp, and feedback the temperature value and state of luminaire to coordinator node, and the work flow chart of temperature measurement module and bedroom luminaire control module is respectively as shown in Figure 4. In order to realize the remote control in the intelligent home system, a web page with same address and IP address is stored in the home network, and the embedded system can be managed and monitored through the web page. Users can access remote Web browsers, and in order to protect users' security, they will first enter user authentication.

The core communication technology based on B/S
The software design of embedded intelligent home gateway interactive platform adopted B/S structure development model, figure 5 describes in detail the implementation process of B/S communication architecture technology.  Figure 5, B/S gateway system architecture start from the browser's HTTP requests, web server HTTP request, will request the URL decoding through the CGI gateway interactive program, and useful information will be process by corresponding Linux system in the inter process communication. Through the process by processing, it implement the corresponding demand of user. The end of the request processing, the process will be processed information results through inter process communication way back to the CGI gateway interface program, CGI gateway interactive program will take the information results to the web server for URL code, and finally the results form URL encoding format information via a CGI feedback process is returned to the browser, the user can know the corresponding demand state for success and at this time Home Furnishing equipment through the feedback result on a browser, thus a complete architecture of the B/S communication process is over.

The CGI gets the data information
Due to the attribute "METHOD" of FORM is the GET method, CGI interactive program will get the data information from the environment variable QUERY_STRING, the existence of a string of data information acquisition. URL encoded data will be stored in the environment variable QUERY_STRING. Figure 6 describes the CGI program to obtain the data information flow.

Conclusion
This paper has completed the overall scheme design and platform construction for intelligent home system based on B/S architecture, and realized home intelligent gateway and system function modules. Users can control the smart home system remotely through PC and mobile phones. The experimental results show that user can login smart home system remotely by PC and mobile phone, and realize the functions of registered users and password checking. In addition, the paper also tests the intelligent lighting system module and intelligent temperature and humidity control system module in intelligent home system, and the test shows that each function module meets the design requirements.