Design of Networked Home Automation System Based on μCOS-II and AMAZON

In recent years, with the popularity of computers and smart phones and the development of intelligent building in electronics industry, people's requirement of living environment is gradually changing. The intelligent home furnishing building has become the new focus of people purchasing. And the networked home automation system which relies on the advanced network technology to connect with air conditioning, lighting, security, curtains, TV, water heater and other home furnishing systems into a local area network becomes a networked control system. μC /OS is a real-time operating system with the free open-source code, the compact structure and the preemptive real-time kernel. In this paper, the author focuses on the design of home furnishing total controller based on AMAZON multimedia processor and μC/OS-II real-time operating system, and achieves the remote access connection and control through the Ethernet.


INTRODUCTION
Nowadays, Internet and WIFI are connected all over the world, and the network has covered most parts of China. Many communities have realized fiber-to-the-home, and almost every family can get access to it through the Ethernet. The networked home automation system which relies on the advanced network technology to connect with air conditioning, lighting, security, curtains, TV, water heater and other home furnishing systems into a local area network becomes a networked control system. The networked control can not only achieve the one-to-multiple point control, but also the multiple-to-one point control. People can conduct centralized control, timing control, sensing control and remote control at home. When away from home, you can also perform the appropriate action by telephone, mobile APP and so on. Thus, management and control of home appliances at any time and in any place is likely to realize. In recent years, with the popularity of computers and smart phones and the development of intelligent building in electronics industry, people's requirement of living environment is gradually changing. The intelligent home furnishing building has become the new focus of people purchasing, and it is of course the force to drive real-estate developers to invest in luxury real-estate, and provide a new "people-oriented" home life experience.
μC/OS is a real-time operating system with free open-source code, compact structure and preemptive real-time kernel. Its predecessor was μC/OS, which are specifically designed for embedded computer applications. Most of the codes are written in C language, and the CPU hardware-related part is written in assembly language. It is applicable to a variety of mi-croprocessor and microcontroller. μC/OS-II can manage 63 kinds of application tasks, and it has advantages of high execution efficiency, small occupation space, good real-time performance and strong scalability and so on. Its minimum core can be compiled to 2KB. μC/OS-II has been almost ported to all the famous CPU. Thus, the study of this paper mainly solves the transplant problems of μC/OS-II into AM-AZON processor.
The main contents of the study including design and commissioning of hardware, architecture, writing and debugging of control software are shown as follows: (1) Complete system migration based on μC/OS-II operation system; (2) Hardware design and software program control of Ethernet module. The coordinator mainly solves the communication issue with master platform μC/OS-II; while the terminal is responsible for communication control of home system; (3) Construct a network of appliances with CAN fieldbus so that the system is connected to its remote control.
The design methods of the system are shown as follows: (1) By analyzing the involved functions and technological frontier of networked home automation system currently, we can ensure that the system would meet the requirements as far as possible; (2) We adopt the modular design idea which is conducive to the creation and promotion, and figure out the communication method between the main platform and each module; ABSTRACT: In recent years, with the popularity of computers and smart phones and the development of intelligent building in electronics industry, people's requirement of living environment is gradually changing. The intelligent home furnishing building has become the new focus of people purchasing. And the networked home automation system which relies on the advanced network technology to connect with air conditioning, lighting, security, curtains, TV, water heater and other home furnishing systems into a local area network becomes a networked control system. μC /OS is a real-time operating system with the free open-source code, the compact structure and the preemptive real-time kernel. In this paper, the author focuses on the design of home furnishing total controller based on AMAZON multimedia processor and μC/OS-II real-time operating system, and achieves the remote access connection and control through the Ethernet. (4) Combine the system design with experiment through continuous experimentations and practices to improve the design of each module.

SYSTEM OVERVIEW
The design of this system involves several key technologies, and the whole design consists of the hardware part and the software part. In terms of software, it mainly uses an embedded operating system, which can achieve more rational use of CPU, and even the software design can realize modularization, so that it is easier to make the code; in terms of hardware, to realize remote access connection and control home furnishing system, we adopt the widely-covering Ethernet, which can be used to realize the remote control anywhere in the world as long as there is a local network coverage; in terms of mobile control, we adopt GSM to realize the remote control just through a mobile phone. As for local area network appliances, we use reliable CAN fieldbus to realize the short frame multi-host communication.
Real time operate system (RTOS) is the software foundation of embedded CPU. RTOS kernel provides CPU management, hardware initialization, MMU, timers, interrupt, task management, memory management, device management, file and network support, and it also provides the programming interfaces of C/C++, JAVA, graphics module and so on.
With the improvement of community service, through the terminal equipment installed in each household, the intelligent community can achieve functions of information dissemination, property management, three-table transfer, and emergency help and so on. In the past, such information terminal is connected with community service center by laying line, such as 485 bus which needs large quantities and has high failure rate and low efficiency, because it can only take a host round robin. Therefore, if we can take use of the ready and stable Ethernet to set up a community service system, it will be a very meaningful thing.
Fieldbus control system (FCS) is not only an open communication network, but also a fully distributed control system. It is the link of intelligent equipment, so we connect the intelligent equipment to a networking system, and the intelligent equipment which serves as a network node is hung on a bus, then, we further construct an automation system to realize the synthesis automation functions of basic control, compensation calculation, parameter modification, alarm, display, control, optimization and management control integration. This is a comprehensive technology taking smart sensors, control, computers, digital communications and network as the main contents.
In this paper, we focus on the design of home furnishing total controller based on AMAZON multimedia processor and μC/OS-II real-time operating system, and achieve remote access connection and control through the Ethernet. We embed the real-time operat-ing system in the system so as to give it a strong portability. Hardware adding and cutting also has great flexibility. Embedded system which can access to the network will realize the remote monitoring, maintenance and upgrades of home equipment, and realize resource sharing as well.
According to the most common functional requirements of home at present, smart home should realize automatic detection and alarm, appliances automatic control, home environment automatic detection and control and so on. The overall structure of smart home based on IOT is shown in Figure 1: The system is mainly divided into 12 sections: central controller, expansion subsystem of things, appliances subsystem, environmental monitoring subsystem, access subsystem, Zigbee coordinator, router, remote PC or tablet and mobile phone. Its functional modules mainly include smart power, alarm handling, emergency treatment, camera surveillance, central controller, and more than 20 other modules. These modules can achieve systematic functions of environmental information perception, processing and control, aiming at protecting all the security problems of the home as much as possible.

OVERALL DESIGN
The intelligent access control system is divided into the hardware system and the software system. The overall structure of the system is shown in Figure 2: In particular, the hardware system and the software system mainly include: (1) Intelligent access controller: By the ZigBee Remote transmission authentication information, it can achieve the personnel access control. Preclude the use of ARM7TDMI architecture AT91SAM7x256 chip as the main chip, by the Atmel's AT86RF212 ZigBee chip interface expansion and equipped with large-capacity Flash memory chip, it can simultaneously store authorization information and credit card records of multiple rooms, thus, it can achieve the access control for multiple rooms.
(2) Multi-protocol encryption reader: Using NXP's RC632 multi-protocol RFID reader chip, it can be compatible with multiple protocols. Aiming at the problems of current Mifare card encryption algorithm being cracked, the multi-protocol encryption reader provides interfaces with ID card and non-contact CPU card.
(3) Embedded gateway: Using the ARM7TDMI architecture chip AT91SAM7x256, it can be used to achieve the conversion of ZigBee protocol and TCP / IP protocol. Transmit data with the remote server via Ethernet, therefore, it is out of the shackles of the computer.
(4) Network camera: It is used for video surveillance of access personnel, and sending the videos or pictures to a remote server through TCP/IP interface.

Web of Conferences MATEC
03013-p.2 (5) Access management website and authorization issuance system: The access management website mainly includes authorization management system, intelligent monitoring system and alarm system. The main function of authorization issuance system is to release the authorization information to the embedded gateway and then to the access controller.

HARDWARE DESIGN
The hardware of this system consists of five modules which are responsible for the external device status acquisition and extracts, the data characteristics analysis and the network transmission of data.
The embedded system is a specialized computer system, of which hardware and software can be configured. It takes applications as the core and computer technology as the foundation with strict requirements function, reliability, cost, volume, and power consumption. Therefore, reliable hardware system is a prerequisite for stable operation of embedded systems. The system in our study uses AMAZON embedded multimedia system platform.
(1) Total controller: The system takes the AMA-ZON processor as the main controller. AMAZON is a multimedia processor integrated with image accelerator and sound accelerator, which is widely applied in games, upscale user terminal and so on.
(2) Input-output device of total controller: The input of total controller adopts the widely-used PS2 mouse and keyboard; its output adopts VGA monitor to provide friendly and convenient interface to user.
(3) Remote terminal: The system takes PC as a remote access terminal through Ethernet IP protocol and total controller to achieve access and control of the appliances.
(4) GSM phone module: In the case of inconvenient Ethernet operation, users can control their appliances by mobile phone no matter where they are and what time it is. (5) Lighting, appliances group and alarm group: This is a component part of the system and an operative part of appliances. Since the system uses the field-bus as the LAN bus, which brings much convenience to add and removal of the components, it is easy to change the components without alteration of the original components.
The block diagram of hardware system is shown as Figure 3.

SOFTWARE COMPONENTS
In terms of software, it consists of multiple layers of different composition functions: (1) Hardware controls: It includes the underlying task control block switching, hardware interrupt and basic read-and-write operation of equipment, which are the necessary operating system and device driver layer.
(2) Operation system: It includes the tasks scheduling, the message volume control, the events respond, and the CPU utilization statistics and so on. It provides a mechanism to queue messages for device drivers and other events, and provides the multi-task management and multiple concurrent processes running for application. It is the core of the system, determining the response speed of the system and CPU distribution.
(3) Device driver: It provides the operation interface of the system equipment, including initialization read-and-write device and so on. It requires the system to provide appropriate mechanisms.
(4) System call interface: The user program and the operating system are connected through the system call interface.
(5) Application: That is, the user program which implements the user's applications of different functions.
The block diagram of software system is shown as Figure 4: The system debugging process aims at finding out software error and hardware error of the developing system, and then makes corrections or improvements. The environment of system development is the integrated development software, KEIL.
The problems and workarounds in the debugging process are summed up as follows: (1) The error is reported as "Error C235 ' OSSemCreate': redefinition". The cause of the error is that the compiled code is reentrant by KEIL default, but the multi-task system requires a concurrent operation in reentrant, so it needs to mark the reentrant keyword following each C function and its statement. Through modifying the correlation function in μC/OS-II source code, this problem has been solved.
(2) The keyword AT89S51 hasn't been defined in debugging program. Later, we found that it didn't include the head file "reg51.h" in application and IN-CLUDES.H.
(3) In the debugging process, the infrared receiving head was often burned out. Once we weld one 10K resistance into infrared receiver power supply pins, the receiving head is no longer burned out.
Debugging result: After the overall system debugging mentioned earlier, when the corresponding analog signal is transmitted to the input port, the program could run the corresponding task, which means that the system function can be achieved by the simulation running. Finally, we write the HEX file generated by compilation into ROM through compiler, and conduct the system FBI.

B. Test result
With the rapid development of science and technology and the continuous improvement of people's living standards, people's requirement of living environment is gradually changing. This topic complies with this requirement with the corresponding research on networked home automation system. We deeply study the application of embedded technology and networks in the home automation system, and the embedded system access to the network will realize the remote monitoring, the maintenance and upgrades of home equipment, and the resource sharing as well. The main work and research done in this paper is concluded as follows: (1) This paper focuses on the design of home furnishing total controller based on AMAZON multimedia processor and μC/OS-II real-time operating system, and achieves the remote access connection and control through the Ethernet.
(2) We embed the real-time operating system in the system so as to give it a strong portability. μC/OS is a real-time operating system with free open source code, compact structure and preemptive real-time kernel. Its predecessor was μC/OS which are specifically designed for embedded computer applications. μC/OS-II can be used to manage 63 application tasks, and has the advantages of high execution efficiency, small occupation space, good real-time performance and strong scalability and so on. Its minimum core can be compiled to 2KB. μC/OS-II has been ported to almost all the famous CPU. Study of this paper mainly solves the transplant problems of μC/OS-II into AMAZON processor.
(3) Connect and control the appliances through field-bus CAN bus. Hardware adding and cutting also has great flexibility.

CONCLUSION
Through the study mentioned earlier, the author achieves a basic networked home automation system. However, due to the limit of technology development level, personal learning ability, time, energy and cost, there are still many issues to be improved in this study: (1) Further research on embedded technology: The embedded technology is still under development, so we can apply more perfect embedded technology, more stable real-time operating system and faster network to improve the home furnishing automation system within the family.
(2) Further research on remote control technology: Nowadays, through mobile phone, tablet PC and other electronic equipment, we can easily browse the web and complete WEB applications. However, if they are developed corresponding APPs on handheld devices based on android system, the operation, versatility and stability of the system will be improved better.
(3) Further improvements of the security of the system: In terms of device management and application, this system is used to consider how to effectively strengthen the inspection of the user, and consider how to set more stable control equipment and monitoring equipment parameters.
(4) Improvements of the user's manipulation of beauty: The system needs to provide more enjoyable experience and more precise and convenient interaction for users, so that it can reduce the probability of incorrect operation.