Selected from 21ic Forum, TI Wireless Connection Subforum, original post link at the bottom “Read Original”
The smart home controller introduced in this article utilizes ZigBee technology to integrate many relatively independent household appliances into a unified smart home system, facilitating local operation of various electrical devices in the home, while also enabling remote control of various electrical devices through the Internet or GPRS system.
ZigBee is an emerging wireless network technology characterized by short-range, low complexity, low power consumption, low data rate, and low cost, with broad application prospects in many fields.
Smart home is a multifunctional integrated technology system that uses the home as a platform, utilizing advanced computer technology, communication technology, network technology, control technology, and information technology to organically connect various electrical devices in the home through some form of network, achieving networked comprehensive management and control, providing people with a comfortable, safe, convenient, environmentally friendly, and efficient living environment.
The smart home controller introduced in this article utilizes ZigBee technology to integrate many relatively independent household appliances into a unified smart home system, facilitating local operation of various electrical devices in the home, while also enabling remote control of various electrical devices through the Internet or GPRS system.
1. Introduction to ZigBee Technology
ZigBee technology has gradually developed in recent years and is a wireless connection technology with significant market potential. It was created to meet the requirements for low power consumption, low data volume, and low-cost wireless networks. It is based on the IEEE Wireless Personal Area Network (WPAN) Working Group’s 802.15.4 standard, known as the ZigBee technology standard.
The complete ZigBee protocol consists of the application layer, application support layer, network layer, data link layer, and physical layer, as shown in Figure 1.
The IEEE 802.15.4 standard defines the physical layer (PHY) and data link layer (MAC); the protocols above the network layer are formulated by the ZigBee Alliance, which includes the application layer consisting of the application support sublayer (APS), ZigBee Device Object (ZDO), and application objects defined by manufacturers.
ZigBee relies on independent working nodes and utilizes wireless communication to form three network structures: star, mesh, and cluster through self-organization, thus each node’s functions are not entirely identical. To reduce system costs, IEEE 802.15.4 defines two types of physical device types: Full Function Device (FFD) and Reduced Function Device (RFD). FFD nodes have controller functionality, provide data exchange, and can serve as network coordinators, routing nodes, and terminal nodes, allowing communication with any type of device in the network; RFDs can only be used as terminal nodes and can only communicate with FFDs, with no communication possible between two RFD nodes.
ZigBee wireless communication technology features short-range, low complexity, low power consumption, low data rate, low cost, security and reliability, large network capacity, self-organization, and strong self-healing capabilities, making it widely applicable in multiple technical fields with broad market prospects.
2. Design of Smart Home Controller Based on ZigBee Technology
The network communication of the smart home system has the following characteristics:
1. Small data transmission volume, no need for high transmission speeds; 2. Large network capacity to meet various home appliance needs; 3. Good timeliness of information with low latency.
The technical characteristics of ZigBee determine that it can well meet the above requirements of smart home networks, especially with self-organization and self-healing capabilities, making this wireless communication technology an ideal communication method for smart home systems.
2.1 Basic Components of Smart Home System
The smart home system can achieve interconnection of information through GSM/GPRS/CDMA/network, ZigBee personal area network, the Internet, and community information networks. Users can control household appliances and lighting devices via mobile phones while outdoors and receive timely alerts for theft, fire, gas leaks, etc.; at home, they can control electrical devices using a remote control. The controller also serves as a visual intercom system’s indoor host, allowing users to view various community information and send emergency signals to community security if necessary. The system mainly consists of a smart home controller and several indoor monitoring ZigBee functional modules. The system model is shown in Figure 2. The smart home controller connects with external facilities through two wireless communication networks, the Internet, and two wired communication lines, thus it can also be viewed as a digital home gateway.
The smart home controller is equipped with a mobile module that communicates with the user’s mobile phone through the GSM (GPRS, CDMA) mobile communication network, enabling two-way short message transmission. Users can control the power switch of household appliances and adjust brightness and speed via mobile messages; the controller sends alarm signals to the user’s mobile phone via SMS for theft, fire, gas leak, and other emergency alerts.
The controller contains a ZigBee module that communicates with monitoring devices in the home through the ZigBee wireless network, serving as a ZigBee network coordinator (FFD). It is responsible for building the smart home ZigBee network, receiving commands sent by the system control center, and processing them accordingly. It also sends data received from routing nodes (FFD) or terminal nodes (RFD) back to the system control center.
Indoor monitoring devices can be divided into three categories based on their use: the first category includes switches and sockets, where the simplest socket controls household appliances (such as rice cookers, water dispensers, TVs, refrigerators, air conditioners, washing machines, electric curtains, and non-dimming lamps) by turning them on and off via small electronic switches; more complex smart switches and sockets have adjustable output power for dimming chandeliers, floor lamps, or adjusting fan speeds. The second category consists of sensor products, where passive infrared sensors and door magnetic sensors are used for theft prevention, smoke sensors for fire prevention, gas sensors for gas leak detection, and manual alarm buttons for emergencies (such as sudden illness of elderly individuals). These nodes are equipped with ZigBee modules, serving as terminal nodes (RFD). The third category includes handheld remote controls, which not only control the switches of household appliances and adjust brightness and speed but also set and control lighting scenes.
If the community is equipped with property management communication networks and intercom systems, the controller also functions as the indoor host of the visual intercom system.
The LCD display on the controller can show visitor images and allow intercom or unlocking operations with visitors. Additionally, the controller can receive various text messages sent by the community property management; in case of emergencies at home, it can send alarm signals to the property management. The controller has an internet interface for users to control household appliances remotely via the internet and monitor events happening at home. The advent of the next-generation internet will greatly support this function, as every appliance and the controller itself will have its own static IP address, becoming a part of the network.
ZigBee’s cluster network combines the characteristics of star and mesh structures. In practical applications, we use the smart home controller and ZigBee sensor nodes to form a cluster network. It has good scalability; for larger homes or villa users, the network coverage can be expanded by adding routing nodes; for smaller homes, reducing routing nodes can turn it into a star network, saving energy and speeding up data transmission.
2.2 Hardware Design of Smart Home Controller
2.2.1 Introduction to Smart Home Controller
The core component of the smart home system is the smart home controller. Its block diagram is shown in Figure 3, centered around an embedded processor, including a mobile module, ZigBee module, and necessary auxiliary interfaces. The smart home controller acts as the control center of the entire smart home system, with the central processing unit as its hardware core, handling all tasks such as device control, task scheduling, communication protocol conversion, data transmission, and data management. Considering functionality, scalability, operating system support, and power consumption, we selected the powerful 32-bit ARM9 microprocessor S3C2410X as the main processor, with 64M NAND Flash and 64M SDRAM for memory.
For the human-computer interface, a 5-inch TFT LCD screen is used, equipped with a corresponding touch screen. It can display visitor images and various information sent by the community property management, allowing users to easily input data to control various home devices. Additionally, to make the control method more flexible, a keyboard interface is designed using the processor’s I2C bus interface, allowing for the expansion of various control and alarm methods. The controller has two communication modules: a mobile module and a ZigBee module. The mobile module consists of a host module, SIM card interface, audio part, and RF part, using the SIM300 chip (GPRS module) produced by SIMCOM. Data transmission with ARM uses a standard RS-232 interface, and AT commands are employed to operate the module for sending and receiving short messages. The ZigBee module collects the operational status of various household appliances and receives various fault alarm information, transmitting data via the RS-232 interface to the ARM.
The controller is equipped with an Ethernet interface, and with the web server established on the controller, users can monitor the home environment and various household appliances via the Internet. The RS-485 interface in Figure 3 is used for communication with the community property management (compatible with the existing community network; if it is a newly built community, the Ethernet interface can be used directly). Using MAX3232, two USART transceivers of ARM9 form two RS-232 ports and one RS-485 port.
The audio interface uses the internal IIS bus interface of the microprocessor to connect with an external audio digital signal encoder chip (UDA1341TS).
The video interface uses a DSP chip from Zhongxin Micro to convert video signals into JPG file format or binary image streams that the microprocessor can process, which are displayed on the LCD screen after processing.
2.2.2 ZigBee Module in Smart Home Controller
The ZigBee module adopts the Full Function Device (FFD) type, playing the role of network coordinator in the smart home system, providing bidirectional transmission to connect with other Reduced Function Devices (RFD) in the smart home system.
The CC2430 chip inherits the architecture of the previous CC2420 chip, integrating ZigBee RF front-end, memory, and microcontroller on a single chip. It uses an 8-bit MCU (8051), with 128KB of programmable flash memory and 8KB of RAM, and includes an analog-to-digital converter, four timers, an AES-128 co-processor, a watchdog timer, a 32kHz crystal oscillator for sleep mode timing, a power-on reset circuit, a power failure detection circuit, and 21 programmable I/O pins.
The CC2430 chip is produced using 0.18μm CMOS technology, with a current consumption of 27mA during operation; in receive and transmit modes, the current consumption is below 27mA or 25mA respectively. The CC2430’s sleep mode and ultra-short transition time to active mode make it particularly suitable for applications requiring very long battery life.
The CC2430 features two powerful USART communication interfaces supporting multiple protocol sets; through one of these interfaces, the S3C2410X processor can write to or read configuration information from the CC2430, as well as send and receive data. The CC2430 chip integrates functions such as CRC and data integrity checks, reducing the programmer’s workload, speeding up communication, and reducing energy consumption. Additionally, the chip employs CSMA-CA technology to avoid competition and conflicts during data transmission, further reducing unnecessary energy consumption. Thus, the CC2430 chip has ultra-low energy consumption, with a lifespan measured in years, and is cost-effective, meeting the needs of sensor networks with numerous distributed nodes.
The controller collects the operational status of various household appliances and receives various fault alarm information through the ZigBee module via the RS-232 interface.
2.3 Functions of Smart Home Controller
The operating system of the smart home controller is based on the open-source embedded Linux operating system, which has been trimmed and ported to the controller’s hardware platform. This smart home controller integrates Linux, ARM system, mobile module, and ZigBee module into a complete embedded system, easily achieving wireless connections among multiple nodes within the home using ZigBee technology. The functions of the smart home controller include:
1. Utilizing an ARM architecture 32-bit embedded RISC processor and open-source embedded Linux operating system;
2. Serving as the control center of the smart home control system, also acting as the gateway for the information appliance platform in the home system;
3. In case of theft or illness, pressing the emergency button automatically sends an alarm to the management center;
4. Configured on a household basis, utilizing the LCD screen to display community notifications, system operational statuses, and data;
5. Monitoring various fault alarm data (fire, gas leaks, etc.) using ZigBee sensor nodes, automatically sending alerts to users or the community management center via the mobile module;
6. Communicating with the community management center via Ethernet (or RS-485);
7. Communicating with various sub-nodes in the home system through the wireless ZigBee module on the controller to control multiple household appliances accordingly;
8. Allowing users to remotely monitor various household appliances in the home via the Internet.
The smart home controller collects the operational status of various household appliances through the ZigBee module and stores various fault alarm data in a database; it prioritizes fault alarms, automatically sending short messages to the user’s mobile phone or community property management, while real-time data is stored in the database for further analysis and statistics. Here, the database acts as middleware connecting the front and back ends, storing status data for remote monitoring and local LCD display, while also receiving inputs from browsers and local keyboards, with communication programs and CGI programs executing control commands and uploading operational statuses; at the same time, the database must perform fault analysis, statistics, and queries. In this system design, we use the embedded database SQLite to meet the requirements for remote control data transmission and data sharing.
The software of the controller is mainly divided into four modules: communication programs with data acquisition interfaces, fault alarm programs, local human-computer interaction programs, and remote control programs. To allow users to control the smart home network via the Internet using a browser, a web server needs to be established on the controller (digital home gateway) for communication with users, utilizing CGI interfaces to invoke backend CGI programs. The CGI program establishes a connection between the web server and control programs, invoking specific control programs to perform designated operations on the internal nodes of the smart home network. It monitors the network, allowing users to know the status of devices in the network anytime and anywhere, controlling various devices within the network. Network monitoring is also very important in home networks, enabling users to know the network status at any time, such as device join/leave, device faults, etc.
3. Conclusion
ZigBee technology fills the gap in the low-cost, low-power, and low-speed wireless communication market. The hardware of the smart home controller consists of an advanced ARM9 embedded system, a mobile module, and a ZigBee module; the operating system employs embedded Linux, and the home network utilizes ZigBee wireless networking, ensuring good security and comprehensive system functionality, capable of meeting the future development needs of smart homes.