Design and implementation of smart home system based on ZigBee (paper + source code)_kaic

Summary

With the development of smart homes, the demand for smart home systems is increasing, and the management and monitoring of smart home systems are becoming more secure and convenient. This smart home system has broad market prospects. This article uses the MQTT protocol, which is more suitable for communication security issues in the Internet environment of smart home systems. It realizes the control and remote control of the lighting system through the diaper network protocol, MQTT protocol and voice recognition SDK. Due to the low popularity of smart homes in China, many users have low recognition of smart homes, the cost is high, and deployment is difficult, which limits the further promotion of smart homes. This article aims to develop a smart home system with simple work, flexible management, and the highest deployment cost to help users experience the convenience, flexibility, and low cost of smart homes. ZigBee technology is a new type of wireless communication and a product of the times. Thanks to the rapid development of the smartphone industry, rapid changes in Internet connection technology, and the wave of Internet components, smart homes have gradually become the smart home system for family home development. Free home system, MCU CC2530 minimum microchip system, intelligent circuit, environmental monitoring, central control, touch screen, intelligent switch system, control line network, third-party physical plug-in monitoring. The CC2530 adapter is connected through the rt5350 combination gateway to build a WiFi and ZigBee communication bridge. The software system of this article mainly covers the Zig Bee network software project, using WiFi tags and Zig Bee tags for simulation conversion, using TCP servers and fixed addresses and gateway numbers to manage management instructions and viewing login screens, and using SQLite to store data. Additionally, upon completion of the project, the operation of the wireless smart home system was tested. The system performed well in various tests and met the expected system requirements.

Keywords: Android; WIFI; ZigBee; smart home system
Abstract

With the development of smart homes, the demand for smart home systems is increasing, and the management and monitoring of smart home systems are becoming more secure and convenient. This smart home system has broad market prospects. This article adopts the MQTT protocol, which is more suitable for communication security issues in the Internet environment of smart home systems. It achieves control and distancing of the lighting system through the diaper network protocol, MQTT protocol, and speech recognition SDK. Due to the low popularity of smart homes in China, many users have low recognition of smart homes, high costs, and difficulty in deployment, which limits the further promotion of smart homes. This article aims to develop a smart home system with simple work, flexible management, and the highest deployment cost, helping users experience the convenience, flexibility, and low cost of smart homes. ZigBee technology is a new type of wireless communication and a product of the times.Thanks to the rapid development of the smartphone industry, the rapid transformation of internet connectivity technology, and the wave of internet components, smart homes have gradually become the smart home system for the development of home furnishings. Free home system, MCU CC2530 minimum microchip system, intelligent circuit, environmental monitoring, central control, touch screen, intelligent switch system, control line network, third-party physical plugin monitoring. The CC2530 adapter is connected through the rt5350 composite gateway to build a WiFi and ZigBee communication bridge. The software system in this article mainly covers the Zig Bee network software project, using WiFi tags and Zig Bee tags for analog conversion, using TCP servers and fixed addresses and gateway numbers to manage instructions and view login screens, and using SQLite to store data. In addition, after the project was completed, the operation of the wireless smart home system was tested. The system has performed well in various tests and meets the expected system requirements.
Key words: Android; WIFI; ZigBee; Intelligent Home Furnishing system
 
目录
第一章 绪论.
1.1 课题研究背景及意义.
1.2国内外研究现状.
第二章 相关技术介绍.
2.1 ZigBee芯片选型.
2.2 CC2530核心电路.
第三章 系统需求分析.
3.1需求分析.
3.2网络通信技术方案选择.
3.3无线智能家居系统的组成.
3.4控制终端操作系统的选择.
3.5系统用例分析.
第四章 系统设计.
4.1智能家居系统模块构成.
4.2系统整体功能模块.
4.3电源模块.
4.4子控制器硬件设计.
4.5 ZigBee无线网络的软件设计.
4.6射频无线网络的软件设计.
4.7 WIFI无线网络的软件设计.
4.8数据库设计.
第五章 系统实现.
5.1登录界面的设计与实现.
5.2主控界面的设计与实现.
5.3各房间界面的设计与实现.
5.4情景模式界面的设计与实现.
第六章 系统测试.
6.1智能灯测试.
6.2智能插座测试.
6.3智能窗帘测试.
6.4情景模式测试.
Chapter 7 Conclusion.
Acknowledgments.
References.

 
Chapter 1 Introduction
1.1 Research Background and Significance of the Project
With the development of economy and the advancement of science and technology, people's quality of life continues to improve. In the early 1980s, household appliances using electronic products began to appear in the United States [1]. In 1988, in developed countries such as the United States, Europe and Japan, commercial control and management systems for communication, electrification and safety of various buildings using buses were established. In the early 1990s, smart homes gradually developed in Southeast Asia, Hong Kong and Macao. Around 1995, the concept of "smart home" appeared in mainland China. In the late 1990s, smart buildings, smart homes and smart communities began to flourish. Smart home appliances connect high-tech equipment such as computers, wireless communications, and automatic control equipment to make users feel more comfortable, efficient, and safe at home. The smart home computer is the brain of the system, responsible for managing the home system and providing users with a window to communicate with the system. A clever piece of homemade communication - it's a nervous system that allows you to execute various commands from top to bottom. Smart home automation devices are part of a system that can simplify all types of homework. Smart home systems can improve living conditions in many ways: Light-sensitive sensors can respond to the brightness in the room in real time via central control. When the light intensity is lower than the predetermined threshold, the central control issues instructions to control the light of the lighting system according to the user's rules and adjust the internal light to open the curtains. The temperature and humidity sensor reports the recorded home temperature to the central controller in real time [2]. The central controller controls household appliances such as air conditioners and air conditioners according to the user's rules to ensure air circulation in the room. Family is always at its best. When the gas detector detects that the smoke in each room or the burning gas such as natural gas in the kitchen is higher than a certain standard, an alarm will be sent to the control center to remind the user of the danger. Users can view photos taken by home cameras in real time on their mobile phones. This function can not only prevent theft, but also monitor the elderly and children, providing more convenience for staff; when the system is in the enhanced state, if the door is opened, the magnetic field sensor installed in the door will send an alarm to the central controller, and the home environment will send out an alarm. Alerts, warning users of illegal intrusions into residential environments. With the help of online communication technology, automatic control technology and information technology, communication between users and home appliances can become natural and simple, even in a home environment. There are many uses for smart home systems not listed here.
With the development of smart homes, the demand for smart home systems is increasing, and the management and monitoring of smart home systems are becoming more and more secure and convenient [3]. This smart home system has broad market prospects. This article uses the MQTT protocol, which is more suitable for communication security issues in the Internet environment of smart home systems. It realizes the control and remote control of the lighting system through the diaper network protocol, MQTT protocol and voice recognition SDK. Due to the low popularity of smart homes in China, many users have low recognition of smart homes, the cost is high, and deployment is difficult, which limits the further promotion of smart homes. This article aims to develop a smart home system with simple work, flexible management, and the highest deployment cost to help users experience the convenience, flexibility, and low cost of smart homes. ZigBee technology is a new type of wireless communication and a product of the times. As people enter an era of rapid development, there is an increasing demand for comfortable smart homes and household appliances [4]. ZigBee technology was invented in this context. ZigBee technology enables us to develop and produce simple smart home products that meet people's needs. This saves people's time, facilitates people's production and life, greatly improves the effective use of time, improves economic benefits, and improves people's overall living standards. ZigBee technology is developing rapidly abroad and has become a new star in the European and American markets. Sales of related smart products are growing in international markets. More and more domestic users are using smart home products to live a comfortable life. In order to adapt to the rapid development of festivals and the growing demand for smart products such as smart devices, it has become increasingly important to study the application of ZigBee technology in smart home systems.
Researching ZigBee technology in smart home systems will help smart home product manufacturers develop and produce smart home products that meet people's needs [5]. Research on smart products reveals the shortcomings and shortcomings of original technologies. At the same time, we will continue to promote and develop solutions related to original technologies, adopt new and old technologies, and develop and produce more scientific, reasonable, practical and efficient smart products. This not only helps people obtain a comfortable and healthy living environment, but also helps the effective application of ZigBee technology in smart home systems, improves the scientificity and practicality of smart home products, and maximizes the development level of smart home products. ZigBee technology is widely used in fields such as medical care, public resource sharing, traffic management, parking management, attendance management and remote monitoring. With the continuous development of the market economy, people have put forward higher requirements for living standards and actively improved and improved the current environment and living conditions. The rapid development of owych Internet information technology has enabled the simultaneous development of computer communication technology, network technology, automatic control technology and sensing technology [6]. Therefore, people have put forward the concept of smart homes, hoping to create a smarter life through information technology. The smart box adopts a multi-field and multi-process system design, which integrates various resources, including smart devices, home computers, home security equipment, etc. Smart controls are used to manage and display data. Users can use smart home terminals to control various workflow parameters and use them in a comfortable environment. A smart life has just begun. Concept noise, lack of content, inconsistent standards, and narrow coverage. Some manufacturers use smoke alarms, fingerprint scanners, video surveillance and other features that are considered smart home environments to generalize and exaggerate the functionality of their products. Device connections are weak and connections are difficult to expand. Traditional smart home control mainly uses LED displays, which have many limitations and obvious shortcomings: limited moving distance, complex wiring, and difficult subsequent maintenance. In addition, the original product interface has many functions and is quite complicated to use, which greatly reduces the user experience and cannot be recognized in the market. At present, smart homes are relatively mature and widely used in wireless technologies such as Wi-Fi, Zig Bee and IoT. Smart homes are gradually developing into wireless networks, and smart homes will become the latest development direction of future home design [7]. This article recommends using Zig Bee wireless technology to collect raw data for home computers, effectively monitor the working status of the device, and establish communication between the home gateway and the database. Customers can view collected data and operational status. System development can provide important environmental assessment parameters, such as temperature, humidity, duration of harmful gases, light intensity, fire information, etc. At the same time, compared with normal thresholds, intelligent systems have become the focus of current research, and their research has important application value and practical significance.
1.2 Research status at home and abroad
Smart home was born in the era of home appliances. In the era of home automation, smart home has developed. Modern smart home systems have done a lot. Recent state-of-the-art home systems incorporate computer guards, wireless communications and automation equipment into the building and combine previously insulated home equipment and wireless communications and automation equipment into one organic system. Users can control and manage the hardware of this organic system in real time on their computers. With all the more serious environmental issues in the world, governments around the world are taking energy-intensive buildings more and more seriously. All leaders pledged to support energy-efficient buildings. Of course, green buildings are being built all over the world. How to integrate wind energy, solar energy and other renewable energy into the smart home economy, and understand that the joint development of smart buildings and low-energy buildings is increasingly becoming the core system of smart homes.
In 2005, Perlsfor conducted a detailed study of the smart home market. In the United States, 14.86% of this will be used to create “smart” homes online [8]. In European countries, approximately 37.68% of German households, 36.54% of Swedish and British households, and 34.5% of French and Italian households use some type of smart home product [9]. The smart machine intrusion rate in Asian countries, Japan, South Korea and China is also rising, with Japan reaching 27.31%. Not only do housing prices in the European Union and the United States have mature, stable, and high prices, but there is still a long way to go in the research and development of long-lasting smart home systems [10]. In recent years, the intervention of well-known companies such as Microsoft and Motorola has affected the development of smart home systems; they have become more active and well-known. In countries such as Asia, Japan, and South Korea, well-known European and American companies have invested heavily in the research and development of the most advanced smart home systems. The X-10 system in the United States, the EIB system in Germany, and the 8x system in Singapore are all popular smart homes in foreign markets [11].
Around 1995, the concept of smart home was gradually introduced into China and gradually spread from Shenzhen and Shanghai to domestic cities [12]. Therefore, compared with developed countries, my country's smart home economy started late and the level of smart home system construction is relatively high. However, there are no unifying national values. Smart home systems in the Chinese market are often directly integrated with smart home materials produced by various companies. Communication profiles between subsystems made by different manufacturers have not been created. In these situations, it is difficult to develop and exploit the advantages and possibilities of ICT in computer networks. Without proper coordination and communication, users cannot have unified control over their home environment. Developed countries dominate the smart home market, but domestic smart home owners have poor experience and high costs. With the development of China's economy and the increase in the purchasing power of the population, the development prospects of China's intellectual property market are unlimited [13]. Thanks to the invisible market demand, well-known domestic companies are increasingly investing human and financial resources in European and American countries. In recent years, a smart home economy has developed using smart hardware and software produced by domestic companies in daily life. Problems such as high cost, small footprint, and poor user experience of domestic smart home products are gradually improving. "Bingyu Home" and "Qihua" are smart home systems independently developed by Chinese companies. To sum up, our smart homes started late, have uneven standards, high costs, very low participation, poor user experience, etc. China's GDP ranks second in the world. The increase in domestic purchasing power has severely disrupted the smart home market. Under the influence of the market, well-known domestic companies and entrepreneurs have devoted themselves to research and development work in the field of intellectual property [14]. Our country's smart home management has developed to a certain extent, but the gap with developed countries such as Europe is much larger than that of the United States and still exists. The failure to harmonize industry standards has been a disgrace to us smart housewives. In addition, lower energy consumption, more efficient use of renewable energy and higher intelligence are also the only way forward for the development of China's smart home systems in the future.
Starting from the 21st century, the cost of deploying relatively mature intelligent systems, such as Microsoft’s “Intelligent System”, IBM’s “Home Dynamic System” and Apple’s “Home Dynamic System” is relatively high [ 15]. With the development of communication technology, many developed countries have formulated unified standards for smart homes, such as X10 in the United States, EBI in Europe and 8X protocol in Singapore. Through the introduction and promotion of electronic equipment by Sanchez Antonio and other experts, data mining algorithms in smart home systems are proposed, combined with machine learning algorithms, to optimize the overall performance of various electronic equipment. However, due to the diversity of various ecosystem protocols, properties, and specifications, there are still some barriers to accessing a unique interface that provides full user management in the Internet. Large-scale fragmentation in home automation systems limits compatibility and increases development complexity and cost. Simeoniezequiel et al. provide a secure and scalable smart communication channel for integrating specific technologies. Tushirbhaghyashri and colleagues quantified the impact of distributed service attacks (DDoS) and DDoS power-out attacks on smart Wi-Fi devices and discussed the root causes from the perspectives of attackers, victim devices, and access points. In China, the IEEE system integrating mobile management terminals for air conditioners and refrigerators was developed by Tsinghua Electronics, Huawei's smart boards, Hanwei home security products and a series of micro-intelligent products. Zhong Jianguo used Wi-Fi technology to transform the power grid and successfully developed various online home appliance back-end service systems by accessing websites. Yang Lina and others proposed a smart home privacy protection method based on DES encryption and improved the minimum degree of relevance (LSB) data hiding algorithm. From the perspective of the smart housing market, by the end of 2019, China has become the world's largest Internet product market. China Institute of Technology and Business predicts that China’s smart home market will grow by US$6.516 billion in 2022. RMB. The number of domestic intellectual enterprises has also increased from 24,600 in 2016 to 1,777,900 in 2021. With the rapid development of China's market economy, people's quality of life is increasing day by day, and so are their smart living standards. Smart living has become a hot research topic. However, due to the low level of public information construction in China, the application of Internet of Things technology is not enough, and smart home systems are also in the development stage. As the home environment deteriorates, many specialized home environment monitoring software companies have been established in China, specializing in the research and development of smart home systems and launching a series of mature tracking and mobile products. But there are obvious shortcomings in the cable technology system. First of all, the system wiring is complex, the load is large, the wiring is complex, and it is easy to damage the interior of the house. Second, the system is expensive to install and maintain, requiring the purchase of large amounts of cables and fixtures, as well as following node changes. Third, the scalability of the system is poor, and changing the monitored objects may put pressure on the wireless technology. 17. Finally, the maneuverability is poor, which affects the appearance and interior design. In 1984, United Technologies Building Systems launched smart home for the first time and applied it to the City Plaza Building, making full use of building information technology and the integration of various hardware resources. In 1997, Bill Gates spent a lot of time and money to build an intelligent building, connect all furniture and equipment to computers for management, and establish a fast and stable network background management system.
In 1998, Singapore innovatively launched the smart system "Future Home", hoping that it could promote various ordinary households faster. The United States has developed an X-10 communication protocol that allows many ordinary American households to use this system. At present, many Western countries have established standard wired smart home systems, such as X-10 CEBus in the United States, HBS in Japan and EBI in Europe. However, existing smart products are usually directly connected through a wired network layout to form a home network structure, consuming a lot of cables and labor, and creating multiple terminal devices. Wireless communication technology can effectively solve these problems. As a short-carrier, low-power wireless communication technology, Zigbee technology realizes automatic control and remote control of various low-complexity, self-organizing and low-data-rate devices. Technology forms alliances. Hundreds of Zig Bee Alliance members are dedicated to developing and supporting this technology. Z-wave technology, as a short-wave wireless communication technology, is characterized by setting its own wireless standards on various buildings and being able to read specific values ​​of various devices, including interference and interference. The research and development of this kind of smart home at the beginning of this century has broad market prospects. These companies implement and actively plan product development and system establishment processes. After continuous polishing and upgrading, the product was officially launched in 2004. However, the smart home industry faces many difficulties in China. First, there are no unified industry standards, and there are no specialized associations or organizations to manage these standards. There are many types of products and poor compatibility. Secondly, the technology is mature, but technicians do not fully understand the market demand and do not develop products according to the specific needs of users. This is unrealistic and the operation process is complicated. Third, companies lack sufficient innovation capabilities, reliable production lines and large-scale production, resulting in high prices. In the national teams of smart home T&K and Huawei, world-class companies still have many shortcomings in terms of performance, security, technology, and practicality. Dong needs to further research and improve Zig Bee wireless technology, mainly for smart homes. China's Ministry of Information Industry and China Intelligence Automation Commission are responsible for the management of wireless frequency ranges. 
System Smart House has done a lot of research. Taking Gao Lei as an example, this article researches and designs an IoT residential intelligent monitoring system for IoT security. Under security, your system is divided into two layers: upper and lower. The internal structure includes end devices and gateways, as well as data transmission and interaction using wireless sensor technology. The gateway center consists of multiple sensing elements. The CC2530 communication module is used to collect data and then transmit it to the gateway through the Internet and then to the server. Sensors often generate fake messages and other events during data collection and interaction, and improved health data analysis algorithms are better prepared for tracking. The upper structure includes database, client and server. The modular design simplifies system management and upgrades through mobile phone design, enabling remote data connection and transmission, as well as wireless management and data interaction. It can track people's movements in real time and track and interact with data in smart home and medical monitoring fields. Through the research on the construction of Jiang Yuanhao's Internet of Things intelligent system, the article first summarizes the current situation of the Internet of Things intelligent system, and then studies its overall architecture and special design based on reality. Song Xiaodong, Shen Hang and others developed a practical smart home system based on Zig Bee technology, developed a smart home system based on Zig Bee Internet of Things, and collected and managed information from upper-layer applications and mobile applications. The chip design and Z-Stack user protocol CC2530 package can quickly improve the scalability of the hardware system and the convenience of system software development. In the article, Gao Yanchao's smart airport home system based on the Internet of Things introduced the business design based on the Internet of Things technology, including voice intelligence, network management and voice control to monitor the use of the entire home system. The logical structure and design method of the intelligent system were systematically studied, and the transmission protocol architecture was used to conduct detailed design and design of the operation of the intelligent system, and the feasibility of the system design was analyzed.
 
Chapter 2 Introduction to Related Technologies
2.1 ZigBee Chip Selection
The selection of ZigBee chips is designed for smart home sub-controllers The first step is that the most important ZigBee chips currently on the market are Ti cc240 and CC2530 series chips and Freescale mc13224.
To select a simple, relevant, and profitable ZigBee token, compare the three chips according to Table 2-1.
Table 2-1 ZigBee chip comparison
Project.cC2430.cc2530.MC13224
Voltage.2.Ov-3.6v. 2.Ov-3.6v.2.Ov-3.6v
Size.×mm.×6mm.9.5×9.5mm
Microcontroller.8051 microcontroller. 8051 microcontroller.ARMTTDMI-S
ROM.32/64/128KB.32/64/128/256KB.128KB
RAM.8KBSRAM,4KB Data.8KB. 96KB, 80K ROM
Support standard.ZigBee04/06/SimpliciTI.ZigBee07/PRO/RF4CE/
SimpliciTI.ZigBee07/PRO/RF4CE
Power consumption.Rx: 27mA
Tx: 24mA.RX: 22mA
Tx: 25mA.Rx: 28mA
TX: 29mA
Low power consumption. Suspend: 0.9uA Power down: 1uA. Suspend: 0.8uA
Power down: 0.6uA. Suspend:: 0.4uA
Power down: 0.3uA
ADC.8-14 bits.7-12 bits.12 bits
After analysis For comparison, this work uses the CC2530 chip as the ZigBee communication system. The main reasons are as follows: (1) As shown in Figure 2-1, the internal building blocks of the CC2530 microcomputer assembled with 8051 may follow the core and memory unit of the smart home management task; IO port, timer, power management module and RF module. (2) The CC2530 chip has larger memory space than the CC2430 chip. (3) The memory space of the CC2530 chip is larger than that of the mc13224 chip. CC2530 contains a compact 8051 core. (4) Compared with the other two chips, CC2530 has the largest chip combination and takes up less space.
 
Figure 2-1 Internal structural block diagram of cc2530
2.2 CC2530 core circuit
The core circuit of c2530 is shown in Figure 2-2 Show. The c2530 radio frequency system plays an important role in sending and receiving ZigBee signals, so the unbalanced converter circuit shown in Figure 2-3 is used in the wireless transceiver module to eliminate the difference between the system's exclusive antenna and the differential c2530 radio frequency port; use the figure as shown Special power circuit shown in 2-4 to ensure RF stability and ADC accuracy.
 
Figure 2-2 CC2530 microcontroller core circuit schematic
 
Figure 2-3 Balun circuit diagram
This ring is used to reduce system The difference between the single-phase antenna structure and CC2530. Its surface is shown in Figure 2-3. Changes in the balloon ring directly affect the functionality of the RF system in the antenna. However, donut variations also vary depending on the standard and type of antenna. Therefore, after repeated error correction based on Ti data, the system can obtain the best crisis value from the unbalanced transformation. The current quality directly determines the RF signal stability, transmission distance, sensitivity and accuracy of the 12-bit ADC. The characteristics of the indentation and the accuracy of high-frequency signals should be considered when installing the power supply. Therefore, this section should make it clear that when selecting peripherals, special attention should be paid to the use of high-precision resistors, the error should be controlled within 0.5%, and there are special requirements for capacitor materials. In order to reduce the power consumption of the entire system, CC2530 inserts a large power supply and a large power supply into the power supply, and the RF part connected to the power supply is set next to all the power consumption of the microcontroller. Good power efficiency not only helps improve the performance of the RF system but also improves the system's advertising accuracy. The specific power conversion of CC2530 is shown in Figure 2-4.
 
 

Guess you like

Origin blog.csdn.net/weixin_39563171/article/details/135045643