How to design zigBee-based smart home?

Smart home is a house as a platform, the use of integrated wiring technology, network communication technology, security technology, automatic control technology, audio and video technology to integrate the household life related facilities, schedule to build efficient residential facilities and family affairs management system, improve home security, convenience, comfort, artistry, and realize environmental protection and energy saving living environment. Based on the latest definition of smart home, refer to the characteristics of the ZigBee technology, design of this system, the necessary in contains a smart home system (smart home (central) control system, household lighting control system, home security systems), on the basis of joined the household wiring system, home network system, background music system and family environment control system. On the affirmation that lives in intelligence, installed all necessary system completely only, and the household system that installed optional system of one kind and above at least can call intelligence lives in. Therefore, this system can be called intelligent home.

1. System Design Scheme

The system is composed of controlled devices and remote control devices in the home. Among them, the controlled devices in the family mainly include the computer that can access the Internet, the control center, the monitoring node and the controller of household appliances that can be added. Remote control devices are mainly composed of remote computers and mobile phones.

The main functions of the system are: 1) the front page of the web page browsing, background information management; 2) Realize switch control of indoor household appliances, security and lighting through Internet and mobile phone; 3) Through the RFID module to realize user identification, so as to complete the indoor security status switch, in case of theft through SMS alarm to the user; 4) Through the central control management system software to complete the local control and status display of indoor lighting and household appliances; 5) Personal information storage and indoor equipment status storage are completed by using the database. It is convenient for users to query the indoor equipment status through the central control and management system.

2. System Hardware Design

The hardware design of the system includes the design of the control center, the monitoring node and the optional addition of the home appliance controller (take the electric fan controller as an example).

2.1 The Control Center

The main functions of the control center are as follows: 1) To build a wireless ZigBee network, add all monitoring nodes to the network, and realize the reception of new equipment; 2) user identification, the user at home or back through the user card to achieve indoor security switch; 3) When a burglar intrudes into the room, send a short message to the user to alarm. Users can also control indoor security, lighting and home appliances through short messages; 4) When the system is running alone, the LCD displays the current system status, which is convenient for users to view; 5) Store the state of electrical equipment and send it to PC to realize the system online.

The hardware supports Carrier sense multiple access/Collision detection (CSMA/CA). The operating voltage of 2.0 ~ 3.6V is conducive to low power consumption of the system. Set up a wireless ZigBee star network indoors by connecting to the ZigBee coordinator module in the control center. And all the monitoring nodes, selected to add the home appliance controller as the terminal node in the network to join the network, so as to realize the wireless ZigBee network control of indoor security and home appliances.

2.2 Monitoring Nodes

The functions of the monitoring node are as follows: 1) human body signal detection, sound and light alarm when thieves invade; 2) lighting control, the control mode is divided into automatic control and manual control, automatic control is on/off the light automatically according to the strength of the indoor light, manual control lighting control is through the central control system, (3) the alarm information and other information sent to the control center, and receives control commands from the control center to complete the equipment control.

Infrared plus microwave detection mode is the most common way in human body signal detection. The pyroelectric infrared probe is RE200B, and the amplification device is BISS0001. RE200B is powered by 3-10 V voltage and has built-in pyroelectric dual-sensitive infrared element. When the element receives infrared light, the photoelectric effect will occur at the poles of each element and the charge will accumulate. BISS0001 is a digital-analog hybrid asIC composed of operational amplifier, voltage comparator, state controller, delay time timer and blocking time timer. Together with RE200B and a few components, the passive pyroelectric infrared switch can be formed. Ant-g100 module was used for microwave sensor, the center frequency was 10 GHz, and the maximum establishment time was 6μs. Combined with pyroelectric infrared module, the error rate of target detection can be effectively reduced.

Light control module is mainly composed of photosensitive resistor and light control relay. Connect the photosensitive resistor in series with the adjustable resistor of 10 K ω, then connect the other end of the photosensitive resistor to the ground, and connect the other end of the adjustable resistor to the high level. The voltage value of the two resistance connection points is obtained through the SCM analog-to-digital converter to determine whether the current light is on. Adjustable resistance can be adjusted by the user to meet the light intensity when the light is just turned on. Indoor lighting switches are controlled by relays. Only one input/output port can be achieved.

2.3 Select the Added Home Appliance Controller

Choose to add the control of household appliances mainly according to the function of the device to achieve device control, here to the electric fan as an example. Fan control is the control center will be PC fan control instructions sent to the electric fan controller through ZigBee network implementation, different appliances identification number is different, for example, the provisions of this agreement fan identification number is 122, the domestic color TV identification number is 123, thus realizing the recognition of different electrical home appliances control center. For the same instruction code, different home appliances perform different functions. Figure 4 shows the composition of household appliances selected for addition.

3. System software design

The system software design mainly includes six parts, which are remote control web page design, central control management system design, control center main controller ATMegal28 program design, CC2430 coordinator program design, CC2430 monitoring node program design, CC2430 select add device program design.

3.1 ZigBee Coordinator program design

The coordinator first completes the application layer initialization, sets the application layer state and receive state to idle, then turns on global interrupts and initializes the I/O port. The coordinator then starts building a wireless star network. In the protocol, the coordinator automatically selects the 2.4 GHz band, the maximum number of bits per second is 62 500, the default PANID is 0×1347, the maximum stack depth is 5, the maximum number of bytes per send is 93, and the serial port baud rate is 57 600 bit/s. The SL0W TIMER generates 10 interrupts per second. After the ZigBee network is successfully established, the coordinator sends its address to the MCU of the control center. Here, the control center MCU identifies the ZigBee Coordinator as a member of the monitoring node, and its identified address is 0. The program enters the main loop. First, determine whether there is new data sent by the terminal node, if there is, the data is directly transmitted to the MCU of the control center; Determine whether the MCU of the control center has instructions sent down, if so, send the instructions down to the corresponding ZigBee terminal node; Judge whether security is open, whether there is a burglar, if so, send the alarm information to the MCU of the control center; Judge whether the light is in automatic control state, if so, turn on the analog-to-digital converter for sampling, the sampling value is the key to turn on or off the light, if the light state changes, the new state information is transmitted to the control center MC-U.

3.2 ZigBee Terminal Node Programming

ZigBee terminal node refers to the wireless ZigBee node controlled by the ZigBee coordinator. In the system, it is mainly the monitoring node and the optional addition of household appliance controller. Initialization of ZigBee terminal nodes also includes application layer initialization, opening interrupts, and initializing I/O ports. Then try to join the ZigBee network. It is important to note that only end nodes with ZigBee coordinator setup are allowed to join the network. If the ZigBee terminal node fails to join the network, it will try again every two seconds until it successfully joins the network. After joining the network successfully, the ZI-Gbee terminal node sends its registration information to the ZigBee Coordinator, which then forwards it to the MCU of the control center to complete the registration of the ZigBee terminal node. If the ZigBee terminal node is a monitoring node, it can realize the control of lighting and security. The program is similar to the ZigBee coordinator, except that the monitoring node needs to send data to the ZigBee coordinator, and then the ZigBee Coordinator sends data to the MCU of the control center. If the ZigBee terminal node is an electric fan controller, it only needs to receive the data of the upper computer without uploading the state, so its control can be directly completed in the interruption of wireless data receiving. In wireless data receiving interruption, all terminal nodes translate the received control instructions into the control parameters of the node itself, and do not process the received wireless instructions in the main program of the node.

4 Online Debugging

The increasing instruction for the instruction code of fixed equipment issued by the central control management system is sent to MCU of the control center through the serial port of the computer, and to the coordinator through the two-line interface, and then to the ZigBee terminal node by the coordinator. When the terminal node receives the data, the data is sent to the PC through the serial port again. On this PC, the data received by the ZigBee terminal node is compared with the data sent by the control center. The central control management system sends 2 instructions every second. After 5 hours of testing, the testing software stops when it shows that the total number of received packets is 36,000 packets. The test results of multi-protocol data transmission testing software are shown in Figure 6. The number of correct packets is 36 000, the number of wrong packets is 0, and the accuracy rate is 100%.

ZigBee technology is used to realize the internal networking of smart home, which has the advantages of convenient remote control, flexible addition of new equipment and reliable control performance. RFTD technology is used to realize user identification and improve system security. Through the access of GSM module, the remote control and alarm functions are realized.


Post time: Jan-06-2022

WhatsApp Online Chat !