Frontiers in Computing and Intelligent Systems ISSN: 2832-6024 | Vol. 1, No. 3, 2022 13 Smart home design based on Alibaba Cloud Zhigang Lu, Jian Hu, Tao Niu, Yonggang Zuo Anhui Industry Polytechnic, Tongling, China. Abstract: With the continuous progress of science and technology, the pace of social informatization is also accelerating, people's demand for a safe, comfortable and controllable intelligent home environment is growing. In this paper, we design a iot based on ali cloud platform control system of smart home solutions, choose stm32 microcontroller as the main control unit, ali as a hardware device, a time server and related sensors for home fire alarm, intelligent entrance guard, infrared detection, temperature and humidity detection display, light intensity, and other functions. The ESP8266 module is used as the wireless communication module to realize the data communication between hardware and software. A WeChat small program is designed as the upper computer of the user terminal to realize the intelligent management of the user terminal for home. Users can check the running status of related devices at home at any time in the WeChat mini program, such as temperature and humidity, smoke status, and whether someone has invaded. Keywords: Internet of Things; Alibaba Cloud; WeChat applet. 1. Introduction With the continuous development of communication technology, iot related technologies and applications have been rapidly developed in the past few years. Internet of Things (IoT) is the interconnection of things and things. It uses computer technology, wireless sensor technology, RFID radio frequency identification technology, etc., based on the Internet, to achieve the "communication" between people and things, things and things. The application of Internet of Things technology in smart home control system aims to connect electrical appliances and living facilities in the home together to achieve video surveillance, intelligent anti-theft, intelligent lighting, intelligent electrical control, intelligent door and window control, intelligent audio-visual system control and other functions .Users can achieve remote real- time control of lights, curtains and appliances at home through computers, tablets and smart phones. The system is simple, practical, easy to operate and easy to maintain, and it can monitor the home environment and remotely operate some devices through the human-computer interaction interface, which has certain practical value. 2. Overall design of the system The architecture of iot can be divided into perception layer, network layer (transport layer) and application layer . The perception layer is used to sense and collect all kinds of information in the physical world, and uses the communication module to realize the connection between the physical entity and the network. This system uses infrared sensor, temperature sensor, smoke sensor and flame sensor to collect environmental information. In addition, also connected to the buzzer, fans, lights and other electrical equipment, used to simulate remote control. When the data collected by the sensor is greater than the threshold set in the hardware program, the buzzer rings the alarm. The network layer is used to complete the transmission, routing and control of information. It is the intermediary between the sensing layer and the application layer, and is responsible for receiving the data of the sensing layer and transmitting the data to the application layer. In this system, ESP8266 module is used as the wireless communication module to send the data collected by hardware to Aliyun platform for processing. The application layer is the remote terminal, this design uses the mobile phone WeChat small program as the remote terminal to achieve remote control. The application layer is connected through the WIFI hotspot to obtain the data information of the perception layer of Aliyun server. The APP can display the data information collected by the sensor, namely the current temperature, smoke concentration, and whether flame is detected. At the same time, the WeChat small program can also realize the remote control of electrical equipment, such as buzzer, fan, lamp, etc., so as to realize the home safety protection management function. The overall block diagram of the system is shown in Figure 1. The system is composed of four parts: main controller, sensor module, wireless communication module and cloud server. The user clicks on the small program side, and the web page sends corresponding requests to the cloud server background. The cloud server background combined with the communication background sends instructions to the main controller, which processes the instructions from the server and sends them to the node. The node controls the relay according to the instructions to complete the lighting control. The master controller sends instructions to the sensor node every once in a while, to request sensor data, and uploads it to the server. The mini program side periodically refreshes sensor information. Stm32 Temperature and humidity detection Light intensity detection Smoke detection RFID access control detection Infrared obstacle detection Temperature and humidity display Door lock control Smoke alarm device Temperature and humidity regulation Obstacle alarm device Mobile phone and computer OLED display Power Signal transmission and reception WIFI Signal reception and upload Figure 1. Overall block diagram of the system 14 3. System function realization The system realizes the functions of temperature and humidity detection display and temperature regulation, light intensity detection and temperature regulation, fire alarm, access control switch, WeChat small program terminal control and information acquisition. The intelligent terminal mainly realizes three functions: data collection of smart home environment factors, data uploading cloud platform, and response to control instructions of host computer. The system uses the STM32 chip development board, and realizes the data acquisition of temperature and humidity detection and light intensity detection through external sensors. The data is uploaded through the ESP8266 Wi-Fi module, and the master controller sends the switch signal to the relay to realize the opening and closing state of the relay control terminal equipment. 3.1. Main Controller Low power consumption, low design cost and efficient and compact instruction set are important indicators for smart home control system to select the main control core processor. Based on the actual situation, this system adopts a 32-bit microcontroller STM32F103C8T6 chip based on ARM Cortex-M.STM32F103C8T6 is embedded with Flash program memory and has a capacity of 64KB.Its low power consumption, low voltage, need voltage range 2V~3.6V;Its working environment requirements are relatively loose, the working temperature range is -40°C~85°C, the system clock can be up to 72MHz, can be widely used in complex climate region. 3.2. Temperature and humidity detection and temperature control function The core of the temperature and humidity detection circuit is the DHT11 digital temperature and humidity sensor. DHT11 temperature and humidity sensor is composed of two parts: digital acquisition module and temperature and humidity sensor module. Due to its stable structure and calibrated digital signal technology, DHT11 digital temperature and humidity sensor has high stability. The sensor part includes a humidity sensing element and a temperature measuring device, which is connected with a single chip microcomputer. It has strong anti-interference ability and fast response, so it has a very high cost performance. DHT11 uses 4 needle single row packaging, external circuit is simple, convenient connection, and his compact size, low power consumption makes it more suitable for intelligent home music now, does not take up space, long time use will not cause a lot of power consumption. DHT11 communication process, the bus is at a high level, the bus issued to wait to receive signal instruction, pull the low level, waiting for DHT11 response, when the low level duration is greater than 18us, to meet the length of time DHT11 received the signal, DHT11 began to receive the host signal, when the host began to receive the signal, After the host sends the start signal, it waits for about 30us and reads the feedback signal from DHT11. After the host sends the start signal, it can switch to the input mode, that is, output the high level, and then the bus pulls the high level by the external pull up resistor [5-7]. In the initial stage, the bus is low, DHT11 sends a request response signal first, and then the bus will pull the bus up by 80us as a response. At this time, DHT11 begins to prepare to send data, and every bit sends response signal in the 50us low level time slot. If the read signal is high, DHT11 will not respond. At this time, it is necessary to check whether the circuit is correct. When all the data are sent, DHT11 bus will be pulled down by 50us, and then the pull up resistor of the bus will enter the idle state and wait for the next signal. This system collects temperature data and air humidity data by measuring, and outputs digital information to the processor. After collecting the data through the sensor, the temperature and humidity information is displayed on the display screen after signal processing. The system is also equipped with an automatic cooling device. When the temperature is higher than the set value, the electric fan is automatically turned on to cool down, and the fan speed is adjusted with the temperature. The system can monitor the indoor temperature and humidity in real time and start the electric fan to cool down when the temperature is higher than 26 ℃. When the temperature is higher than 26 ℃, the fan has a low wind speed. When the temperature is higher than 28 ℃, the fan speed increases to medium wind speed. When the temperature is higher than 30 ° C, the wind speed is high, and the fan runs at full power and drops temperature. start Bus pull up host delay 40us Slave sends 80us low level Read data Data inspection end Host pull down delay 18us Whether the slave responds to the signal Slave sends 80us high level N Y Figure 2. Flow chart of temperature and humidity detection 3.3. Flame smoke detection and alarm function The flame smoke detection part is composed of far-infrared flame sensor and MQ-2 gas smoke sensor. The far-infrared flame sensor can detect infrared light in the wavelength range of 700 ~ 1 000 nm, and the detection Angle is 60°. When the wavelength of infrared light is near 880 nm, the sensitivity is the highest. The far-infrared flame probe converts the intensity change of external infrared light into the current change, which is reflected as the value change in the range of 0 ~ 255 through A/D converter. The stronger the external infrared light, the smaller the value. The weaker the infrared light, the larger the value. Send the value to stm32 to alarm 15 according to the set value. The alarm device of the system uses the buzzer to simulate the alarm, the buzzer uses low level trigger mode, through the program can be set the buzzer sound time and frequency, when the detection of flame, gas leakage or other combustible gas, the system automatically alarms (buzzer and alarm light). When encountering open fire or combustible gas, the buzzer will sound and the alarm light will flash, so as to effectively warn the home gas leakage and dangerous fire source, and bring safety protection for home life. start initialization Collect smoke value Wireless transmission Read the numerical Abnormal smoke concentration display end Information alarm Y N Figure 3. Flow chart of smoke alarm 3.4. Light Intensity Detection This design selects the illumination intensity GY-30 detection module, its chip is BH1750FVI illumination sensor.BH1750FVI is a new 16-bit digital light intensity sensor, which can be applied to monitor the change of light intensity in a large range of places, and the accuracy of light intensity is relatively high, which meets the needs of the system. Figure 4-3 shows the GY-30 detection module used in the system. The GY-30 detection module communicates with the master controller using the standard I 2 C bus protocol. Firstly, the master controller will send the starting signal. Then, it sends 8 bits of address data, the last bit of which is 1, indicating the read command. Finally, the reply signal of BH1750FVI is read. After the final data byte is sent, the master controller generates the end signal and the data is transmitted. The data collection steps of BH1750FVI sensor are shown in the figure below start initialization Collect illumination value Wireless transmission Read the numerical Value is too large display end Turn off the lights and draw the curtains Y N Figure 4. Flow chart of illumination detection 3.5. RFID access control function RFID access control system identifies objects with electronic tags, and the access control system uses RFID readers to identify electronic tags. If the electronic tag matches the set value, it is regarded as a successful match and the door lock is opened. If it cannot be matched correctly, the door lock status remains unchanged. Infrared detection automatic door opening function uses infrared obstacle avoidance sensor to detect the arrival of personnel, upload the data to the main controller stm32, control the door switch. Infrared obstacle avoidance sensor is mainly composed of infrared transmitter, infrared receiver and potentiometer. According to the reflection characteristics of the object, if there is no obstacle, the infrared radiation will be weakened and disappear with its propagation distance; If there is an obstacle, when the obstacle is encountered, the ray is reflected and received by the infrared receiver, triggering the signal to change. Wireless communication module: Esp8266-12f is used as the Wi-Fi communication module. ESP8266 is a low power and high integration Wi-Fi chip produced by Lexin company, which supports 802. 11 b /g /n wireless standard, built-in TCP /IP protocol stack. Itself can host programs to perform work independently; Can also be carried from the machine to the host, execute the instructions of the host, play the role of Wi-Fi adapter, ESP8266 support UART, SPI, I2C, GPIO and other communication interfaces. 4. Small program terminal data display and control function This system uses Ali Cloud to build MQTT iot cloud server as the system server. Through wireless WiFi and terminal APP, it can send instructions to the stm32 main controller to control household appliances, such as lights, TVS and electronic door locks, etc. It can also obtain the current weather conditions in real time to remind users to collect clothes when it rains. As shown in the figure below. Stm32 Esp8266 Wifi module Sens or cont rolle r Dis play Alibaba Cloud ECS WeChat applet Client Device side Figure 5. Architecture diagram of iot 4.1. WeChat applet design WeChat applet is a kind of application developed by Tencent company without download and installation can be used, it realizes the dream of application within reach, users can open the application by scanning or searching, but also a convenient application development. Small program programming using HTML+CSS+JS such a combination, where WXML is used to describe the structure of the current page, wxss is used to describe the appearance of the page, JS through is used to deal with the page and user interaction. 16 Figure 6. WeChat applet interface 5. Conclusion Based on the Internet of things technology, this paper designs and implements a multi-functional smart home security monitoring system, which integrates the functions of home fire prevention, indoor temperature and humidity detection and regulation, RFID access control and wireless control, and will provide a more comfortable, convenient and safe experience for modern home life. It is believed that with the development of Internet of Things technology and the advent of 5G era, combined with cloud computing, big data and other technologies, the intelligent home system will be fully realized, and the Internet of Things technology will also better provide a more comfortable experience for modern home life. Acknowledgments This paper is the research result of the hybrid teaching research project (2021jyxm0209) of Anhui Industry Polytechnic on NC machining technology. Supported by the provincial quality engineering project "Research on Hybrid Teaching of Numerical Control Processing Technology" (2021jyxm0209) of colleges and universities in Anhui Province, the project leader Niu Tao gave relevant guidance to the research content of this paper. References [1] BELLEY C, GABOURY S, BOUCHARD B, et al. An efficient and inexpensive method for activity recognition within a smart home based on load signatures of appliances [J]. Pervasive and Mobile Computing, 2014, 12(12) : 58-78. [2] XU C Y, ZHENG X, XIONG X M. he design and implementation of a low cost and high security smart home system based on Wi-Fi and SSL technologies [J].Journal of Physics: Conference Series, 2017, 806(1) : 12. [3] Chen Haiming, Cui Li, Xie Kaibin. A comparativestudy on architecture and implementation methodologiesof internet of things. Chinese Journal of Computers,2013, 36(1): 169-187. [4] Lin Tao, Ye Feng, Wang Qiang, etc. City LightingCloud Platform and Application of IOT[J]. ZHAOMING GONGCHENG XUEBAO, 2014, 17(5): 53-59. [5] Lin Tao, Ye Feng, Wang Qiang, etc. City LightingCloud Platform and Application of IOT[J]. ZHAOMING GONGCHENG XUEBAO, 2014, 17(5): 53-59. [6] Wang Yuanzhuo, Jin Xiaolong, Chen Xueqi. NetworkBig Data: Present and Future[J]. Chinese Journal ofComputers, 2013, 369(6): 1125-1138. [7] Wang Teng. Design and Implementation of the WideColor Gamut and Intellitgent Illuminating ControlSystem Based on Bigbee[D]. Qing Dao: OceanUniversity of China, 2014.