Design of internal network of smart home system based on ZigBee technology

Publisher:rockstar6Latest update time:2012-10-24 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Abstract: In order to improve the rapid deployment capability of smart home systems and reduce construction costs, a design scheme for building the internal basic network of smart home systems using ZigBee wireless networking technology is proposed. The scheme uses wireless RF transceiver CC2430 chip and peripheral circuits to design the hardware circuits of terminal devices and central coordinators. The communication application software of terminal devices and central coordinators is written in C language according to the ZigBee protocol stack.

After the world's first intelligent building appeared in the United States in 1984, the intelligentization of home environment has become the mainstream of current society. With the acceleration of people's pace of life and the increase of life pressure, smart home has become a necessary way for people to pursue a comfortable life. Smart home network refers to a network system that connects various electrical equipment and electrical subsystems through certain transmission media (such as power lines, twisted pairs, coaxial cables, radio, infrared, etc.) within the home, uses a unified communication protocol, realizes resource control internally, and can exchange information with the outside through gateway devices. This paper proposes a solution to build the underlying network of the smart home system through ZigBee wireless networking technology. The purpose is to make the underlying network construction of the smart home system simple and fast, so that the entire smart home system has the characteristics of rapid deployment and easy expansion.

1 Network Structure Overview

The basic network of the smart home system designed in this paper adopts ZigBee wireless networking technology to realize the internal network of the home system, and the basic network structure adopts a star topology. The terminal devices of the home internal network are formed by ZigBee wireless communication modules, smart home appliances and sensors; FFD (Full Function Device) devices are used as the central coordinator of the ZigBee network inside the home, responsible for establishing and maintaining the network; RS232 serial port communication is used to connect the central coordinator and the central control server, and connected to the Internet through a PC. The system structure is shown in Figure 1. As the underlying basic network of the smart home system, the internal ZigBee wireless network in the home can realize the following functions: (1) Collect data and information inside the home environment. (2) Perform preliminary preprocessing for simple situations uploaded by terminal devices. (3) Summarize basic network information and upload data to the central control server through the RS232 serial port communication protocol.

Figure 1 System structure diagram

Figure 1 System structure diagram

2 ZigBee Technology

ZigBee is a short-range, low-power wireless personal network communication protocol based on the IEEE802.15.4 standard. It has the characteristics of short distance, low complexity, self-organization, low power consumption, low data rate and low cost.

The ZigBee protocol stack is built based on the OSI (Open Systems Interconnection) seven-layer structure. To simplify the protocol stack, the ZigBee protocol stack consists of four layers, namely the physical layer, MAC layer, network layer and application layer. The ZigBee protocol stack structure is shown in Figure 2.

Figure 2 ZigBee protocol stack structure

Figure 2 ZigBee protocol stack structure diagram.

(1) Physical layer: The main functions are starting and shutting down the radio transceiver, energy monitoring in the current channel, receiving packet connection quality indication, clearing the channel for CSMA-CA confirmation, channel frequency selection, data transmission and reception.

(2) Medium Access Control Layer (MAC Layer): The MAC layer is responsible for maintaining the interface of the physical radio channel. Its tasks include: generating network beacons for the coordinator, synchronizing network beacons, maintaining the joining and leaving of personal area networks, maintaining device security, using the CSMA-CA mechanism for channel management, processing and maintaining the GTS mechanism, and ensuring reliable connections within the MAC entity.

(3) Network layer: The ZigBee network layer is defined by the ZigBee Alliance and is responsible for providing wireless network functions such as establishing, joining and leaving the network, and performing routing and forwarding.

(4) Application layer: Developed by users according to their needs. In general, the functions to be achieved by the application layer are: maintaining node functions, discovering other working nodes near the node, and maintaining and managing communications between multiple nodes.

3 ZigBee Basic Network Hardware

3.1 Introduction to ZigBee Data Transmission Module

The chip used in the data transmission module of the system's ZigBee basic network is the CC2430 radio frequency chip. The CC2430 is a wireless SOC (System On Chip) design. The general circuits required by the system are integrated inside the chip, and only simple peripheral circuits are needed to realize the signal receiving and sending functions.

The CC2430 application circuit is shown in Figure 3.

Figure 3 CC2430 application circuit

Figure 3 CC2430 application circuit.

The circuit uses an unbalanced antenna. The unbalanced transformer is composed of capacitor C341, inductors L341, L321, L331 and a printed circuit microwave transmission line. The entire structure meets the requirements of RF input and output matching resistance of 50 Ω; R221 and R261 are bias resistors, and resistor R221 is mainly used to provide a suitable working current for the 32 MHz crystal oscillator; XTAL1 is a 32 MHz crystal oscillator, using a 32 MHz quartz resonator and 2 capacitors (C191 and C211) to form a 32 MHz crystal oscillator circuit; XTAL2 is a 32.768 kHz crystal oscillator, using a 32.768 kHz quartz resonator and 2 capacitors (C441 and C431) to form a 32.768 kHz crystal oscillator circuit; The voltage regulator is required for all 1.8 V The voltage pin and internal power supply, capacitors C241 and C421 are decoupling capacitors, used for power supply filtering to improve the stability of chip operation. This system uses a standard 10-core debugging interface in the design of both the terminal equipment and the central coordinator.

The debug interface uses CC2430's P2_1 as debug data IO and P2_2 as debug clock. In non-debug mode, these two IOs can be used as GPIO.

The debug interface allows on-chip Flash programming, access to memory and registers, setting breakpoints, single-stepping, and modifying register contents. When the RESET_N input is held low, if the debug clock is forced to experience two consecutive rising edges, the system enters debug mode.

3.2 Terminal equipment structure design

The terminal device is the source of internal data in the smart home environment and the specific executor of control commands. As shown in Figure 4, it is mainly composed of a smart home appliance module, a signal modulation module, and a ZigBee data transmission module. On the one hand, the terminal device collects internal data information of the home environment through the sensor unit in the smart home appliance module, obtains useful signals through the signal modulation module, and then uploads the information with the help of the wireless data transmission module; on the other hand, the terminal device can receive control commands through the wireless data transmission module and transmit them to the command execution unit of the smart home appliance module for command execution.

Figure 4 Terminal device structure.

Figure 4 Terminal device structure.

3.3 Central coordinator structure design

The central coordinator is the core of the smart home wireless internal network. It is responsible for establishing and maintaining the network, sending data information from the terminal device to the PC through the serial port, and transmitting the command from the control center to the correct terminal device. The specific structure is shown in Figure 5. The difference from the terminal device is that the central coordinator does not contain the smart home appliance module and signal modulation module. In order to monitor the serial port receiving interrupt, the RS232 serial port is expanded on the central coordinator hardware platform.

Figure 5 Central coordinator structure

Figure 5: Central coordinator structure.

4 ZigBee network communication software

4.1 Channel Allocation

The wireless channel of the wireless ZigBee network of the smart home system can be configured through MAC_RADIO_SET_CHANEL(x) in the ZigBee protocol stack, where the parameter x is the channel number and the default value is channel 11. The MAC_RADIO_SET_CHANEL(x) function can be defined in the mac_radio_defs.h file.

The primitive is used to start the establishment of the smart home system network. Since the star network is used in this paper, only the central coordinator is allowed to perform the initial network establishment in the smart home system.

Specific process: The application layer starts the network establishment process through NLME_NETWORK_FORMATION.request. After receiving the command, the network layer immediately asks the MAC layer to scan the channel; After the MAC layer completes the first scan, it feeds the scan results back to the network layer. The network layer management entity sorts the received channels according to the energy value and further processes them to find a suitable channel; Then the network layer configures a PAN identifier and a 16-bit network address for this network to start the network.

4.2 Joining the network

First, the terminal device starts the process of joining the network through the NLME_NETWORK_DISCOVERY.request primitive. The network layer then sends the MLME_SCAN.request to ask the MAC layer to perform channel scanning.

When MAC completes the scan, it will feedback the scan information to the network layer management entity. The network layer management entity then sends a network discovery confirmation primitive, and uploads the scanned ZigBee version number, stack structure, domain network identifiers, logical channels, and whether the connection is allowed to the application layer. The application layer decides whether to join and applies to join by sending a join primitive. At this time, after receiving the application for joining request from the terminal device, the central coordinator issues a command to allow joining to the MAC layer through the NLME_NETWORK_JOINING. request primitive, and feedbacks the execution of the command through the NLME_PERMIT_JOINING. confirm primitive.

The PermitDuration parameter in the Join Request primitive is the connection time that the ZigBee coordinator allows the terminal device to connect. The valid value range is 0x00 ~ 0xFF. When the PermitDuration parameter is set between 0x01 and 0xFE, the network layer management entity will set a timer to count the time and thus set a time limit for the connection. In smart home systems, there is usually no need to set a time limit for the connection between the terminal device and the central coordinator, so this parameter is usually set to 0xFF.

4.3 Terminal equipment program flow

The terminal device collects information through the sensor module and uploads the collected information with the help of the ZigBee module. When the ZigBee module receives the control command, the control module is responsible for executing the operation according to the command. The program flow is as follows: Turn on the power to start the terminal device, initialize the hardware resources of the terminal device, start the protocol stack, and join the network. When the device successfully joins the network, start setting the cyclic acquisition clock. When a data packet is received, the terminal device immediately interprets the data information and executes the command. If there is no data packet received, the acquisition process will begin. When it is found that the collected data exceeds the limit, the processing program will be entered according to the predetermined procedure and the alarm data packet alarm will be transmitted upward. When the cyclic sampling point is reached, the system will upload the collected data at that moment.

Figure 6 Terminal equipment program flow chart

Figure 6 Terminal equipment program flow chart

4.4 Central Coordinator Program Flow

The central coordinator receives data information from the terminal device through the ZigBee module, and connects to the PC through a serial port line to transmit the collected information to the central control server. The process is as follows: Turn on the power switch to start the central coordinator, and its main program starts. The hardware of the device is initialized through the halBoardInit() function, and the system enters the network establishment process.

After the network is established, the central coordinator enters an infinite loop working state: If there is radio data, it enters the radio data reception process. After the reception is completed, the received information needs to be uploaded to the control center; If there is no radio data access, the serial port control command is judged, and the coordinator immediately begins to parse the command and transmit it downward. When these two processes are completed, the system returns to the judgment process of whether there is radio data, and the system enters another cycle.

Figure 7 Central coordinator program flow chart

Figure 7 Central coordinator program flow chart

5 Conclusion

The underlying basic network of the smart home system is built with ZigBee wireless networking technology. By building a low-cost and fast-deployed basic wireless network, the cost and difficulty of building the smart home system are reduced. In addition, the smart home system based on this also has good scalability. According to specific application requirements, different smart home appliance modules can be connected with wireless data transmission modules to access the smart home system.



Reference address:Design of internal network of smart home system based on ZigBee technology

Previous article:A brief analysis of the application of radio frequency identification technology in wine anti-counterfeiting
Next article:Design and application of LED lighting controller based on Zigbee technology

Latest Security Electronics Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号